High order mesh interface

More
6 years 11 months ago - 6 years 11 months ago #298 by armandyam
Hello,

I had a question regard the high order meshes. In an earlier version of netgen(5.0) there is an option for element order which, from what I understand, generates curved elements by using the selected order of splines from the geometry. I am assuming this generates curved edges at the boundary and not the interior.

I intend to make high order edges in the interior as well and I want to explicitly move the edge centres. So, I went ahead with another option called 'Second order elements' in meshing options. This gives me control over the mid point of the edges. (as of now I am working only with 2D grids with triangles only)

Now, despite explicitly moving the mid point of the node to curve the edge the boolean IsElementCurved returns 0. My question was, how exactly to use the second order elements to interface into my solver. Are there special parameters to be passed to get the correct element transformations?

I have attached two images one for a linear mesh with 2 triangles and another a second order mesh with the mid point of the shared edge slightly moved. [attachment=undefined]curved.png[/attachment] [attachment=undefined]linear.png[/attachment]
Last edit: 6 years 11 months ago by armandyam. Reason: Attachment did not seem to work correctly.
More
6 years 10 months ago - 6 years 10 months ago #311 by christopher
Hi,
maybe you have to additionally call element.SetCurved(true)? But this should actually be set if you use the right element types. To use second order elements you need the types SEGMENT3, TRIG6, TET10,...
Curved elements are still part of Netgen/NGSolve, but they are usually used for approximating curved geometries and not in the interior, so I'm not a 100% sure that what you want works right now, only about 70% ;) Could you upload a small example to see what you already got?
I increased the upload size for images, maybe that was the reason why you couldn't upload the images.

Best
Christopher
Last edit: 6 years 10 months ago by christopher.
More
6 years 10 months ago #332 by armandyam
Replied by armandyam on topic High order mesh interface
Hi Christopher,

Sorry for my delayed reply!

I am attaching two images of what exactly I am trying to do. It is a simple two cell square domain. I have a straight edge in one while in the other I have a second order mesh where I have moved the mid point of the edge.

I have attached a pdf with the image of the two meshes.

Best regards

Ajay

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:
More
6 years 9 months ago #335 by christopher
I've exported curved trigs to python with commit github.com/NGSolve/netgen/commit/9384078...f2e498918d2e3a612303
so after updating to the most recent version (easiest way would be to use the nightly version tomorrow or so) creating a mesh like that should be possible from Python like this:
Code:
from netgen.meshing import * mesh = Mesh(2) pnts1 = [mesh.Add(MeshPoint(0,0))), mesh.Add(MeshPoint(Pnt(0.5,0))), mesh.Add(MeshPoint(Pnt(1,0))), mesh.Add(MeshPoint(Pnt(1,0.5))), mesh.Add(MeshPoint(Pnt(1,1))), mesh.Add(MeshPoint(Pnt(0.7,0.3)))] pnts2 = [pnts1[0], pnts1[5], pnts1[4], mesh.Add(MeshPoint(Pnt(0.5,1))), mesh.Add(MeshPoint(Pnt(0,1))), mesh.Add(MeshPoint(Pnt(0,0.5)))] el1 = Element2D(index=1,vertices = pnts1) el2 = Element2d(index=1,vertices = pnts2) mesh.Add(el1) mesh.Add(el2) from ngsolve import * Draw(Mesh(mesh))

So if its not a too big mesh then I'd suggest to use a Python script to switch all the elements you want to curve to second order ones.

Best
Christopher
Time to create page: 0.101 seconds