Trying to get the points that lie only on the boundary surface of a solidBody #331
Replies: 4 comments 8 replies
-
I have taked a look at the |
Beta Was this translation helpful? Give feedback.
-
Thanks for investigating into that. If I remember correctly, I fixed something concerning the boundary regions. Please, could you have a look which version you are using? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I give it a try and I have sth beautiful, it needs an enhancement in case if it will be helpful, there is a devil for-loop there, this is a part of the code:
|
Beta Was this translation helpful? Give feedback.
-
The solution is: A Scriptimport felupe as fem
import numpy as np
import matplotlib.pylab as plt
import matplotlib as mpl
mpl.rcParams['pgf.texsystem'] = 'pdflatex'
mpl.rcParams.update({'font.family': 'cambria', 'font.size': 13,
'axes.labelsize': 15,'axes.titlesize': 15, 'figure.titlesize' : 15})
#Defining meshes
m1 = fem.Rectangle(a=(0,0), b=(10,10), n=10)
m2 = fem.Rectangle(a=(2.5,10), b=(7.5,15), n=5)
#Defining regions
r1 = fem.RegionQuad(m1)
r2 = fem.RegionQuad(m2)
#Defining regions boundaries
rb1 = fem.RegionQuadBoundary(m1, only_surface=True)
rb2 = fem.RegionQuadBoundary(m2, only_surface=True)
#Defining fields
f1 = fem.FieldsMixed(r1, n=1)
f2 = fem.FieldsMixed(r2, n=1)
#Defining materials
mat1 = fem.NeoHooke(mu=1, bulk=1)
mat2 = fem.LinearElastic(E=206000, nu=0.3)
#Defining solidbodies
s1 = fem.SolidBody(mat1, f1)
s2 = fem.SolidBody(mat2, f2)
#Defining masses
g1 = fem.SolidBodyGravity(s1.field, [9810, 0, 0], 1.522e-9)
g2 = fem.SolidBodyGravity(s2.field, [9810, 0, 0], 7.85e-9)
#Getting points from regions boundaries rb1 and rb2
points1 = rb1.mesh.points[np.isin(np.arange(rb1.mesh.npoints), rb1.mesh.cells_faces)]
points2 = rb2.mesh.points[np.isin(np.arange(rb2.mesh.npoints), rb2.mesh.cells_faces)]
#Plotting regions boundaries
plt.title('Regions Boundaries')
plt.xlabel(r'x$\longrightarrow$')
plt.ylabel(r'y$\longrightarrow$')
plt.scatter(points1[...,0], points1[...,1], c='r', label=r'rb1')
plt.scatter(points2[...,0], points2[...,1], c='b', label=r'rb2')
plt.legend()
plt.tight_layout() A FYI, the boundary mesh looks like this: fem.mesh.concatenate([rb1.mesh, rb2.mesh]).save("mesh_cells.vtk") You may construct the 2d-edge-mesh with line-elements by yourself: fem.mesh.concatenate([
fem.Mesh(rb1.mesh.points, rb1.mesh.cells_faces, "line"),
fem.Mesh(rb2.mesh.points, rb2.mesh.cells_faces, "line"),
]).save("mesh_faces.vtk") As an idea for the future: The last one could be worth to be implemented as a method of Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Hello Mr. Andreas, I were going to calculate the distance (let's say the minimal gap) between two solidbodies (s1 and s2) (I'm trying to get points where a contact/collision can happen). So, I choosed to use the points of two boundaries regions with an activated
only_surface
flag, but there was sth that stopped me and it's that the points of those regions look like they are not only on the surface!!! Is there sth wrong in the definition of the boundaries regions?The code:
The plot:
Beta Was this translation helpful? Give feedback.
All reactions