defining top and bottom looks straight forward as below:
def bottom_bc(x, on_boundary):
tol = 1E-12
return on_boundary and abs(x[2]) < tol
def top_bc(x, on_boundary):
tol = 1E-12
return on_boundary and abs(x[2] - z1) < tol
But I am a bit confused about how can I define sides?
On another note, i tend to recommend using external meshing software such as Gmsh (pygmsh) to do complex geometries. Then you can use meshio to convert the meshing files to XDMF and load them into dolfin. Then you Get a more robust domain marking strategy. There are several threads in the forum describing this procedure.
the amount of load is constant and I am defining by:
tr = Expression(("0.0", "0.0", "-rho*g"), rho = rho, g = g, degree = 2 + k)
#which is the orange wheel's weight
and I am trying to mark part of red strip while my dynamic load moving forward and backward on top_boundary as below:
A = 0.115 # the amplitude
omega = 2.618 # the frequency
g = Expression('A*sin(omega*t)', A = A,
omega = omega, t = 0.0, degree = 2)
class strip(SubDomain):
def inside(self, x, on_boundary):
tol = 1E-12 # tolerance for coordinate comparisons
return on_boundary and abs(x[2] - z1) < tol and abs(x[1] - 0.051505) > tol and abs(x[1] - 0.098495) < tol and \
abs(x[0] - g) > tol and abs(x[0] - 1.1*g) < tol
Gamma_T = strip()
Gamma_T.mark(boundary_parts, 1)
So my marking should get update while time passes and compute integral of different parts of the red strip.
But I think the way I am doing this does not make sense, so could you please give me a hint how can I update the place of my loading (orange wheel) while time passing ? (load magnitude is constant)
I was thinking to instead of defining red strip define my loading tr as a user-defined JIT-compiled Expression and then do integration on top boundary instead but I am so confused that how can write ‘cppcode’ for this problem.
I have a similar problem, except my mesh is loaded from an external file. Therefor, I don’t know the geometric shape. I want to set a facet marker for the intersection of cut_mesh which overlaps mesh
vtk_fullpath = "sph_coarse_hollow0001.xdmf"
mesh = Mesh()
with XDMFFile(vtk_fullpath) as infile:
infile.read(mesh)
vtk_fullpath = "sph_coarse_hollow0001_incube.xdmf"
cut_mesh = Mesh()
with XDMFFile(vtk_fullpath) as infile:
infile.read(cut_mesh)
boundary_subdomains = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
boundary_subdomains.set_all(0)
class SetBound(SubDomain):
def inside(self, x, on_boundary):
return on_boundary
set_bound = SetBound()
set_bound.mark(boundary_subdomains, 3)