DG in a periodic domain
Hi,
I would like to solve a DG problem in a periodic domain, i.e. have interior facet integrals dS where the facets on the periodic boundary are simply treated as internal, and stuff like jump() and avg() would work as well. I understand that this is not currently supported in Dolfin where periodic boundary conditions are treated as strong dirichlet bcs. I saw the branch lp:~mikael-mortensen/dolfin/periodic_to_dofmap/ and was hoping that would implement it, as it seems to work at the mesh level - so it could in principle fix the topology to be periodic so that all derived function spaces are automatically periodic.
So my question really is, is this indeed how the new periodic boundary conditions on that branch work, and would periodic DG interior facet integrals indeed be supported? I tried out the branch and it didn't work as expected. See code below, using the new add_periodic_
Best wishes
Stephan Kramer
from dolfin import *
mesh = UnitSquareMesh(3,3)
dt=0.01
# Sub domain for Periodic boundary condition
class PeriodicBoundar
# Left boundary is "target domain" G
def inside(self, x, on_boundary):
return abs(x[0]) < DOLFIN_EPS and on_boundary
# Map right boundary (H) to left boundary (G)
def map(self, x, y):
y[0] = x[0] - 1.0
y[1] = x[1]
pbc=PeriodicBou
mesh.add_
V = FunctionSpace(mesh, "DG", 1)
v = TestFunction(V)
phi_new = TrialFunction(V)
u = Expression(("1.0", "0.0")) # constant velocity
ic = Expression("1.0") # initial solution, only varies in y
phi = interpolate(ic, V)
n = FacetNormal(mesh)
un = (dot(u, n) + abs(dot(u, n)))/2.0
F = v*(phi_
- dot(grad(v), u)*phi*dx \
+ dot(jump(v), un('+')*phi('+') - un('-')*phi('-') )*dS \
+ dot(v, un*phi)*ds
for i in range(20):
solve(
plot(phi, interactive=True)
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Stephan Kramer for more information if necessary.