From ccc9498d3a19bc49ebdba557ba98567e43efa0d7 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Tue, 6 Oct 2015 17:46:24 -0500 Subject: [PATCH] op_template -> sym_operator --- examples/advection/var-velocity.py | 2 +- examples/gas_dynamics/box-in-box.py | 2 +- examples/gas_dynamics/euler/vortex.py | 2 +- examples/gas_dynamics/naca.py | 2 +- examples/gas_dynamics/square.py | 2 +- examples/gas_dynamics/wing.py | 2 +- examples/maxwell/cavities.py | 2 +- examples/maxwell/inhom-cavity.py | 2 +- examples/wave/wave.py | 2 +- grudge/models/advection.py | 22 +++++++++++----------- grudge/models/burgers.py | 8 ++++---- grudge/models/diffusion.py | 2 +- grudge/models/em.py | 6 +++--- grudge/models/gas_dynamics/__init__.py | 4 ++-- grudge/models/gas_dynamics/lbm.py | 8 ++++---- grudge/models/nd_calculus.py | 12 ++++++------ grudge/models/pml.py | 4 ++-- grudge/models/poisson.py | 10 +++++----- grudge/models/wave.py | 12 ++++++------ grudge/symbolic/tools.py | 4 ++-- 20 files changed, 55 insertions(+), 55 deletions(-) diff --git a/examples/advection/var-velocity.py b/examples/advection/var-velocity.py index 29dad59..8350285 100644 --- a/examples/advection/var-velocity.py +++ b/examples/advection/var-velocity.py @@ -130,7 +130,7 @@ def main(write_output=True, flux_type_arg="central", use_quadrature=True, default_scalar_type=numpy.float64, debug=["cuda_no_plan"], quad_min_degrees=quad_min_degrees, - tune_for=op.op_template(), + tune_for=op.sym_operator(), ) vis_discr = discr diff --git a/examples/gas_dynamics/box-in-box.py b/examples/gas_dynamics/box-in-box.py index 44b00c7..265e611 100644 --- a/examples/gas_dynamics/box-in-box.py +++ b/examples/gas_dynamics/box-in-box.py @@ -125,7 +125,7 @@ def main(): "cuda_no_plan_el_local", ], default_scalar_type=numpy.float32, - tune_for=op.op_template()) + tune_for=op.sym_operator()) from grudge.visualization import SiloVisualizer, VtkVisualizer # noqa #vis = VtkVisualizer(discr, rcon, "shearflow-%d" % order) diff --git a/examples/gas_dynamics/euler/vortex.py b/examples/gas_dynamics/euler/vortex.py index 5d48397..7086fed 100644 --- a/examples/gas_dynamics/euler/vortex.py +++ b/examples/gas_dynamics/euler/vortex.py @@ -68,7 +68,7 @@ def main(write_output=True): "gasdyn_vol": 3*order, "gasdyn_face": 3*order, }, - tune_for=op.op_template(), + tune_for=op.sym_operator(), debug=["cuda_no_plan"]) from grudge.visualization import SiloVisualizer, VtkVisualizer diff --git a/examples/gas_dynamics/naca.py b/examples/gas_dynamics/naca.py index 29aa043..b26a9c4 100644 --- a/examples/gas_dynamics/naca.py +++ b/examples/gas_dynamics/naca.py @@ -146,7 +146,7 @@ def main(): #"print_op_code" ], default_scalar_type=numpy.float32, - tune_for=op.op_template()) + tune_for=op.sym_operator()) from grudge.visualization import SiloVisualizer, VtkVisualizer #vis = VtkVisualizer(discr, rcon, "shearflow-%d" % order) diff --git a/examples/gas_dynamics/square.py b/examples/gas_dynamics/square.py index f82f831..f5ceb26 100644 --- a/examples/gas_dynamics/square.py +++ b/examples/gas_dynamics/square.py @@ -147,7 +147,7 @@ def main(): #"cuda_no_plan_el_local" ], default_scalar_type=numpy.float64, - tune_for=op.op_template(), + tune_for=op.sym_operator(), quad_min_degrees={ "gasdyn_vol": 3*order, "gasdyn_face": 3*order, diff --git a/examples/gas_dynamics/wing.py b/examples/gas_dynamics/wing.py index a720107..55002d8 100644 --- a/examples/gas_dynamics/wing.py +++ b/examples/gas_dynamics/wing.py @@ -144,7 +144,7 @@ def main(): "cuda_no_metis", ], default_scalar_type=numpy.float64, - tune_for=op.op_template()) + tune_for=op.sym_operator()) from grudge.visualization import SiloVisualizer, VtkVisualizer #vis = VtkVisualizer(discr, rcon, "shearflow-%d" % order) diff --git a/examples/maxwell/cavities.py b/examples/maxwell/cavities.py index cbfc45b..a387bb2 100644 --- a/examples/maxwell/cavities.py +++ b/examples/maxwell/cavities.py @@ -90,7 +90,7 @@ def main(write_output=True, allow_features=None, flux_type_arg=1, bdry_flux_type=bdry_flux_type_arg) discr = rcon.make_discretization(mesh_data, order=order, - tune_for=op.op_template(), + tune_for=op.sym_operator(), **extra_discr_args) from grudge.visualization import VtkVisualizer diff --git a/examples/maxwell/inhom-cavity.py b/examples/maxwell/inhom-cavity.py index 4f82e74..7264696 100644 --- a/examples/maxwell/inhom-cavity.py +++ b/examples/maxwell/inhom-cavity.py @@ -145,7 +145,7 @@ def main(write_output=True, allow_features=None, flux_type_arg=1, # bdry_flux_type=bdry_flux_type_arg, dimensions=2, pec_tag=BTAG_ALL) discr = rcon.make_discretization(mesh_data, order=order, - tune_for=op.op_template(), + tune_for=op.sym_operator(), **extra_discr_args) # create the initial solution diff --git a/examples/wave/wave.py b/examples/wave/wave.py index ea0f100..f027d32 100644 --- a/examples/wave/wave.py +++ b/examples/wave/wave.py @@ -82,7 +82,7 @@ def main(write_output=True, discr = rcon.make_discretization(mesh_data, order=4, debug=debug, default_scalar_type=dtype, - tune_for=op.op_template()) + tune_for=op.sym_operator()) from grudge.visualization import VtkVisualizer if write_output: diff --git a/grudge/models/advection.py b/grudge/models/advection.py index 7f0813f..a903388 100644 --- a/grudge/models/advection.py +++ b/grudge/models/advection.py @@ -85,14 +85,14 @@ class AdvectionOperatorBase(HyperbolicOperator): return la.norm(self.v) def bind(self, discr): - compiled_op_template = discr.compile(self.op_template()) + compiled_sym_operator = discr.compile(self.op_template()) from grudge.mesh import check_bc_coverage check_bc_coverage(discr.mesh, [self.inflow_tag, self.outflow_tag]) def rhs(t, u): bc_in = self.inflow_u.boundary_interpolant(t, discr, self.inflow_tag) - return compiled_op_template(u=u, bc_in=bc_in) + return compiled_sym_operator(u=u, bc_in=bc_in) return rhs @@ -100,8 +100,8 @@ class AdvectionOperatorBase(HyperbolicOperator): my_discr, my_part_data, nb_discr, nb_part_data): from grudge.partition import compile_interdomain_flux - compiled_op_template, from_nb_indices = compile_interdomain_flux( - self.op_template(), "u", "nb_bdry_u", + compiled_sym_operator, from_nb_indices = compile_interdomain_flux( + self.sym_operator(), "u", "nb_bdry_u", my_discr, my_part_data, nb_discr, nb_part_data, use_stupid_substitution=True) @@ -114,7 +114,7 @@ class AdvectionOperatorBase(HyperbolicOperator): return fld[from_nb_indices] def rhs(t, u, u_neighbor): - return compiled_op_template(u=u, + return compiled_sym_operator(u=u, nb_bdry_u=with_object_array_or_scalar(nb_bdry_permute, u_neighbor)) return rhs @@ -131,7 +131,7 @@ class StrongAdvectionOperator(AdvectionOperatorBase): return u.int * numpy.dot(normal, self.v) - self.weak_flux() - def op_template(self): + def sym_operator(self): from grudge.symbolic import Field, BoundaryPair, \ get_flux_operator, make_nabla, InverseMassOperator @@ -156,7 +156,7 @@ class WeakAdvectionOperator(AdvectionOperatorBase): def flux(self): return self.weak_flux() - def op_template(self): + def sym_operator(self): from grudge.symbolic import ( Field, BoundaryPair, @@ -277,7 +277,7 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): return do - def op_template(self, with_sensor=False): + def sym_operator(self, with_sensor=False): # {{{ operator preliminaries ------------------------------------------ from grudge.symbolic import (Field, BoundaryPair, get_flux_operator, make_stiffness_t, InverseMassOperator, make_sym_vector, @@ -369,8 +369,8 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): + diffusion_part def bind(self, discr, sensor=None): - compiled_op_template = discr.compile( - self.op_template(with_sensor=sensor is not None)) + compiled_sym_operator = discr.compile( + self.sym_operator(with_sensor=sensor is not None)) from grudge.mesh import check_bc_coverage, BTAG_ALL check_bc_coverage(discr.mesh, [BTAG_ALL]) @@ -384,7 +384,7 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): kwargs["bc_u"] = \ self.bc_u_f.boundary_interpolant(t, discr, tag=BTAG_ALL) - return compiled_op_template( + return compiled_sym_operator( u=u, v=self.advec_v.volume_interpolant(t, discr), **kwargs) diff --git a/grudge/models/burgers.py b/grudge/models/burgers.py index 70fa297..ade3858 100644 --- a/grudge/models/burgers.py +++ b/grudge/models/burgers.py @@ -61,7 +61,7 @@ class BurgersOperator(HyperbolicOperator): return do - def op_template(self, with_sensor): + def sym_operator(self, with_sensor): from grudge.symbolic import ( Field, make_stiffness_t, @@ -137,8 +137,8 @@ class BurgersOperator(HyperbolicOperator): + viscosity_bit def bind(self, discr, u0=1, sensor=None): - compiled_op_template = discr.compile( - self.op_template(with_sensor=sensor is not None)) + compiled_sym_operator = discr.compile( + self.sym_operator(with_sensor=sensor is not None)) from grudge.mesh import check_bc_coverage check_bc_coverage(discr.mesh, []) @@ -147,7 +147,7 @@ class BurgersOperator(HyperbolicOperator): kwargs = {} if sensor is not None: kwargs["sensor"] = sensor(u) - return compiled_op_template(u=u, u0=u0, **kwargs) + return compiled_sym_operator(u=u, u0=u0, **kwargs) return rhs diff --git a/grudge/models/diffusion.py b/grudge/models/diffusion.py index fb92a7f..04c5cf5 100644 --- a/grudge/models/diffusion.py +++ b/grudge/models/diffusion.py @@ -94,7 +94,7 @@ class BoundDiffusionOperator(grudge.iterative.OperatorBase): dop = self.diffusion_op = diffusion_op - op = dop.op_template(apply_minv=True) + op = dop.sym_operator(apply_minv=True) self.compiled_op = discr.compile(op) diff --git a/grudge/models/em.py b/grudge/models/em.py index f821206..e573fe6 100644 --- a/grudge/models/em.py +++ b/grudge/models/em.py @@ -303,7 +303,7 @@ class MaxwellOperator(HyperbolicOperator): else: return cse(-incident_bc_data) - def op_template(self, w=None): + def sym_operator(self, w=None): """The full operator template - the high level description of the Maxwell operator. @@ -372,13 +372,13 @@ class MaxwellOperator(HyperbolicOperator): check_bc_coverage(discr.mesh, [ self.pec_tag, self.absorb_tag, self.incident_tag]) - compiled_op_template = discr.compile(self.op_template()) + compiled_sym_operator = discr.compile(self.op_template()) def rhs(t, w, **extra_context): kwargs = {} kwargs.update(extra_context) - return compiled_op_template(w=w, t=t, **kwargs) + return compiled_sym_operator(w=w, t=t, **kwargs) return rhs diff --git a/grudge/models/gas_dynamics/__init__.py b/grudge/models/gas_dynamics/__init__.py index 278f5ce..3262cc6 100644 --- a/grudge/models/gas_dynamics/__init__.py +++ b/grudge/models/gas_dynamics/__init__.py @@ -717,7 +717,7 @@ class GasDynamicsOperator(TimeDependentOperator): def make_extra_terms(self): return 0 - def op_template(self, sensor_scaling=None, viscosity_only=False): + def sym_operator(self, sensor_scaling=None, viscosity_only=False): u = self.cse_u rho = self.cse_rho rho_u = self.rho_u @@ -808,7 +808,7 @@ class GasDynamicsOperator(TimeDependentOperator): raise ValueError("must specify a sensor if using " "artificial viscosity") - bound_op = discr.compile(self.op_template( + bound_op = discr.compile(self.sym_operator( sensor_scaling=sensor_scaling, viscosity_only=False)) diff --git a/grudge/models/gas_dynamics/lbm.py b/grudge/models/gas_dynamics/lbm.py index 5921f99..4eb65a6 100644 --- a/grudge/models/gas_dynamics/lbm.py +++ b/grudge/models/gas_dynamics/lbm.py @@ -180,14 +180,14 @@ class LatticeBoltzmannOperator(HyperbolicOperator): return f_bar - 1/(self.tau+1/2)*(f_bar - f_eq) def bind_rhs(self, discr): - compiled_op_template = discr.compile( + compiled_sym_operator = discr.compile( self.stream_rhs(self.f_bar())) #from grudge.mesh import check_bc_coverage, BTAG_ALL #check_bc_coverage(discr.mesh, [BTAG_ALL]) def rhs(t, f_bar): - return compiled_op_template(f_bar=f_bar) + return compiled_sym_operator(f_bar=f_bar) return rhs @@ -201,10 +201,10 @@ class LatticeBoltzmannOperator(HyperbolicOperator): (f_bar_i, type_info.VolumeVector(NodalRepresentation())) for f_bar_i in f_bar_sym) - compiled_op_template = discr.compile(what(f_bar_sym), type_hints=type_hints) + compiled_sym_operator = discr.compile(what(f_bar_sym), type_hints=type_hints) def rhs(f_bar): - return compiled_op_template(f_bar=f_bar) + return compiled_sym_operator(f_bar=f_bar) return rhs diff --git a/grudge/models/nd_calculus.py b/grudge/models/nd_calculus.py index eb8281b..96be723 100644 --- a/grudge/models/nd_calculus.py +++ b/grudge/models/nd_calculus.py @@ -45,7 +45,7 @@ class GradientOperator(Operator): normal = make_normal(self.dimensions) return u.int*normal - u.avg*normal - def op_template(self): + def sym_operator(self): from grudge.mesh import BTAG_ALL from grudge.symbolic import Field, BoundaryPair, \ make_nabla, InverseMassOperator, get_flux_operator @@ -61,12 +61,12 @@ class GradientOperator(Operator): flux_op(BoundaryPair(u, bc, BTAG_ALL))) def bind(self, discr): - compiled_op_template = discr.compile(self.op_template()) + compiled_sym_operator = discr.compile(self.op_template()) def op(u): from grudge.mesh import BTAG_ALL - return compiled_op_template(u=u, + return compiled_sym_operator(u=u, bc=discr.boundarize_volume_field(u, BTAG_ALL)) return op @@ -104,7 +104,7 @@ class DivergenceOperator(Operator): return flux - def op_template(self): + def sym_operator(self): from grudge.mesh import BTAG_ALL from grudge.symbolic import make_sym_vector, BoundaryPair, \ get_flux_operator, make_nabla, InverseMassOperator @@ -129,11 +129,11 @@ class DivergenceOperator(Operator): flux_op(BoundaryPair(v, bc, BTAG_ALL))) def bind(self, discr): - compiled_op_template = discr.compile(self.op_template()) + compiled_sym_operator = discr.compile(self.op_template()) def op(v): from grudge.mesh import BTAG_ALL - return compiled_op_template(v=v, + return compiled_sym_operator(v=v, bc=discr.boundarize_volume_field(v, BTAG_ALL)) return op diff --git a/grudge/models/pml.py b/grudge/models/pml.py index 7472ed8..8799a2c 100644 --- a/grudge/models/pml.py +++ b/grudge/models/pml.py @@ -129,7 +129,7 @@ class AbarbanelGottliebPMLMaxwellOperator(MaxwellOperator): return rhs[sub_idx] - def op_template(self, w=None): + def sym_operator(self, w=None): from grudge.tools import count_subset fld_cnt = count_subset(self.get_eh_subset()) if w is None: @@ -138,7 +138,7 @@ class AbarbanelGottliebPMLMaxwellOperator(MaxwellOperator): from grudge.tools import join_fields return join_fields( - MaxwellOperator.op_template(self, w[:fld_cnt]), + MaxwellOperator.sym_operator(self, w[:fld_cnt]), numpy.zeros((2*self.dimensions,), dtype=object) ) + self.pml_local_op(w) diff --git a/grudge/models/poisson.py b/grudge/models/poisson.py index d507ff3..a9f7145 100644 --- a/grudge/models/poisson.py +++ b/grudge/models/poisson.py @@ -36,7 +36,7 @@ import grudge.iterative class LaplacianOperatorBase(object): - def op_template(self, apply_minv, u=None, dir_bc=None, neu_bc=None): + def sym_operator(self, apply_minv, u=None, dir_bc=None, neu_bc=None): """ :param apply_minv: :class:`bool` specifying whether to compute a complete divergence operator. If False, the final application of the inverse @@ -154,9 +154,9 @@ class BoundPoissonOperator(grudge.iterative.OperatorBase): pop = self.poisson_op = poisson_op - op = pop.op_template( + op = pop.sym_operator( apply_minv=False, dir_bc=0, neu_bc=0) - bc_op = pop.op_template(apply_minv=False) + bc_op = pop.sym_operator(apply_minv=False) self.compiled_op = discr.compile(op) self.compiled_bc_op = discr.compile(bc_op) @@ -251,12 +251,12 @@ class HelmholtzOperator(PoissonOperator): PoissonOperator.__init__(self, *args, **kwargs) self.k = k - def op_template(self, apply_minv, u=None, dir_bc=None, neu_bc=None): + def sym_operator(self, apply_minv, u=None, dir_bc=None, neu_bc=None): from grudge.symbolic import Field if u is None: u = Field("u") - result = PoissonOperator.op_template(self, + result = PoissonOperator.sym_operator(self, apply_minv, u, dir_bc, neu_bc) if apply_minv: diff --git a/grudge/models/wave.py b/grudge/models/wave.py index f6276e7..c767125 100644 --- a/grudge/models/wave.py +++ b/grudge/models/wave.py @@ -107,7 +107,7 @@ class StrongWaveOperator(HyperbolicOperator): return -self.c*flux_strong - def op_template(self): + def sym_operator(self): d = self.dimensions w = sym.make_sym_vector("w", d+1) @@ -174,10 +174,10 @@ class StrongWaveOperator(HyperbolicOperator): self.neumann_tag, self.radiation_tag]) - compiled_op_template = discr.compile(self.op_template()) + compiled_sym_operator = discr.compile(self.op_template()) def rhs(t, w, **extra_context): - return compiled_op_template(t=t, w=w, **extra_context) + return compiled_sym_operator(t=t, w=w, **extra_context) return rhs @@ -271,7 +271,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): return do - def op_template(self, with_sensor=False): + def sym_operator(self, with_sensor=False): from grudge.symbolic import \ Field, \ make_sym_vector, \ @@ -386,7 +386,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): self.neumann_tag, self.radiation_tag]) - compiled_op_template = discr.compile(self.op_template( + compiled_sym_operator = discr.compile(self.op_template( with_sensor=sensor is not None)) def rhs(t, w): @@ -394,7 +394,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): if sensor is not None: kwargs["sensor"] = sensor(t, w) - return compiled_op_template(t=t, w=w, **kwargs) + return compiled_sym_operator(t=t, w=w, **kwargs) return rhs diff --git a/grudge/symbolic/tools.py b/grudge/symbolic/tools.py index 9d3a43e..d5df55d 100644 --- a/grudge/symbolic/tools.py +++ b/grudge/symbolic/tools.py @@ -165,7 +165,7 @@ def get_flux_dependencies(flux, field, bdry="all"): yield value -def split_optemplate_for_multirate(state_vector, op_template, +def split_optemplate_for_multirate(state_vector, sym_operator, index_groups): class IndexGroupKillerSubstMap: def __init__(self, kill_set): @@ -195,7 +195,7 @@ def split_optemplate_for_multirate(state_vector, op_template, return [ CommutativeConstantFoldingMapper()( SubstitutionMapper(killer)( - op_template[ig])) + sym_operator[ig])) for ig in index_groups for killer in killers] -- GitLab