Skip to content

Commit

Permalink
Revert #554 and require fenicsadapter 2.2.0 to fix subcycling (#578)
Browse files Browse the repository at this point in the history
* Revert changes from #554
* Remove changelog entry (#554 was not included in any release)
* Require fenicsprecice==2.2.0 to avoid subcycling bug.

---------

Co-authored-by: Benjamin Rodenberg <[email protected]>
  • Loading branch information
NiklasVin and BenjaminRodenberg authored Nov 7, 2024
1 parent 77f190d commit a10e4a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion changelog-entries/554.md

This file was deleted.

2 changes: 1 addition & 1 deletion perpendicular-flap/solid-fenics/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fenicsprecice~=2.0
fenicsprecice~=2.2
numpy >1, <2
matplotlib

Expand Down
15 changes: 9 additions & 6 deletions perpendicular-flap/solid-fenics/solid.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,16 @@ def update_v(a, u_old, v_old, a_old, ufl=True):
def update_fields(u, u_old, v_old, a_old):
"""Update all fields at the end of a timestep."""

u_vec, u0_vec = u.vector(), u_old.vector()
v0_vec, a0_vec = v_old.vector(), a_old.vector()

# call update functions
a_new = update_a(u, u_old, v_old, a_old)
v_new = update_v(u, u_old, v_old, a_old)
a_vec = update_a(u_vec, u0_vec, v0_vec, a0_vec, ufl=False)
v_vec = update_v(a_vec, u0_vec, v0_vec, a0_vec, ufl=False)

# update values
a_old.assign(project(a_new, V))
v_old.assign(project(v_new, V))
u_old.assign(u)
# assign u->u_old
v_old.vector()[:], a_old.vector()[:] = v_vec, a_vec
u_old.vector()[:] = u.vector()


def avg(x_old, x_new, alpha):
Expand Down Expand Up @@ -236,6 +238,7 @@ def avg(x_old, x_new, alpha):
n = n_cp
else:
update_fields(u_np1, u_n, v_n, a_n)
u_n.assign(u_np1)
t += float(dt)
n += 1

Expand Down

0 comments on commit a10e4a6

Please sign in to comment.