- Thank you received: 0
Can not change Mesh size.
5 years 3 months ago #1733
by OCCUser
Can not change Mesh size. was created by OCCUser
Hello,
I load my geometry using LoadOCCGeometry and when I am trying to mesh it I have the same number of elements for different values of maxh parameter.
Output: 17 elements were created
Output: 17 elements were created
Tried with segments meshing - > 17 elements were created.
Do you have experience with this? Is it a bug of python interface?
Thanks
I load my geometry using LoadOCCGeometry and when I am trying to mesh it I have the same number of elements for different values of maxh parameter.
Code:
from netgen.NgOCC import *
geo = LoadOCCGeometry("brick.step")
mp = MeshingParameters(maxh=1, grading=0.3)
ngmesh = geo.GenerateMesh(mp=mp)
Code:
from netgen.NgOCC import *
geo = LoadOCCGeometry("brick.step")
mp = MeshingParameters(maxh=0.1, grading=0.3)
ngmesh = geo.GenerateMesh(mp=mp)
Code:
ngmesh = geo.GenerateMesh(maxh=0.1, segmentsperedge=20)
Do you have experience with this? Is it a bug of python interface?
Thanks
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 3 months ago #1744
by christopher
Replied by christopher on topic Can not change Mesh size.
Hi,
you are right, the meshing parameters from Python were ignored for the occ geometry. This is fixed in the upcoming nightly release. We have included some further changes/improvements/syntactic sugar:
The occ module should now be included using netgen.occ, geometries constructed by the constructor taking the filename as argument.
This constructor now understands .brep, .iges, .step and .stp files.
One can now use meshing parameters as given in the gui, by the helper variable meshsize:
you can give additional meshsize parameters as kwargs as well:
There is a docstring about available meshing and optimization parameters if you query GenerateMesh for its help:
Hope that helps and let us know if you run into problems.
Best
Christopher
you are right, the meshing parameters from Python were ignored for the occ geometry. This is fixed in the upcoming nightly release. We have included some further changes/improvements/syntactic sugar:
The occ module should now be included using netgen.occ, geometries constructed by the constructor taking the filename as argument.
Code:
from netgen.occ import *
geo = OCCGeometry("brick.step")
One can now use meshing parameters as given in the gui, by the helper variable meshsize:
Code:
geo.GenerateMesh(meshsize.very_fine)
Code:
geo.GenerateMesh(meshsize.coarse, maxh=0.2)
Code:
help(geo.GenerateMesh)
Hope that helps and let us know if you run into problems.
Best
Christopher
The following user(s) said Thank You: OCCUser
5 years 3 months ago #1761
by OCCUser
Replied by OCCUser on topic Can not change Mesh size.
Thanks a lot, now it works good
Could you, please, tell me if netgen has MPI support. Can I create mesh in parallel?
Could you, please, tell me if netgen has MPI support. Can I create mesh in parallel?
5 years 3 months ago #1762
by joachim
Replied by joachim on topic Can not change Mesh size.
Hi,
no, you cannot generate a mesh mpi-parallel. But you can distribute a mesh for parallel computations, and also refine a mesh in parallel.
Here is a simple example for that::
Joachim
no, you cannot generate a mesh mpi-parallel. But you can distribute a mesh for parallel computations, and also refine a mesh in parallel.
Here is a simple example for that::
Code:
from ngsolve import *
from netgen.csg import unit_cube
import netgen.meshing
if mpi_world.rank == 0:
ngmesh = unit_cube.GenerateMesh(maxh=0.2).Distribute(mpi_world)
else:
ngmesh = netgen.meshing.Mesh.Receive(mpi_world)
for l in range(2):
ngmesh.Refine()
mesh = Mesh(ngmesh)
fes = H1(mesh, order=3)
print ("ndof-local =", fes.ndof, "ndof-global =", fes.ndofglobal)
Joachim
5 years 3 months ago - 5 years 3 months ago #1784
by OCCUser
Replied by OCCUser on topic Can not change Mesh size.
Hello joachim,
Could you please tell me if RestrictH() method works with occ geometries?
I try to run the code like this(Cube properties 10x10x10, starting point (0,0,0) ):
But it does not mesh my edge. When I use CS Geometry it works good.
Could you please help me?
Thanks
Could you please tell me if RestrictH() method works with occ geometries?
I try to run the code like this(Cube properties 10x10x10, starting point (0,0,0) ):
Code:
from netgen.occ import *
from netgen.meshing import MeshingParameters
mp = MeshingParameters()
n = 100
for i in range(n+1):
loc_h = 10/n
mp.RestrictH(x=0,y=i*loc_h,z=0,h=loc_h)
geo = OCCGeometry("cube.step")
mesh = geo.GenerateMesh(mp=mp)
mesh.Export("output.msh", "Gmsh2 Format")
But it does not mesh my edge. When I use CS Geometry it works good.
Could you please help me?
Thanks
Last edit: 5 years 3 months ago by OCCUser.
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
5 years 2 months ago - 5 years 2 months ago #1818
by christopher
Replied by christopher on topic Can not change Mesh size.
Fixed in
github.com/NGSolve/netgen/commit/13c17ad...768f001776390b343fa8
Will be in coming nightly release
Thanks for reporting
Best
Christopher
Will be in coming nightly release
Thanks for reporting
Best
Christopher
Last edit: 5 years 2 months ago by christopher.
Time to create page: 0.129 seconds