1111 Matteo Parsani -- Initial version (July 2011)
1212"""
1313
14- from pyclaw .solver import Solver
14+ import petclaw .solver
1515
16- import limiters .tvd
16+ import pyclaw . limiters .tvd
1717import riemann
1818
1919# ========================================================================
@@ -38,15 +38,15 @@ def src(solver,solutions,t,dt):
3838# ============================================================================
3939# Generic implicit Clawpack solver class
4040# ============================================================================
41- class ImplicitClawSolver (Solver ):
41+ class ImplicitClawSolver (petclaw . solver . PetSolver ):
4242 r"""
43- Generic implicit Clawpack solver
43+ Generic implicit Clawpack solver.
4444
4545 All implicit Clawpack solvers inherit from this base class.
4646
4747 .. attribute:: mthlim
4848
49- Limiter to be used on each wave. ``Default = limiters.tvd.minmod``
49+ Limiter to be used on each wave. ``Default = pyclaw. limiters.tvd.minmod``
5050
5151 .. attribute:: order
5252
@@ -98,7 +98,7 @@ def __init__(self,data=None):
9898
9999 # Default required attributes
100100 self ._default_attr_values ['mbc' ] = 2
101- self ._default_attr_values ['limiters' ] = limiters .tvd .minmod
101+ self ._default_attr_values ['limiters' ] = pyclaw . limiters .tvd .minmod
102102 self ._default_attr_values ['order' ] = 2
103103 self ._default_attr_values ['fwave' ] = False
104104 self ._default_attr_values ['src' ] = src
@@ -117,7 +117,7 @@ def setup(self,solutions):
117117 This routine will be called once before the solver is used via the
118118 :class:`~pyclaw.controller.Controller`.
119119 """
120- b . set ( 0 ) pass
120+ pass
121121
122122 # ========== Riemann solver library routines =============================
123123 def list_riemann_solvers (self ):
@@ -224,7 +224,7 @@ def set_mthlim(self):
224224
225225
226226# ============================================================================
227- # Application context for PETSc SNES; 1D implicit Lax-Wendroff
227+ # Application context (appc) for PETSc SNES; 1D implicit Lax-Wendroff
228228# ============================================================================
229229class ImplicitLW1D :
230230 r"""
@@ -249,7 +249,7 @@ def __init__(self,state,mwaves,mbc,method,mthlim,dt,aux,kernel_language='Fortran
249249 self .mx = self .grid .ng [0 ]
250250 self .dx = self .grid .d [0 ]
251251
252- # ========== Evaluation of the nonlinear function =============================
252+ # ========== Evaluation of the nonlinear function ==========================
253253 def evalNonLinearFunction (self ,snes ,qnew ,F ):
254254 mx = self .mx
255255 mbc = self .mbc
@@ -435,15 +435,15 @@ def updatesolution(self,state):
435435 q^(n+1) = solution at the new time level (solution of the nonlinear system)
436436 R(q^(n+1)) = nonlinear function arising from the spatial/time discretization
437437 """
438-
439- # Create application context and PETSc nonlinear solver
438+
439+ # Define aux array
440440 maux = state .maux
441441 if maux > 0 :
442442 aux = self .auxbc (state )
443443 else :
444444 aux = np .empty ((maux ,mx + 2 * mbc ))
445445
446-
446+ # Create application context (appc) and PETSc nonlinear solver
447447 mwaves ,mbc = self .mwaves ,self .mbc
448448
449449 appc = ImplicitLW1D (state ,mwaves ,mbc ,self .method ,self .mthlim ,self .dt ,aux ,self .kernel_language )
@@ -475,7 +475,7 @@ def updatesolution(self,state):
475475 snes .solve (b , qnew )
476476
477477 # Assign to q the new value qnew.
478- qbc = qnew
478+ state . qbc = qnew
479479
480480
481481
0 commit comments