# Bug? Mismatch between 2D and 3D models for steady state heat conduction

Hello, I uploaded a new example demonstrating a problem with handling of 2D models in heat transfer.

There are two versions: left: C3D8 elements, right: CPS4 elements. The red boundary has prescribed temperature, the blue boundary has prescribed heat flux density and there is a volumetric heat production.

The solid model gives the correct results (for the given discretization), whereas the plane model shows some skewness in the heat flux density. Also, the value of the flux density is not constant in the rightmost element in the non-averaged nodal solution.

1 Like

Node ordering matters in linear elementsâ€¦

``````*NODE, NSET=Nall
1,3.000000000000e+00,0.000000000000e+00,0.000000000000e+00
3,2.000000000000e+00,0.000000000000e+00,0.000000000000e+00
4,2.000000000000e+00,1.000000000000e+00,0.000000000000e+00
2,3.000000000000e+00,1.000000000000e+00,0.000000000000e+00
5,1.000000000000e+00,0.000000000000e+00,0.000000000000e+00
6,1.000000000000e+00,1.000000000000e+00,0.000000000000e+00
7,0.000000000000e+00,0.000000000000e+00,0.000000000000e+00
8,0.000000000000e+00,1.000000000000e+00,0.000000000000e+00
*ELEMENT, TYPE=CPE4, ELSET=Eall
1,      1,      2,      4,      3
2,      3,      4,      6,      5
3,      5,      6,      8,      7
``````

Youâ€™ll never see that in a fine mesh, but it happens in coarse meshes. Not a bug. This should be remarked in FEM courses as MacNeal explains in his book (1998):
Finite Elements - Richard MacNeal - Google Libros

1 Like

Could you share the entire input for CCX (including all.msh, nam, sur, etc)?

I donâ€™t think node order should matter as long as the surface definitions are adjusted to refer to the correct edges.

Though I would never use 2D thermal. 3D is just as good with shells and OUTPUT=2D if you need to pretend itâ€™s 2D.

Yes, that was what I would assume as well. Yet, based on JuanP74â€™s post I asked our library to order the book by MacNeal, that will take a while because it is out of print and obviously they ignore Google or Amazon. May be I change my mind when reading it. And you canâ€™t ignore that the result indeed depends on the numbering scheme.

And I also agree that it is safest to use generic 3D elements because the reduced dimension versions include MPCs which might cause problems, as seen in other examples of the collection

It seems that I canâ€™t attach zip files here.

You can generate the include files by running â€ścgx -b run.fbdâ€ť . It doesnâ€™t harm if separation.py is not executed properly (if you donâ€™t have the helper scripts of the example collection installed), the averaged version is where the problem is most obvious.

my apologies, itâ€™s just about reselecting elements to have same boundary conditions as before after renumbering: term1 - Google Drive

Sorry, I thought this was commonplace, just most of us forget after such a long time of learning the basics.
The remark in particular is in p. 87 of MacNealâ€™s book. But is related to the fact that linear shape functions when derived in x or y in-plane variable result in constant deformation (or corresponding variable in case of heat transfer) or linear deformation, and this is not invariant with respect to the element coordinates which are defined by node ordering.

@JuanP74, Was that the problem here? Considering it was fixed by re-ordering the nodes of the elements without changing the surfaces? Your link seems to only contain the one that gives symmetric results. Iâ€™m looking to recreate the asymmetric one.

That explanation still doesnâ€™t sound right. For a simple square element with isotropic material like this, the differentiation should reduce to the same thing as simply subtracting temperatures on opposite sides and multiplying by k. Thatâ€™s symmetric between the two element-aligned axes.

Itâ€™s because of the bilinear shape function for quadrilaterals, for example in the case of displacements in plane elasticity:
u=q1+q2 *x+q3 *y+q4 *x *y
and similar for v

if you derive u with respect to x or y to obtain the strains youâ€™ll see the strains are not invariant with respect to the element orientation.

I donâ€™t understand that equation but are you talking about arbitrary orientation or also rotating a square by 90 degrees like we have here? I donâ€™t think thereâ€™s any asymmetry in heat flux or strain in that case.

I just tried with S4 shells with heat generation superimposed with a uniform heat flux and it gives exactly the same solution with node numbers rotated by 1 around the elements. So why is S4 OK but not CPS4? I think itâ€™s a bug in CPS4 or a mistake in the model.

I apologise by my poor explanations I hope Martin can see it and he will be much better than me at explaining it.

The fbd file is the original one that creates the files for the â€śasymmetricâ€ť solution.

Got CGX to run run2d.fbd but the solution has a symmetric heat flux like the picture you posted, not the one in mkraskaâ€™s original.

I hope one of you can share the CCX (not CGX) input files so I can reproduce the problem. Iâ€™m not sure my CGX is working right since it shows a lot of error messages but does generate a solution. I think might have some Linux commands that donâ€™t work on Windows??

