hexhaedron27 and 20

80 views
Skip to first unread message

César Pablo Camusso

unread,
Oct 29, 2017, 8:51:58 AM10/29/17
to Wasora
Dear partners,
I am trying to add the elements hexhaedron 27 node and 20 node. I have already programmed hexhaedron27 and it compiled.
How do I check it?
Is what I did in iepale / wasora3dquad — Bitbucket enough?
Should I modify vtk.c?
Thank you.



Jeremy Theler

unread,
Oct 30, 2017, 6:50:41 AM10/30/17
to was...@seamplex.com
Nice work!

The C functions that compute the shape functions in hexahedron20.c are named "mesh_twentyseven_node_hexahedron_h" and "mesh_twentyseven_node_hexahedron_dhdr" whilst (they should be "mesh_twenty_node_hexahedron_h" and "mesh_twenty_node_hexahedron_dhdr"

And change the copyright of those files to your name :-)


To test if it works, solve a problem first with tetrahedra and then with these elements. Try the attached .geo to create a cube with hex27. Remove the "recombine" to get tetrahedra and change Mesh.Element order to go back to first-order elements. I still do not know how to generate hex20 with Gmsh...

I do not know where you got the functions from, but you can check with the ones in Code Aster:


Again, nice work! After you test it, change the function names and add your name to the copyright notice I will merge it into the main wasora branch.
--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.
To view this discussion on the web visit https://groups.google.com/a/seamplex.com/d/msgid/wasora/1912718201.6979895.1509281516682%40mail.yahoo.com.
For more options, visit https://groups.google.com/a/seamplex.com/d/optout.
hexa.geo
hexa.msh

César Pablo Camusso

unread,
Oct 30, 2017, 6:59:27 AM10/30/17
to was...@seamplex.com
I will try to finish it today and send a pull request.
I did not find the basis functions so I did the same as in 2d case. They can be wrong but I can compare with aster.
Thank you.


César Pablo Camusso

