1
$\begingroup$

Suppose that I have developed a code for a 3D heat problem (without considering heat convection of the surface) with H2 elements. Now I am going to enhance the code and add the heat convection of the surface. I know that for this I have to define surface elements, e.g. S1, and upon calculating the surface area I can consider the effect of heat convection. I haven't started the code yet. For my first question, I would like to ask how it is possible to define different types of element in SMSTemplate? Should I define two SMSTemplates or one with two SMSTpologies? Or I should define it in a separate AceGen and then recall them separately in AceFEM?

$\textbf{Edit}$

So far, I have developed the following element in AceGen for the heat convective. However, after running the simulation it converges but with no effect on the results. Am I missing something?

Since my 3D elements are H2 elements with linear $\theta$ interpolation, the same is also done here with S2 elements and linear interpolation of $\theta$.

  << AceGen`;

SMSInitialize["HeatConvection3D" , "Environment" -> "AceFEM","Mode" -> "Optimal"];
SMSTemplate["SMSTopology" -> "S2" , "SMSDOFGlobal" -> 1,"SMSNodeID" -> "T", "SMSSymmetricTangent" -> False];

SMSStandardModule["Tangent and residual"];

nNodes = 9;
nNodesC = 4;

Xi ⊨ Array[SMSReal[nd$$[#, "X", 1]] &, nNodes];
Yi ⊨ Array[SMSReal[nd$$[#, "X", 2]] &, nNodes];
Zi ⊨ Array[SMSReal[nd$$[#, "X", 3]] &, nNodes];
θi ⊨ Array[SMSReal[nd$$[#, "at", 1]] &, nNodesC];
\[DoubleStruckA]t ⊨ Flatten[θi];

SMSGroupDataNames = {"Ts -surrounding temperature", "hconv -heat transfer coefficient"};
{Ts , hconv} ⊨ Array[SMSReal[es$$["Data", #]] &, Length[SMSGroupDataNames]];

SMSDo[IpIndex, 1, SMSInteger[es$$["id", "NoIntPoints"]]];

initializationC[] := (

   {ξ, η, ζ, wGauss} ⊢ 
    Array[SMSReal[es$$["IntPoints", #1, IpIndex]] &, 4];
   \[DoubleStruckCapitalN]h ⊨ {
      1/4 (-1 + η) η (-1 + ξ) ξ, 
     1/4 (-1 + η) η ξ (1 + ξ), 
     1/4 η (1 + η) ξ (1 + ξ), 
     1/4 η (1 + η) (-1 + ξ) ξ, 
     -(1/2) (-1 + η) η (-1 + ξ^2), 
     -(1/2) (-1 + η^2) ξ (1 + ξ),
     -(1/2) η (1 + η) (-1 + ξ^2),
     -(1/2) (-1 + η^2) (-1 + ξ) ξ,
     (-1 + η^2) (-1 + ξ^2)};

   {X, Y, Z} ⊨ SMSFreeze[{\[DoubleStruckCapitalN]h.Xi, \[DoubleStruckCapitalN]h.Yi, \[DoubleStruckCapitalN]h.Zi}];
   {ξi, ηi} = {{-1, 1, 1, -1}, {-1, -1, 1, 1}};

    \[DoubleStruckCapitalN]i ⊨ MapThread[1/4 (1 + ξ #1) (1 + η #2) &, {ξi, ηi}];
   θ ⊨ θi.\[DoubleStruckCapitalN]i;
   T ⊢ θ + Ts;
 );

initializationC[];

τξ ⊨ SMSD[{X, Y, Z}, ξ];
τη ⊨ SMSD[{X, Y, Z}, η];
ndA ⊨ Cross[τξ, τη];
Jd ⊨ SMSSqrt[ndA.ndA];

Πconv = 1/2 hconv (T - Ts)^2;
SMSDo[i, 1, SMSNoDOFGlobal];
    Φ ⊨ Jd SMSD[Πconv, \[DoubleStruckA]t, i];
    SMSExport[wGauss Φ , p$$[i] , "AddIn" -> True];
	SMSDo[j, 1, SMSNoDOFGlobal];
		KC ⊨ SMSD[Φ, \[DoubleStruckA]t, j];
		SMSExport[wGauss KC , s$$[i, j], "AddIn" -> True];
    SMSEndDo[];
SMSEndDo[];

SMSEndDo[];

SMSStandardModule["Postprocessing"];

θi ⊨ Array[SMSReal[nd$$[#, "at", 1]] &, nNodesC];
SMSNPostNames = {"Theta"};

SMSExport[{θi}, npost$$];

SMSWrite[];
SMTMakeDll[];

P.S. I will ask more questions in this post as I am developing the code and this is the first issue that I encountered.

$\endgroup$
  • $\begingroup$ One problem with your element seems to be your definition of temperature T. T=[Theta] + Ts; Then you define convective part as [CapitalPi]conv = 1/2 hconv (T-TS)^2. This just results in [CapitalPi]conv = 1/2 hconv [Theta]^2 $\endgroup$ – BHudobivnik May 6 '18 at 22:40
2
$\begingroup$

You need to make 2 seperate elements. First one that will integrate your heat equations on the volume (e.g. H2) and one more that will integrate your convectiove load on the surface (e.g. S2):

    << AceGen`;
    SMSInitialize["heatelement",...]
    SMSTemplate["SMSTopology" -> "H2",...]
    SMSStandardModule["Tangent and residual"];
    ...
    SMSWrite[]

    SMSInitialize["convectionelement",...]
    SMSTemplate["SMSTopology" -> "S2",...]
    SMSStandardModule["Tangent and residual"];
    ...
    SMSWrite[]

