Is it possible to impose more than a Periodic Boundary condition?

13 days ago by

I'm try to solve a problem of nonlinear elasticity. It is an hollow cylinder to which I impose a finite torsion on the top basis. To solve it I use two periodic boundary conditions:
1) I use a BoxMesh and so I have to impose its closure, hence the face x[1] has to be periodic.
2) the displacement u_r and u_z on the top and on the bottom feces has to be periodic.

So, I find an example on internet, such as
However, I have some questions:
1) Why do you need to map also the side of the x[0] and x[2] and not only the corresponding faces?
2) I try to implement the vectorial poisson problem in 2D. the code is this one
from fenics import *
class PeriodicBoundary(SubDomain):

	def inside(self,x,on_boundary):
		return bool((x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS) or (x[1] < DOLFIN_EPS and x[1] > -DOLFIN_EPS) and on_boundary)

	def map(self, x, y):
		TOL = 0.001
		if near(x[0],0,TOL):
			y[0] = x[0] - 1.0
			y[1] = x[1] - 1.0
 		elif near(x[1],0,TOL):
			y[0] = x[0] - 1.0
			y[1] = x[1] - 1.0
			y[0] = x[0]
			y[1] = x[1]

#Construction of the space
mesh = UnitSquareMesh(10,10)
Velem = VectorElement("Lagrange", mesh.ufl_cell(), 1)
Relem = VectorElement("R", mesh.ufl_cell(), 0, 2)
VPRelem = MixedElement([Velem, Relem])
V = FunctionSpace(mesh, VPRelem, constrained_domain=PeriodicBoundary())

#Function of the problem
ul = Function(V)
u, l = split(ul)

#Variational problem
u, l = TrialFunctions(V)
v, s = TestFunctions(V)
f = Expression(("20*c*c*cos(2*c*x[0])*cos(4*c*x[1])","1.0"), c = DOLFIN_PI, degree = 2)

#Define variational problem
a = inner(grad(u),grad(v))*dx + inner(s,u)*dx + inner(l,v)*dx
L = inner(f,v)*dx

#Compute the solution
solve(a == L, ul)

#Save the solution
file = File("periodic.pvd")
file << ul.sub(0)


where I impose that the displacement is periodic in all the directions. But, depending on the source term, the result in preview does not respect the periodic boundary condition.
Is that possible that there is a competition among periodic boundary condition, source term and function with mean-value equal to zero.
For instance, if the source term is a sinus, instead of a cosines, the PBC are not respected.

Why this happen? Maybe the PBC act only in the perpendicular direction?

Thank for the help

Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »