Skip to content

Commit

Permalink
bcs: style
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Dec 14, 2024
1 parent 5c24928 commit 45bb847
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions irksome/discontinuous_galerkin_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ def getFormDiscGalerkin(F, L, Q, t, dt, u0, bcs=None, nullspace=None):
Fnew += dt * qwts[q] * basis_vals[i, q] * replace(F_i, repl)

# Oh, honey, is it the boundary conditions?
minv_basis_vals = mmat_inv @ basis_vals
minv_test_vals = mmat_inv @ np.multiply(basis_vals, qwts)
if bcs is None:
bcs = []
bcsnew = []
for bc in bcs:
bcarg = as_ufl(bc._original_arg)
bcblah_at_qp = np.zeros((len(qpts),), dtype="O")
for q in range(len(qpts)):
bcblah_at_qp[q] = qwts[q] * (
replace(bcarg, {t: t + qpts[q] * dt}))
bc_func_for_stages = minv_basis_vals @ bcblah_at_qp
tcur = t + qpts[q] * dt
bcblah_at_qp[q] = replace(bcarg, {t: tcur})
bc_func_for_stages = minv_test_vals @ bcblah_at_qp
for i in range(num_stages):
Vbigi = stage2spaces4bc(bc, V, Vbig, i)
bcsnew.append(bc.reconstruct(V=Vbigi, g=bc_func_for_stages[i]))
Expand Down
11 changes: 6 additions & 5 deletions irksome/galerkin_stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,18 @@ def getFormGalerkin(F, L_trial, L_test, Q, t, dt, u0, bcs=None, nullspace=None):
Fnew += dt * qwts[q] * test_vals[i, q] * replace(F_i, repl)

# Oh, honey, is it the boundary conditions?
minv_test_vals = mmat_inv @ np.multiply(test_vals, qwts)
if bcs is None:
bcs = []
bcsnew = []
for bc in bcs:
u0_sub = bc2space(bc, u0)
bcarg = as_ufl(bc._original_arg)
bcblah_at_qp = np.zeros((len(qpts),), dtype="O")
for q in range(len(qpts)):
bcblah_at_qp[q] = qwts[q] * (
replace(bcarg, {t: t + qpts[q] * dt})
- bc2space(bc, u0) * trial_vals[0, q])
bc_func_for_stages = mmat_inv @ (test_vals @ bcblah_at_qp)
tcur = t + qpts[q] * dt
bcblah_at_qp[q] = replace(bcarg, {t: tcur}) - u0_sub * trial_vals[0, q]
bc_func_for_stages = minv_test_vals @ bcblah_at_qp
for i in range(num_stages):
Vbigi = stage2spaces4bc(bc, V, Vbig, i)
bcsnew.append(bc.reconstruct(V=Vbigi, g=bc_func_for_stages[i]))
Expand Down Expand Up @@ -246,7 +247,7 @@ def __init__(self, F, order, t, dt, u0, bcs=None, basis_type=None,

push_parent(u0.function_space().dm, UU.function_space().dm)
self.solver = NLVS(problem,
appctx=appctx,
appctx=appctx,
solver_parameters=solver_parameters,
nullspace=bigNSP)
pop_parent(u0.function_space().dm, UU.function_space().dm)
Expand Down

0 comments on commit 45bb847

Please sign in to comment.