- Thank you received: 0
Two domain mesh
7 years 2 weeks ago - 7 years 2 weeks ago #241
by Karatza
Two domain mesh was created by Karatza
Hi, after following the tutorial instructions and executing
I had no error, but when I am trying to Draw it with Draw(mesh1), I see the error
File "<string>", line 13
Draw(mesh1)
^
IndentationError: unexpected indent
similar error if I try another example using mesh.Points():
I see
File "<string>", line 22
for el in mesh.Elemends2D():
^
IndentationError: unexpected indent
I checked if the appropriate libraries are imported and I can not find the mistake. Could help me please? Do I miss something?
best wishes
Makis
Code:
mesh1=mesh.Materials("outer|inner")-mesh.Materials("inner")
File "<string>", line 13
Draw(mesh1)
^
IndentationError: unexpected indent
similar error if I try another example using mesh.Points():
Code:
for p in mesh.Points():
x,y,z =p.p
print ("x= ", x, "y= ", y)
for el in mesh.Elemends2D():
print (el.vertices)
File "<string>", line 22
for el in mesh.Elemends2D():
^
IndentationError: unexpected indent
I checked if the appropriate libraries are imported and I can not find the mistake. Could help me please? Do I miss something?
best wishes
Makis
Attachments:
Last edit: 7 years 2 weeks ago by Karatza. Reason: better performance
7 years 2 weeks ago #246
by cwinters
Replied by cwinters on topic 2 mesh's substraction, bc, distance from NEG and real boundary \Gamma (lset=0)
Hi Makis,
regarding your first question (I'm not working on ngsxfem):
You have to be aware of the type of your python object!
Let's say we have the mesh with two domains (as in the tutorial you linked, full code is attached). If you want to work with material/domains of you mesh, you have the use the NGSolve mesh. You can check the type with:
and the output is
Also use the python help function to find out which functions and members are available for your python object. This can be done by
If you want to use one of your subdomains, you can use the "Material(...)" function. But this function does not return a mesh! It returns a "Region", which can be used the define a finite element space on a subdomain. Again
tells you the type of the object and python help shows details about this object.
For the second part of your first question you have to use the Netgen mesh. This is available as member of the NGSolve mesh.
returns
If you now check the help of "mesh.ngmesh" you see the functions to get the points and elements you wanted to use.
Best regards,
Christoph
regarding your first question (I'm not working on ngsxfem):
You have to be aware of the type of your python object!
Code:
...
mesh = Mesh(geo.GenerateMesh(maxh=0.5))
Code:
type(mesh)
Code:
<class 'ngsolve.comp.Mesh'>
Code:
help(mesh)
If you want to use one of your subdomains, you can use the "Material(...)" function. But this function does not return a mesh! It returns a "Region", which can be used the define a finite element space on a subdomain. Again
Code:
type(mesh.Materials('inner'))
For the second part of your first question you have to use the Netgen mesh. This is available as member of the NGSolve mesh.
Code:
type(mesh.ngmesh)
Code:
<class 'netgen.libngpy._meshing.Mesh'>
Code:
for p in mesh.ngmesh.Points():
x,y,z =p.p
print ("x= ", x, "y= ", y)
for el in mesh.ngmesh.Elements2D():
print (el.vertices)
Best regards,
Christoph
Attachments:
The following user(s) said Thank You: Karatza
7 years 2 weeks ago - 7 years 2 weeks ago #248
by Karatza
Replied by Karatza on topic 2 mesh's substraction
Dear Christoph,
thank you for the detailed instructions!
with Kindest Regards
Makis
thank you for the detailed instructions!
with Kindest Regards
Makis
Last edit: 7 years 2 weeks ago by Karatza.
Time to create page: 0.099 seconds