I would like to know if there is a way to link kinetically multiple faces of an assembly, for example apply the displacement of a face X (or group of nodes), on which a load is applied, on a different face Y so it follows the same displacement as face X.
Thank you Christopher for your reply. To make my question clearer here is a presentation of the problem I am treating. I would love to make faces 4 and 11 follow the same displacement under loads and boundary conditions applied on other faces, as if they were linked. I tried gfu.set but it doesn’t seem to work well with this configuration. As I am not familiar with periodic fespace wrapper, I couldn’t see how it must be done in my script.
this should be possible by just giving them the same names and then applying the same bc or not? If you can send a minimal example of your code and what you want to do it might be easier
The two faces belong to two different pieces of an assembly, which are two rectangular parallelepiped with holes in both of them that should represent the rigid link through a screw. Here is an example of my code:
from netgen.occ import *
from ngsolve import *
import math
# Variable
E = 212000
nu = 0.3
Rho = 7849e-9
# Displacement boundary
FaceDisplacement = 'Face5'
# Degree of Element
EleDeg = 3
shp_path = "TestVisM8.stp"
geometry = OCCGeometry(shp_path)
mesh = Mesh(geometry.GenerateMesh(maxh=10)).Curve(3)
#FaceDisplacement = geometry.shape.faces.Max(Z).name
# FE Space ---------------------------------------------------------------------------------
fes = VectorH1(mesh, order=EleDeg, dirichlet = 'Face10')
u, v = fes.TnT()
gfu = GridFunction(fes)
# Stress Function ----------------------------------------------------------------------------
mu = E / 2 / (1 + nu)
lam = E * nu / ((1 + nu) * (1 - 2 * nu))
def Stress(strain):
return 2 * mu * strain + lam * Trace(strain) * Id(3)
# Assemble a ----------------------------------------------------------------------------
with TaskManager():
a = BilinearForm(InnerProduct(Stress(Sym(Grad(u))), Sym(Grad(v))).Compile()*dx)
pre = Preconditioner(a, "bddc")
a.Assemble()
# Create zero force as there is no force applied -------------------------------------------
domain= mesh.Boundaries(FaceDisplacement)
area = Integrate(1, domain)
Load = 10000/area
force = CF((0, 0, Load))
f = LinearForm(fes)
f += force * v * ds(FaceDisplacement)
f.Assemble()
# Run the Solver --------------------------------------------------------------------------
from ngsolve.krylovspace import CGSolver
inv = CGSolver(a.mat, pre, printrates='\r', tol=1e-6, maxiter=500)
gfu.vec.data = inv * f.vec