Hello everyone,
I’m trying to solve linear elasticity problem. I managed to solve a problem when a box is under pressure from top, but how I also want to add another force which is applied to a specific area (point) to the left-top edge of the box
Here I have 3 conditions of finding bot facets, top facets and point facets
V = dolfinx.fem.VectorFunctionSpace(msh, ("CG", 1)) # displacement function space
# --------- Boundary Conditions --------- #
def bot(x):
return np.isclose(x[2], 0.0, atol = 0.0006) # def of which points will be included in bc at bottom surface
def top(x):
return np.isclose(x[2], height, atol=0.001)
def point(x):
return np.logical_and(np.logical_and(np.isclose(x[0], length, atol = 0.0001), np.isclose(x[1], width / 2 + 0.0003, atol = 0.0006)), np.isclose(x[2], height, atol = 0.0006)) # def on which points additional force will be applied
bot_facets = np.sort(dolfinx.mesh.locate_entities_boundary(msh, 0, bot))
bdofs = dolfinx.fem.locate_dofs_topological(V, 0, bot_facets)
top_facets = np.sort(dolfinx.mesh.locate_entities_boundary(msh, 2, top))
mt = dolfinx.mesh.meshtags(msh, 2, top_facets, 1)
p_facets = np.sort(dolfinx.mesh.locate_entities_boundary(msh, 2, point))
pdofs = dolfinx.fem.locate_dofs_topological(V, 0, p_facets)
pt = dolfinx.mesh.meshtags(msh, 0, top_facets, 3)
bc_bot = dolfinx.fem.dirichletbc(dolfinx.fem.function.Constant(msh, (0.0, 0.0, 0.0)), bdofs, V) # fixed bottom
Here is my problem definition
from dolfinx.fem.petsc import LinearProblem
from dolfinx.fem.function import Function as _Function
from petsc4py import PETSc
# Body force = mass
grav = 9.8# [N/kg] gravitational force
b = dolfinx.fem.function.Constant(msh, (0.0, 0.0, -rho*grav))
f_mag = 3e5
# pressure
f = dolfinx.fem.function.Constant(msh,(0.0, 0.0, -f_mag))
# additional force
fp = dolfinx.fem.function.Constant(msh,(0.0, 0.0, -1e4))
# --------- Vector Function Space Definition --------- #
# a function space is created from mesh for the displacements to be canculated
u_tr = ufl.TrialFunction(V)
u_test = ufl.TestFunction(V)
ds = ufl.Measure('ds', domain=msh, subdomain_data=mt)
# --------- Stress and Strain Equations --------- #
# Strain function
def epsilon(u):
return ufl.sym(ufl.grad(u))
# Stress function
def sigma(u):
return lambda_*ufl.div(u)*ufl.Identity(3) + 2*mu*epsilon(u)
# --------- Weak Formulation of the Problem --------- #
a = ufl.inner(sigma(u_tr), epsilon(u_test))*ufl.dx(domain=msh)
# !!! how to add fp = dolfinx.fem.function.Constant(msh,(0.0, 0.0, -1e4)) applied on point here
l = ufl.dot(b, u_test) * ufl.dx(domain=msh) + ufl.dot(f, u_test) * ds(1)
# --------- Solver --------- #
petsc_options={}
problem = LinearProblem(a, l, bcs=[bc_bot], petsc_options = petsc_options)
u = problem.solve()
so I added measures dx of entire box and apply self box mass, ds for top facets and apply pressure but have how idea how to add desired point force
I tried “dP” meause but ended up with Attrubute error “vertex”
Thanks in advance