The boundary load element has to match the face of H2 element. This would be S2. If you made H2S element, then you would need to use S2S for load and for H1 S1. Additionaly, the NodeID-s and No

In AceFEM you then define meshes for H2 and S2 seperately:

    << AceFEM`;
    points = {{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0}, {0, 0, 
         1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}};
    {nx, ny, nz}={6, 8, 10};
    SMTInputData[];
    SMTAddDomain[{"heat","heatelement", {...}}];
    SMTAddDomain[{"convection","convectionelement", {...}}];

    SMTAddMesh[Hexahedron[points], "heat", "H2", {nx, ny, nz}];

Aplaying convection to the top face of hexahedron:

    SMTAddMesh[Polygon[points[[5;;8]]], "convection", "S2", {nx, ny}];

    SMTAnalysis[];

Edit: One can define additional nodes for each physical type. E.g. If we want to define an element with 1 temperature and 2 displacement degrees of freedom per node, we can define them as follows for 2D triangle:

    SMSTemplate[
      "SMSTopology" -> "T1",
      "SMSNoNodes" -> 6,
      "SMSDOFGlobal" -> {2, 2, 2, 1, 1, 1},
      "SMSAdditionalNodes" -> Hold[{#1, #2, #3} &],
      "SMSNodeID" -> {"D", "D", "D", "T", "T", "T"}
      ];

We then define an element just for convective heat (you already given an example of S2 element):

    SMSTemplate[
      "SMSTopology" -> "L1",
      "SMSDOFGlobal" -> 1
      "SMSNodeID" -> "T"
      ];
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for your complete response. I have one question now (probably I will ask more questions later :-) ). How AceGen understands that the unique degree of freedom that I have inserted for the S2 element coincides with the thermal one of the H2 element. Because my H2 element has 5 degrees of freedom for each node, one of each is the temperature. I mean how I should specify this in my code? $\endgroup$ – KratosMath May 4 '18 at 14:10
  • $\begingroup$ You have to define same number of degrees of freedom -SMSDOFGlobal at each element and same name of the node SMSNodeID. So both your H2 and S2 elements need to have "SMSDOFGlobal" -> 5, "SMSNodeID" -> "T". Alternatively you can define additional nodes for each degree of freedom, then you can define them with "standard" names "T"-temperature 1DOF per node, "D"-displacement 2/3 DOF per node e.t.c. This way you can also combine your code with elements from AceShare library. $\endgroup$ – BHudobivnik May 6 '18 at 22:58
  • $\begingroup$ Thanks a lot. I did it and I think it is working correctly. Thanks for your valuable comments. $\endgroup$ – KratosMath May 7 '18 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.