I'm new to FEM and trying to figure out what is the most efficient way of generating a mesh and solving an equation. As a warm-up to the particular problem I'm interested in, I want to calculate the evolution of the temperature profile in a gas flow within a reactor shell with two cooling tubes maintained at a given temperature.

i defined the region like this :

<< NDSolve`FEM` 
{reactorLength,shellID, tubeOD}={6.0, 0.5, 0.03};
tubeRegion = 
 Cylinder[{{0, -0.25*shellID, 
 0}, {0, -0.25*shellID, +reactorLength}}, 1 tubeOD], 
 Cylinder[{{0, 0.25*shellID, 0}, {0, 0.25*shellID, +reactorLength}}, 
 1 tubeOD]];
tubeSection = 
RegionUnion[Disk[{0, -0.25*shellID}, 1 tubeOD], 
Disk[{0, +0.25*shellID}, 1 tubeOD]];
region = RegionDifference[
Cylinder[{{0, 0, 0}, {0, 0, +reactorLength}}, shellID], tubeRegion];

So we have a large shell with two tubes in the middle. Next I generate a mesh:

regionmesh = 
ToElementMesh[region, "MaxBoundaryCellMeasure" -> 0.05/10]

And the equation to be solved :

equation = 
D[t[x, y, z], z] == 
D[t[x, y, z], {x, 2}] + D[t[x, y, z], {y, 2}] + 
10*(150 - t[x, y, z]), Element[{x, y, z}, tubeRegion]]

With the initial value:

t[x, y, z] == 
170, Element[{x, y},
RegionDifference[Disk[{0, 0}, shellID], tubeSection] && z == 0]]

The equation is then solved:

solmesh = 
NDSolveValue[{equation, dirichlet}, 
t, Element[{x, y, z}, regionmesh]];

The procedure works but the mesh does not look like it accurately reproduces the tube region. Besides, I'm specifying the initial value of the temeprature in a way that seems inconsistent with the mesh. I think it would be better if I could directly specify it on the mesh itself rather than having to specify a geometric section. Any suggestions to make this code more efficient ?

  • $\begingroup$ What is tube0D? $\endgroup$ – user21 Jan 18 '17 at 8:21
  • $\begingroup$ @user21 Added the missing parameter :) $\endgroup$ – Whelp Jan 18 '17 at 8:36
  • $\begingroup$ Wouldn't use MMA for this problem. Just my opinion :) $\endgroup$ – Valacar Jan 19 '17 at 13:21
  • $\begingroup$ @Valacar Well, that's what I have avaiable for use so :) $\endgroup$ – Whelp Jan 19 '17 at 16:15
  • $\begingroup$ Still struggling to improve this code. Any suggestions ? $\endgroup$ – Whelp Jan 25 '17 at 9:26

One thing you could do is to generate a 2D mesh and the extrude the 3D version from it.

mr = BoundaryDiscretizeRegion[RegionDifference[Disk[], tubeSection]
  (*,AccuracyGoal -> 3,PrecisionGoal -> 4*)]

enter image description here

Make a region product with a line:

rp = RegionProduct[mr, Line[{{0}, {reactorLength}}]]

enter image description here

And then you can generate a FEM mesh from it if you want:

mesh = ToElementMesh[rp];

enter image description here

Note, that even though this is a second order mesh, the boundary faces will not be curved.

| improve this answer | |

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.