Itâ€™s not so much your explanations as that I canâ€™t believe your conclusion. Itâ€™s too contradictory to what I know except in buggy elements or at the edges of physical relevance where numerical error creeps in.

Itâ€™s funny because I was wondering why for such a simple mesh CGX was creating the ordering of nodes that created the unconverged solution in CCX.
Maybe in a different version the mesh is created in a way the peculiarity doesnâ€™t become apparent.
The explanation is based on the shape functions and the fact that the field of any dependent variable is a function of the spatial coordinates and time. To ensure convergence of the solution the shape functions have to be â€ścompleteâ€ť but this completeness is only required for convergence when the mesh is refined enough. So, if the solution hasnâ€™t converged then you canâ€™t say the shape functions arenâ€™t complete. This is the case here: depending on the orientation of the elements in the mesh the solution converges for a coarse mesh or not, depending on the boundary conditions.

sorry, I posted the 3D model (which has a correct symmetric solution), should have posted the 2D one, the one which exhibits the problem.

This should be the correct one (ccx input, no need to run cgx): https://gigamove.rwth-aachen.de/de/download/a80e7d42f8bf098fbf1cb22788dcb23c

I also get cgx error messages related to postscript output of pathplot. I usually ignore these, as I work with the data files and gnuplot anyways.

Yet back to the original problem. Page 87 isnâ€™t displayed in google books, so I have to wait for my hardcopyâ€¦ For now I donâ€™t see any reason for anisotropy of the linear 2D element (that is what would be adressed by the different numbering schemes). The shape function is entirely symmetric with respect to x and y, i.e. you can swap directions and get the same shape function.

And we speak of renumbering some nodes and proper adjustment of all node and surface sets. This makes a difference for the y-dependency of the result, which is not ok for boundary conditions which are entirely symmetric.

there it goes: therm1_2d - Google Drive

Thanks @JuanP74, got it working! Now Iâ€™ll try to track this down. @mkraska, that gigamove siteâ€™s download button doesnâ€™t work

Just to be clear, I donâ€™t think rotating any of the elementsâ€™ nodes in any of the 4 possible combinations (ie. 1,2,3,4, 2,3,4,1, 3,4,1,2, 4,1,2,3) should affect the heat flux in the solution, as long as the model is defined consistently with that - ie. loads on the correct faces, any rotated coordinate systems interpreted correctly, etc. Of course making the element wrong wonâ€™t work (ie. 4,3,2,1, 1,2,4,3, and friends) but CGX surely doesnâ€™t do that.

Nor should rotating of the whole mesh by an arbitrary angle cause any difference in the solution.

Turns out the heat flux load is just applied to the wrong face. Maybe CGX bug since it shows the correct face?

*SURFACE, NAME=SxL
1, S4

S4 means element nodes 4-1 which is global nodes 2,1, which are both at y=0.

1 Like

I canâ€™t reproduce the problems with Gigamove. When I click the link in the post, I am redirected to Gigamove and can download the file.

I also confirm that CGX seems to write wrong surfaces.

This is the mesh generated using run2d.fbd.

All.msh:

*NODE, NSET=Nall
1,3.000000000000e+00,0.000000000000e+00,0.000000000000e+00
2,2.000000000000e+00,0.000000000000e+00,0.000000000000e+00
3,2.000000000000e+00,1.000000000000e+00,0.000000000000e+00
4,3.000000000000e+00,1.000000000000e+00,0.000000000000e+00
5,1.000000000000e+00,0.000000000000e+00,0.000000000000e+00
6,1.000000000000e+00,1.000000000000e+00,0.000000000000e+00
7,0.000000000000e+00,0.000000000000e+00,0.000000000000e+00
8,0.000000000000e+00,1.000000000000e+00,0.000000000000e+00
*ELEMENT, TYPE=CPS4, ELSET=Eall
1, 1, 4, 3, 2
2, 2, 3, 6, 5
3, 5, 6, 8, 7

This results in the following elements

The handbook of ccx shows the face numbers versus local node numbers:

In our case, the right edge of the model corresponds to local node numbers 1 and 2 of element 1.
That should be face S1 and not S4 as written to xL.sur.

Contents of xL.sur is

``````  ** Surfaces based on xL
*SURFACE, NAME=SxL
1, S4
``````

When changing that to 1, S1, then the solution is correct. So I confirm the finding by vicmw.

To me this looks like a bug in CGX, Iâ€™ll report that to Klaus Wittig.

Thank you all for engaging in the discussion.

1 Like

Klaus Wittig has fixed the problem. The fix will be included in the next release of CGX.

The problem was caused by the command flip, which did not update the element face numbers. I used flip to adjust the element normals.

2 Likes