From 117522c05bcdd9b42d786b775371aa0801dec69c Mon Sep 17 00:00:00 2001 From: David Ketcheson Date: Mon, 2 Dec 2024 09:16:55 +0300 Subject: [PATCH 1/2] Automatically set solver.fwave based on values in Riemann repository. Also check if it's set when checking solver validity. --- src/pyclaw/solver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pyclaw/solver.py b/src/pyclaw/solver.py index 6a6c73f3..72ce8e1c 100644 --- a/src/pyclaw/solver.py +++ b/src/pyclaw/solver.py @@ -218,6 +218,7 @@ def get_clawpack_dot_xxx(modname): return modname.rpartition('.')[0].rpartition( self.num_eqn = None self.num_waves = None + self.fwave = None self.compute_gauge_values = default_compute_gauge_values r"""(function) - Function that computes quantities to be recorded at gauges""" @@ -234,6 +235,7 @@ def get_clawpack_dot_xxx(modname): return modname.rpartition('.')[0].rpartition( rp_name = rp_name.replace("_ptwise", "") self.num_eqn = riemann.static.num_eqn.get(rp_name,None) self.num_waves = riemann.static.num_waves.get(rp_name,None) + self.fwave = riemann.static.fwave.get(rp_name,None) self._isinitialized = True @@ -273,6 +275,9 @@ def is_valid(self): if self.num_eqn is None: valid = False reason = 'solver.num_eqn has not been set.' + if self.fwave is None: + valid = False + reason = 'solver.fwave has not been set.' if (None in self.bc_lower) or (None in self.bc_upper): valid = False reason = 'One of the boundary conditions has not been set.' From 9266b53804e4940a8cefd5dfe3aeb36a42783f88 Mon Sep 17 00:00:00 2001 From: David Ketcheson Date: Mon, 2 Dec 2024 22:07:00 +0300 Subject: [PATCH 2/2] Set fwave=False in advection reaction example. --- examples/advection_reaction_2d/advection_reaction.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/advection_reaction_2d/advection_reaction.py b/examples/advection_reaction_2d/advection_reaction.py index aa34983e..a39ae333 100644 --- a/examples/advection_reaction_2d/advection_reaction.py +++ b/examples/advection_reaction_2d/advection_reaction.py @@ -80,6 +80,7 @@ def setup(outdir='./_output'): domain = pyclaw.Domain( (0.,0.), (1.,1.), (100,100) ) solver.num_eqn = 2 solver.num_waves = 1 + solver.fwave = False num_aux = 2 state = pyclaw.State(domain, solver.num_eqn, num_aux)