Please am having hard time applying the following boundary conditions on subdomains. Below is a sample of my code and the boundary conditions that I want to apply:
Am solving a system of nonlinear coupled pdes on the domain [-1,1]*[-1,1].
p1, p2 are scalar functions in 2d and U=(u1,u2), V=(v1,v2) are vector functions also in 2d.
Now I want to apply the following boundary conditions
Periodic condition on left and right
Dirichlet boundary condition for top and bottom for U=(u1,u2)
u1(x,-1) = -1 u1(x,1)= 1
u2(x,-1)= -1 u2(x,1)= 1
Periodic for V=(v1,v2) alone for top and bottom
v1(x,-1)= 0 v1(x,-1)= 0
v2(x,-1)= 0 v2(x,-1)=0
This is how my is code arranged.
from dolfin import *
mesh = RectangleMesh(Point(-1,-1),Point(1,1),200,200) #Domain[-1,1]*[-1,1]
V1= VectorFunctionSpace(mesh, 'CG', degree=2)
V2=VectorFunctionSpace(mesh, 'Lagrange', degree=2)
Q1 = FunctionSpace(mesh, 'CG', degree=1)
Q2 = FunctionSpace(mesh, 'CG', degree=1)
VQ = MixedFunctionSpace([V1,V2, Q1, Q2])
(U, V, p1,p2)= TrialFunctions(VQ)
(m,n, q, r) = TestFunctions(VQ)
Need to define boundary conditions here and put them in a list like
bcs=[ Boundary conditions]
Am not sure how to proceed. whether to define on each subspace or on each each subdomain. And if that how to do them. Could someone help me with this please.
F = (All the terms of the system have been added here)
F1 = action(F,H)
J = derivative(F1,H)
problem = NonlinearVariationalProblem(F1,H,bcs, J)
solver = NonlinearVariationalSolver(problem)
(U,V, p1,p2) = H.split(deepcopy=True)
Any help is greatly appreciated. Thank you.