defVSpace(mesh,degree=1):# endeligt underrum af H¹_{\diamond} funktioner i H¹ der integrerer til 0 på randen - det svarer til H¹(\Omega) x \mathbb{R}
E1=FiniteElement('P',triangle,degree)
E0=FiniteElement('R',triangle,0)
returnFunctionSpace(mesh,MixedElement(E1,E0))
defVsSpace(mesh,degree=1):# Corresponding to H^1
E1=FiniteElement('CG',triangle,degree)
returnFunctionSpace(mesh,E1)
defVqSpace(mesh,degree=1):# Used for the gradients
returnVectorFunctionSpace(mesh,'CG',degree)
defVector(V):
returnFunction(V).vector()
# Define how to calculate the gradients
defSolver(Op):
s=PETScLUSolver(as_backend_type(Op),'mumps')# Constructs the linear operator Ks for the linear system Ks u = f using LU factorization, where the method 'numps' is used
returns
defGradientSolver(Vq,Vs):#Calculate derivatives on the quadrature points
# return (on_boundary and ((ufl.atan_2(x[1],x[0])<-1.0/2.0*np.pi and ufl.atan_2(x[1],x[0])>-np.pi) or (ufl.atan_2(x[1],x[0])<np.pi and ufl.atan_2(x[1],x[0])>0)))
#\Gamma_{huge}:
#def inside(self, x, on_boundary):
# return (on_boundary and ((ufl.atan_2(x[1],x[0])<-1.0/4.0*np.pi and ufl.atan_2(x[1],x[0])>-np.pi) or (ufl.atan_2(x[1],x[0])<np.pi and ufl.atan_2(x[1],x[0])>0)))