Skip to content

Commit

Permalink
monge_ampere: minor bc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallwork23 committed Dec 9, 2021
1 parent d4abf2c commit 0b34b2b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions movement/monge_ampere.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def l2_projector(self):
# Enforce no mesh movement normal to boundaries
a_bc = ufl.dot(v_cts, n)*ufl.dot(u_cts, n)*self.ds
L_bc = ufl.dot(v_cts, n)*firedrake.Constant(0.0)*self.ds
bcs.append(firedrake.EquationBC(a_bc == L_bc, self.grad_phi, 'on_boundary'))
bcs.append(firedrake.EquationBC(a_bc == L_bc, self._grad_phi, i))

# Allow tangential movement, but only up until the end of boundary segments
s = ufl.perp(n)
Expand All @@ -205,7 +205,7 @@ def l2_projector(self):
warn('Have you checked that all straight line segments are uniquely tagged?')
corners = [(i, j) for i in edges for j in edges.difference([i])]
bbc = firedrake.DirichletBC(self.P1_vec, 0, corners)
bcs.append(firedrake.EquationBC(a_bc == L_bc, self.grad_phi, 'on_boundary', bcs=bbc))
bcs.append(firedrake.EquationBC(a_bc == L_bc, self._grad_phi, i, bcs=bbc))

# Create solver
problem = firedrake.LinearVariationalProblem(a, L, self._grad_phi, bcs=bcs)
Expand Down Expand Up @@ -311,7 +311,11 @@ def equidistributor(self):
L = -ufl.dot(ufl.div(tau), ufl.grad(self.phi))*self.dx \
+ (tau[0, 1]*n[1]*self.phi.dx(0) + tau[1, 0]*n[0]*self.phi.dx(1))*self.ds
problem = firedrake.LinearVariationalProblem(a, L, self.sigma)
sp = {"ksp_type": "cg"}
sp = {
"ksp_type": "cg",
"pc_type": "bjacobi",
"sub_pc_type": "ilu",
}
self._equidistributor = firedrake.LinearVariationalSolver(problem, solver_parameters=sp)
return self._equidistributor

Expand Down

0 comments on commit 0b34b2b

Please sign in to comment.