unread,
Oct 30, 2017, 4:05:39 PM10/30/17
to was...@seamplex.com
I have somethingh:
./wasora integral_over_hexhaedros.was
error: elements of type 'hexa27' are not supported in this version :-(

I think the message is written in:
src/mesh/gmsh.c:212:          wasora_push_error_message("elements of type '%s' are not supported in this version :-(", mesh->element[id].type->name);

I have not found the problem yet.






El Lunes, 30 de octubre, 2017 7:59:28, 'César Pablo Camusso' via wasora <was...@seamplex.com> escribió:


I will try to finish it today and send a pull request.
I did not find the basis functions so I did the same as in 2d case. They can be wrong but I can compare with aster.
Thank you.


--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.
mesh.zip

jeremy theler

unread,
Oct 30, 2017, 5:47:57 PM10/30/17
to was...@seamplex.com

there is a check that the element type id should be smaller than 15 now that I recall
to get to higher ids one would have to initialize to zero the rest of the element types


--
--
jeremy theler
www.seamplex.com

César Pablo Camusso

unread,
Oct 30, 2017, 7:20:28 PM10/30/17
to was...@seamplex.com
I found the check that the id must be lower or equal to 15 and incrased it to 17 (hexahedron20).
I realised that I forgot to add the new files to the makefiles and compilation system.
I found that you called the hexahedron.c mesh_six_node_hexahedron_init; but it has 8 nodes. Do I change the names?

I have to add also quad 9 nodes because the boundary elements of hexa27 are quad 9. Moreover id 10 appears in the msh file.
Now I have:
pablo@pablo:~/petsc/wasora-suite/wasora3dquad/examples$ ../wasora integral_over_hexhaedros.was
id=320  type->nodes=9 type=1403  (I added this debugging mesage)
error: elements of type '1403' are not supported in this version :-(

I will continue.
Thank you.


jeremy theler

unread,
Oct 30, 2017, 8:48:09 PM10/30/17
to was...@seamplex.com

this happens because the .msh parser reads a wrong number of node ids and treats one node id (1403) as the element type
check that you are reading the right number of  node ids by setting the appropriate number of nodes in the element type structure

check out the gmsh manual for more details of the elements that gmsh generates

about the function names, you are right they are probably wrong and should be named eight-node-*
I might have confused the number of nodes with the number of faces


César Pablo Camusso

unread,
Nov 3, 2017, 5:28:14 PM11/3/17
to was...@seamplex.com
Hello.
I have fixed several bugs. The main remark is that the aster node ordering is different from the gmsh node ordering.
I have added the example integral_over_hexhaedros.was which is not finished but matches the theory:
pablo@pablo:~/petsc/wasora-suite/wasora3dquad/examples$ ../wasora integral_over_hexhaedros.was
------------+----------------+------------+----------------   
 integrand        hex8            hex27        analytical     
------------+----------------+------------+----------------   
     1        1.000000    1.000000    1.000000
     x        0.500000    0.500000    0.500000
    y^2       0.335000    0.333333    0.333333
    z^3       0.252500    0.250000    0.250000
------------+----------------+------------+----------------

The question is:

Why paraview does not show anything when I open hex27.vtk?

Thank you.

jeremy theler

unread,
Nov 3, 2017, 6:05:30 PM11/3/17
to was...@seamplex.com
you did not update the array vtkfromgmsh_types[] in vtk.c so all the cell types are written as zero (search for CELL_TYPES in the output vtk)
also you will have to check again the node numbering, see line 134 in vtk.c



César Pablo Camusso

unread,
Nov 3, 2017, 7:48:56 PM11/3/17
to was...@seamplex.com
The node ordering of vtk is also different from the gmsh's one.
Furthermore, vtk does not have the hexahedron 27 element. So I will add hexahedron 20 and try to do the same with the gmsh's pos files.
Thank you.


César Pablo Camusso

unread,
Nov 3, 2017, 8:12:32 PM11/3/17
to was...@seamplex.com
Dear Germán,
The hexahedron 20 is built with this option:
Mesh.SecondOrderIncomplete = 1;


jeremy theler

unread,
Nov 3, 2017, 8:14:45 PM11/3/17
to was...@seamplex.com
On Fri, 2017-11-03 at 23:47 +0000, 'César Pablo Camusso' via wasora wrote:
The node ordering of vtk is also different from the gmsh's one.
Furthermore, vtk does not have the hexahedron 27 element. So I will add hexahedron 20 and try to do the same with the gmsh's pos files.
Thank you.


If VTK does not have hexa27, then I would set the element type to hexa20 and print only the data of the corners

César Pablo Camusso

unread,
Nov 3, 2017, 8:16:26 PM11/3/17
to was...@seamplex.com
I agree.
I am going to try your advise.


--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.

César Pablo Camusso

unread,
Nov 5, 2017, 10:30:20 AM11/5/17
to was...@seamplex.com
Dear Germán,
I think it is ready.
I could not follow your advice:

f VTK does not have hexa27, then I would set the element type to hexa20 and print only the data of the corners

because I had to change the number of POINTS and I would have to calculate them (substracting 7 in each hexhaedron 27 cell). So now If somebody tries to write a vtk file with hexahedron 27, wasora sends this error message:
error: Cell type ELEMENT_TYPE_HEXAHEDRON27 is not supported by vtk

The pos files worked directly without changing anything.

The remaining task is to test it in actual problems because the partial derivatives of the basis functions can be wrong.
Tell me if you want to do another test or I send the pull request.



jeremy theler

unread,
Nov 5, 2017, 12:44:41 PM11/5/17
to was...@seamplex.com

solve the diffusion equation over the cube with milonga and compare with the analytical solution

I did not understand why you could not write only some points of the vtk, I will take a look after merging your pull request


--
--
jeremy theler
www.seamplex.com

César Pablo Camusso

unread,
Nov 5, 2017, 1:35:16 PM11/5/17
to was...@seamplex.com
I think that the problem is in this line:
  fprintf(file, "POINTS %d double\n", mesh->n_nodes);
The hexahedron27 has more points than hexahedron 20. When paraview reads it, it sends an error.
Perhaps more testing is need.
In order to check it with actual problems, how do I ask git to use my version of wasora instead the one inside the milonga's directory?


Ramiro Vignolo

unread,
Nov 5, 2017, 1:41:38 PM11/5/17
to was...@seamplex.com
see autogen.sh in milonga repository:

if [ -e ../wasora/.git ]; then
  WASORA_REPO=../wasora/.git
else 
fi

rm -rf wasora
git clone ${WASORA_REPO} || exit 1

so, you can name your own wasora repository as wasora, change the name in autogen.sh or whatever you want.

Regards, 
Ramiro

César Pablo Camusso

unread,
Nov 5, 2017, 2:02:38 PM11/5/17
to was...@seamplex.com

jeremy theler

unread,
Nov 5, 2017, 6:42:09 PM11/5/17
to was...@seamplex.com

a. wrap that line in an if, if thr type is hex27 print 20 otherwise print nodes
b. put your version in the location where milonga looks for wasora


César Pablo Camusso

unread,
Nov 6, 2017, 5:17:14 PM11/6/17
to was...@seamplex.com
Dear Germán,
I programmed what I understood is your advice to show hexahedron 27 as if it were hexahedron 20 in paraview.
In iepale / wasora3dquad — Bitbucket, the last commit it is.
Wasora runs well but when I try to show hexa27.msh (adjointed) I get an error of paraview:
pablo@pablo:~/petsc/wasora-suite/wasora3dquad/examples$ paraview
[1]+  Violación de segmento  paraview
Violación de segmento

Otherwise you can get hexa27.vtk by running:
pablo@pablo:~/petsc/wasora-suite/wasora3dquad/examples$ ../wasora integral_over_hexhaedros.was

I did not follow the change of 27 by 20 in POINTS because the mesh has more than 9000 points.

Could you tell me how to follow?




hexa27.msh

César Pablo Camusso

unread,
Nov 6, 2017, 5:32:08 PM11/6/17
to was...@seamplex.com
The problem is not in POINTS. I read hex20.vtk and it has:
CELLS 1000 21000
So I changed CELLS 1000 28000 by CELLS 1000 21000 in hex27.vtk (adjointed) and it worked. I think I sould re count this number.



hex27.vtk

César Pablo Camusso

unread,
Nov 6, 2017, 5:34:20 PM11/6/17
to was...@seamplex.com
In this email:

Dear Germán,
I programmed what I understood is your advice to show hexahedron 27 as if it were hexahedron 20 in paraview.
In iepale / wasora3dquad — Bitbucket, the last commit it is.
Wasora runs well but when I try to show hexa27.msh (adjointed) I get an error of paraview:
pablo@pablo:~/petsc/wasora-suite/wasora3dquad/examples$ paraview
[1]+  Violación de segmento  paraview
Violación de segmento

Otherwise you can get hexa27.vtk by running:
pablo@pablo:~/petsc/wasora-suite/wasora3dquad/examples$ ../wasora integral_over_hexhaedros.was

I did not follow the change of 27 by 20 in POINTS because the mesh has more than 9000 points.

Could you tell me how to follow?
----------------------------------------------------------------------------
I confused hexa27.msh with hex27.vtk. Please, do not pay attention to it.


César Pablo Camusso

unread,
Nov 6, 2017, 5:46:42 PM11/6/17
to was...@seamplex.com
Now wasora recalculates the size and paraview shows hexahedron 27 as if it were hexahedron 20.
I pass to the tests in acutal problems.
Thank you.


jeremy theler

unread,
Nov 6, 2017, 6:10:05 PM11/6/17
to was...@seamplex.com

great!
now solve the diffusion equation over the cube with different element types


Jeremy Theler

unread,
Nov 7, 2017, 7:00:38 AM11/7/17
to was...@seamplex.com
whenever you are ready, make a pull request and I will merge the code

César Pablo Camusso

unread,
Nov 7, 2017, 12:05:52 PM11/7/17
to was...@seamplex.com
I could not buid the mesh with hexahedrons with a lot of options.
Should I use Extrude?
I adjointed the file which I am using with the last combination of options.


--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.
cube.geo

César Pablo Camusso

unread,
Nov 7, 2017, 1:18:57 PM11/7/17
to was...@seamplex.com
With Extrude (adjointed) I got hexahedron 27.
Next challenge:
pablo@pablo:~/petsc/wasora-suite/milonga/examples$ gdb --arg ./milonga 3dshape.mil cube --diffusion
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
.
.
.
(gdb) run
Starting program: /home/pablo/petsc/wasora-suite/milonga/examples/milonga 3dshape.mil cube --diffusion
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000434b8c in wasora_instruction_mesh ()
(gdb) where
#0  0x0000000000434b8c in wasora_instruction_mesh ()
#1  0x000000000044abb2 in wasora_step ()
#2  0x000000000044af68 in wasora_standard_run ()
#3  0x0000000000410507 in main ()

Going deeper I found:
Breakpoint 2, wasora_instruction_mesh (arg=0x6cc480) at ../wasora/src/mesh/mesh.c:184
184            for (v = 0; v < element->type->gauss[GAUSS_POINTS_CANONICAL].V; v++) {
(gdb) p element->type.id
$5 = 0
(gdb) c
Continuing.

Do you have any clue?

Could it be that the external surface has quads9, which are not supported by wasora (quad.c)?



cube.geo

Jeremy Theler

unread,
Nov 7, 2017, 2:01:44 PM11/7/17
to was...@seamplex.com
Going deeper I found:
Breakpoint 2, wasora_instruction_mesh (arg=0x6cc480) at ../wasora/src/mesh/mesh.c:184
184            for (v = 0; v < element->type->gauss[GAUSS_POINTS_CANONICAL].V; v++) {
(gdb) p element->type.id
$5 = 0
(gdb) c
Continuing.

Do you have any clue?


I bet element->type->gauss points to NULL


Could it be that the external surface has quads9, which are not supported by wasora (quad.c)?

Of course, they should be added but nevertheless the parser should have complained.

Now, once you figured that out, I have another challenge that might be useful for other milonga users. Use this geo file to get a "R-theta"-like cylinder as the attached image shows. This mesh has prisms also and the neighboring-search algorithm fails. So the challenge is both for elements (i.e. allowing second-order elements) and volumes (generalizing the search for neighbors). Anyone interested?

SetFactory("OpenCASCADE");

a = 10;
n = 10;
Mesh.CharacteristicLengthMin = a/n;
Mesh.CharacteristicLengthMax = a/n;

Rectangle (1) = {0, -a, 0, a, 2*a};
Extrude{ {0,1,0}, {0,0,0}, Pi }{ Surface{1}; Layers{2*n}; Recombine; }
Extrude{ {0,-1,0}, {0,0,0}, Pi }{ Surface{1}; Layers{2*n}; Recombine; }
Coherence;

Mesh.RecombineAll = 1;
Mesh.Algorithm = 8;

Physical Surface("external") = {4, 8, 7, 3, 2, 6};
Physical Volume("fuel") = {1, 2};



cylinder-axisymmetric.png

César Pablo Camusso

unread,
Nov 7, 2017, 2:20:21 PM11/7/17
to was...@seamplex.com
I propose:
1- Check why the parser did not complain if the quad9 is not supported. I did not check the parser (in wasora and mesh because there are two parser.c), so I can do it.
2- Add all the cell types needed and check it in some way.
3- Try to solve the cylinder in finite elements.
3-a-Diffusion.
3-b-Transport.

I still have not used finite volumes. So I prefer to left the cylinder, FVM, diffusion-transport for the future.



--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.

César Pablo Camusso

unread,
Nov 7, 2017, 5:18:46 PM11/7/17
to was...@seamplex.com
I think the parser did not catch the mistake because in element.c you had:
   wasora_mesh.element_type[10].name = strdup("quad9");
  wasora_mesh.element_type[10].nodes = 9;

Now I removed the line:
wasora_mesh.element_type[10].nodes = 9;

So, in this block of gmsh.c:
mesh->element[id].type = &(wasora_mesh.element_type[type]);
if (mesh->element[id].type->nodes == 0) {

wasora_push_error_message("elements of type '%s' are not supported in this version :-(", mesh->element[id].type->name);
          return WASORA_RUNTIME_ERROR;
}

The if (mesh->element[id].type->nodes == 0) was not true because
mesh->element[id].type->nodes
was 9.

Test:
milonga/examples$ ./milonga 3dshape.mil cube --diffusion
error: elements of type 'quad9' are not supported in this version :-(


Is it right? Why did you write that line?



El Martes, 7 de noviembre, 2017 16:01:45, Jeremy Theler <jer...@seamplex.com> escribió:


--
You received this message because you are subscribed to the Google Groups "wasora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wasora+un...@seamplex.com.
To post to this group, send email to was...@seamplex.com.
Visit this group at https://groups.google.com/a/seamplex.com/group/wasora/.

César Pablo Camusso

unread,
Nov 10, 2017, 4:17:26 PM11/10/17
to was...@seamplex.com
Dear partners,

I am trying to plot in paraview an hexahedron 27 as if it were an hexahedron 20 by writing directly the values of the basis functions of hexahedron 27 which match the hexahedron 20; but I do not obtain the same pictures in all the cases.

So I thougth that if I want to graph the basis function which is not zero in the central node of an hexahedron 27, (1-x*x)*(1-y*y)*(1-z*z), as an hexahedron 20 in the way that I am doing, the hexahedron 20 picture would be zero because the basis function in the central node is zero in all the others nodes and then the two pictures are very different. Therefore what I have been doing is wrong.

Is it right?

Thank you.


Jeremy Theler

unread,
Nov 13, 2017, 4:34:28 PM11/13/17
to was...@seamplex.com
I did not understand what you were trying to do. Neither your question.
Why (and where and how) do you write the values of the basis functions (do you mean shape functions?)?
By "where" I mean both where do you want to write the values to (stdout? a vtk file?) and where do you want to evaluate them?


Can you ellaborate? Include some pictures if you can.

César Pablo Camusso

unread,
Nov 14, 2017, 6:00:39 AM11/14/17
to was...@seamplex.com
It dos not matter because I found that vtk 5 supports the hexahedron 27.


Reply all
Reply to author
Forward
0 new messages