- Thank you received: 0
Loss of boundary conditions
3 years 9 months ago - 3 years 9 months ago #3517
by LilBeng
Loss of boundary conditions was created by LilBeng
Loss of boundary conditions when the grid is dumped or loaded. Is there any way to deal with this?
Example:
Output:
NETGEN-6.2.2009-83-g5e489319
NGSolve-6.2.2101
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
Attachments:
Last edit: 3 years 9 months ago by LilBeng.
Time to create page: 0.099 seconds