Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Loss of boundary conditions

More
3 years 2 months ago - 3 years 2 months ago #3517 by LilBeng

File Attachment:

File Name: test.vol
File Size:12 KB
Loss of boundary conditions when the grid is dumped or loaded. Is there any way to deal with this?
Example:
Code:
from ngsolve.comp import Mesh from netgen.geom2d import unit_square from netgen.meshing import Mesh as M unit_square.AppendPoint(0.5, 0.5, name='point1', maxh=0.03) unit_square.AppendPoint(0.3, 0.1, name='point2', maxh=0.03) unit_square.SetMaterial(1, 'material') mesh = Mesh(unit_square.GenerateMesh(maxh=0.5)) print('\n Original') print('<B>:', mesh.GetBoundaries()) print('<BB>:', mesh.GetBBoundaries()) print('<BBB>:', mesh.GetBBBoundaries()) print('<M>', mesh.GetMaterials()) print('\n') # ------------------------------------------------------ import pickle dump = pickle.dumps(mesh) load = pickle.loads(dump) print('\n Pickle') print('<B>:', load.GetBoundaries()) print('<BB>:', load.GetBBoundaries()) print('<BBB>:', load.GetBBBoundaries()) print('<M>', load.GetMaterials()) print('\n') # ------------------------------------------------------ ngm = mesh.ngmesh.Save('test.vol') input('Press Enter ...') ngmObj = M() ngmObj.Load('test.vol') ngs = Mesh(ngmObj) print('\n Save/Load') print('<B>:', ngs.GetBoundaries()) print('<BB>:', ngs.GetBBoundaries()) print('<BBB>:', ngs.GetBBBoundaries()) print('<M>', ngs.GetMaterials()) print('\n')

Output:
Code:
Original <B>: ('bottom', 'right', 'top', 'left') <BB>: ('point1', 'point2') <BBB>: () <M> ('material',) Update mesh topology Update clusters Pickle <B>: ('bottom', 'right', 'top', 'left') <BB>: () <BBB>: () <M> ('material',) Press Enter ... 138 surface elements Traceback (most recent call last): 0 volume elements File "E:/PycharmProjects/united_modules_pyqt-ui/src/ru/nano/sgu/test.py", line 40, in <module> 22 curve elements ngmObj.Load('test.vol') 83 points netgen.libngpy._meshing.NgException: co dim 2 elements not implemented for dimension 2 83 points done 2 pointelements 2 pointelements done

NETGEN-6.2.2009-83-g5e489319
NGSolve-6.2.2101

File Attachment:

File Name: test.vol
File Size:12 KB
Attachments:
Last edit: 3 years 2 months ago by LilBeng.
Time to create page: 0.109 seconds