External mesh via .vtk file #936
Replies: 1 comment
-
|
Hi @divyeshkmodi, you have to create a region on a mesh of a mesh container, not on the mesh container directly. Do you need multiple materials (one for the matrix, one for the circle inside) for your simulation? If so, you must provide two separate vtk-files or split the meshes after importing the vtk-file. Please describe what you want to do and ideally provide the vtk-file(s). I'll try to help you! import felupe as fem
mesh_container = fem.mesh.read("test.vtk", dim=2) # read the vtk-file
mesh = mesh_container[0] # take the first mesh of the mesh-container
region = fem.RegionTriangle(mesh)A full example with two materials could look like this...import felupe as fem
r = fem.Rectangle(n=(3, 3))
m = fem.MeshContainer([r.translate(1, 0), r.translate(-1, 0)], merge=True).stack()
m = fem.MeshContainer([m, m.translate(1, 1), m.translate(-1, 1)], merge=True).stack()
m = fem.MeshContainer([m, r.translate(1, 1), r.translate(-1, 1)], merge=True).stack()
container = fem.MeshContainer([r, m], merge=True)
ax = container.imshow(colors=[None, "white"])
mesh = container.stack()
region = fem.RegionQuad(mesh)
field = fem.FieldContainer([fem.FieldPlaneStrain(region, dim=2)])
regions = [
fem.RegionQuad(container.meshes[0]),
fem.RegionQuad(container.meshes[1]),
]
fields = [
fem.FieldContainer([fem.FieldPlaneStrain(regions[0], dim=2)]),
fem.FieldContainer([fem.FieldPlaneStrain(regions[1], dim=2)]),
]
boundaries, loadcase = fem.dof.uniaxial(field, clamped=True, sym=False)
umats = [
fem.LinearElasticLargeStrain(E=2.1e5, nu=0.3),
fem.NeoHooke(mu=1, bulk=2),
]
solids = [
fem.SolidBody(umat=umats[0], field=fields[0]),
fem.SolidBody(umat=umats[1], field=fields[1]),
]
move = fem.math.linsteps([0, 1], num=5)
ramp = {boundaries["move"]: move}
step = fem.Step(items=solids, ramp=ramp, boundaries=boundaries)
job = fem.Job(steps=[step])
job.evaluate(x0=field)
plotter = solids[0].plot(show_undeformed=False, style="wireframe")
solids[1].plot(
"Principal Values of Cauchy Stress",
component=0,
label="Matrix - Cauchy Stress (Max. Principal)",
plotter=plotter,
show_undeformed=False
).show()For P.S.: Thank you for providing the error message. I enhanced it to be more descriptive in #939. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hello,

I am trying to load an external mesh which I created since I wanted a tria-unstructured mesh (the mesh is coarse for testing purposes). It is a square matrix with a circular inclusion in it (as shown below).
I could load the mesh but I do not understand what region I should select.
It gives me the following error: n
Is it because of the wrong selection of 'Region'?
Also do I need to specify element and quadrature in this case?
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions