Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dimensional Strang splitting in 2D. #651

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 39 additions & 17 deletions src/pyclaw/classic/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,17 @@ class ClawSolver2D(ClawSolver):

.. attribute:: dimensional_split

If True, use dimensional splitting (Godunov splitting).
Dimensional splitting with Strang splitting is not supported
at present but could easily be enabled if necessary.
If False, use unsplit Clawpack algorithms, possibly including
If set to 1, use dimensional splitting (Godunov splitting).
Can also be set to 2 for Strang splitting, but this is
implemented in an inefficient way and is not recommended.
If False (zero), use unsplit Clawpack algorithms, possibly including
transverse Riemann solves.

.. attribute:: transverse_waves

If dimensional_split is True, this option has no effect. If
dimensional_split is False, then transverse_waves should be one of
the following values:
If dimensional_split is >0, this option has no effect. If
dimensional_split is False (zero), then transverse_waves should be one
of the following values:

ClawSolver2D.no_trans: Transverse Riemann solver
not used. The stable CFL for this algorithm is 0.5. Not recommended.
Expand Down Expand Up @@ -517,14 +517,14 @@ def step_hyperbolic(self,solution):

rpn2 = self.rp.rpn2._cpointer

if (self.dimensional_split) or (self.transverse_waves==0):
if (self.dimensional_split>0) or (self.transverse_waves==0):
rpt2 = rpn2 # dummy value; it won't be called
else:
rpt2 = self.rp.rpt2._cpointer

if self.dimensional_split:
#Right now only Godunov-dimensional-splitting is implemented.
#Strang-dimensional-splitting could be added following dimsp2.f in Clawpack.
if self.dimensional_split == 1:
# Right now only Godunov-dimensional-splitting is implemented.
# Strang-dimensional-splitting could be added following dimsp2.f in Clawpack.

self.qbc, cfl_x = self.fmod.step2ds(maxm,self.num_ghost,mx,my, \
qold,self.qbc,self.auxbc,dx,dy,self.dt,self._method,self._mthlim,\
Expand All @@ -536,7 +536,30 @@ def step_hyperbolic(self,solution):

cfl = max(cfl_x,cfl_y)

elif self.dimensional_split == 2:
# Dimensional Strang splitting
# Note that this is ineefficient but is the simplest way
# to work with variable time step size. Also,
# time-dependent boundary conditions won't be set
# correctly with the current implementation.

self.qbc, cfl_x1 = self.fmod.step2ds(maxm,self.num_ghost,mx,my, \
qold,self.qbc,self.auxbc,dx,dy,self.dt/2,self._method,self._mthlim,\
self.aux1,self.aux2,self.aux3,self.work,1,self.fwave,rpn2,rpt2)

self.qbc, cfl_y = self.fmod.step2ds(maxm,self.num_ghost,mx,my, \
self.qbc,self.qbc,self.auxbc,dx,dy,self.dt,self._method,self._mthlim,\
self.aux1,self.aux2,self.aux3,self.work,2,self.fwave,rpn2,rpt2)


self.qbc, cfl_x2 = self.fmod.step2ds(maxm,self.num_ghost,mx,my, \
qold,self.qbc,self.auxbc,dx,dy,self.dt/2,self._method,self._mthlim,\
self.aux1,self.aux2,self.aux3,self.work,1,self.fwave,rpn2,rpt2)

cfl = max(cfl_x1, cfl_x2, cfl_y)

else:
# Unsplit algorithm

self.qbc, cfl = self.fmod.step2(maxm,self.num_ghost,mx,my, \
qold,self.qbc,self.auxbc,dx,dy,self.dt,self._method,self._mthlim,\
Expand Down Expand Up @@ -565,16 +588,15 @@ class ClawSolver3D(ClawSolver):

.. attribute:: dimensional_split

If True, use dimensional splitting (Godunov splitting).
Dimensional splitting with Strang splitting is not supported
at present but could easily be enabled if necessary.
If False, use unsplit Clawpack algorithms, possibly including
If set to 1, use dimensional splitting (Godunov splitting).
Dimensional Strang splitting is not implemented in 3D.
If False (zero), use unsplit Clawpack algorithms, possibly including
transverse Riemann solves.

.. attribute:: transverse_waves

If dimensional_split is True, this option has no effect. If
dim_plit is False, then transverse_waves should be one of
If dimensional_split is >0, this option has no effect. If
dimensional_split is False, then transverse_waves should be one of
the following values:

ClawSolver3D.no_trans: Transverse Riemann solver
Expand Down