This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Defining mixed boundary conditions correctly

0 votes

Hi everyone

I'm working a spectral problem with the elasticity equations, with a DG method in a mixed formulation, where the stress tensor sigma is an unknown. My domain is the unit square. I need to impose a zero Dirichlet condition in the bottom of the square, and the normal component of sigma equal to zero on the other three sides of the square. My idea is to use the ideas in here.
The following parts of my code shows what i'm doing

 degree =2
 nn = 32
 mesh = UnitSquareMesh(nn, nn)
 bdr=MeshFunction("size_t",mesh,1)
 bdr.set_all(0) 
 # ********* Boundary conditions ******* #
 class botton(SubDomain):
 def inside(self, x, on_boundary):
 return near(x[1],0) 
 botton().mark(bdr, 30)
 # discrete spaces for the DG method
V = TensorFunctionSpace(mesh, "DG", degree)
Q = FunctionSpace(mesh, "DG", degree-1)
W = MixedFunctionSpace([V, Q])
  # defining the mixed boundary conditiosn on the square
 class BoundarySource(Expression):
def __init__(self, mesh):
    self.mesh = mesh
def eval_cell(self, values, x, ufc_cell):
    cell = Cell(self.mesh, ufc_cell.index)
    n = cell.normal(ufc_cell.local_facet)
    g = 0.0
    values[0] = g*n[0]
    values[1] = g*n[1]
    values[2] = g*n[0]
    values[3] = g*n[1]
    def value_shape(self):
    return (2, 2)
    G = BoundarySource(mesh)
    # Define essential boundary
   def boundary(x):
   return x[0] < DOLFIN_EPS or x[1] > 1.0 - DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS 
    bcsrest = DirichletBC(W.sub(0), G, boundary)

When i compile my code, my eigenvalues are complex and must be real. So, i think that i'm not impossign correctly the condition $\sigma\cdot n=0$. Any suggestion?

asked Mar 28, 2017 by alberin FEniCS Novice (150 points)
edited Mar 28, 2017 by alberin

1 Answer

0 votes

If your normal vector is in the x-direction, you should not impose zero on sigma_yy, but the posted code seems to do that.

answered Mar 29, 2017 by KristianE FEniCS Expert (12,900 points)
...