diff --git a/.gitignore b/.gitignore index e6efa6fae37f239c8ed880ac0cf08db633158bca..6fbe1451406e5db4b68e91d002ad4f5bb19ca069 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ run-debug-* *.dot *.vtk *.silo +*.dat diff --git a/examples/advection/space-dep.dat b/examples/advection/space-dep.dat deleted file mode 100644 index 78e1f83c1721d1491d9eb5fce605c90b5607b872..0000000000000000000000000000000000000000 Binary files a/examples/advection/space-dep.dat and /dev/null differ diff --git a/examples/advection/var-velocity.py b/examples/advection/var-velocity.py index 89bd973ea350da866c0ac3c6558024507a3fae02..29dad598d7dde10ad23439507833cf2eebdc9852 100644 --- a/examples/advection/var-velocity.py +++ b/examples/advection/var-velocity.py @@ -168,7 +168,7 @@ def main(write_output=True, flux_type_arg="central", use_quadrature=True, # filter setup------------------------------------------------------------- from grudge.discretization import ExponentialFilterResponseFunction - from grudge.optemplate.operators import FilterOperator + from grudge.symbolic.operators import FilterOperator mode_filter = FilterOperator( ExponentialFilterResponseFunction(min_amplification=0.9,order=4))\ .bind(discr) diff --git a/examples/burgers/burgers.dat b/examples/burgers/burgers.dat deleted file mode 100644 index baf59af8ed316993b4c2f5eaedea2b2c2538f17d..0000000000000000000000000000000000000000 Binary files a/examples/burgers/burgers.dat and /dev/null differ diff --git a/examples/burgers/burgers.py b/examples/burgers/burgers.py index c360fde95083d6f6c5bf2cc903e205e13814ef51..8f5ebc8e1c9d71df896acf90aa21e66dae4b3d54 100644 --- a/examples/burgers/burgers.py +++ b/examples/burgers/burgers.py @@ -192,7 +192,7 @@ def main(write_output=True, flux_type_arg="upwind", step_it = times_and_steps( final_time=case.final_time, logmgr=logmgr, max_dt_getter=lambda t: dt) - from grudge.optemplate import InverseVandermondeOperator + from grudge.symbolic import InverseVandermondeOperator inv_vdm = InverseVandermondeOperator().bind(discr) for step, t, dt in step_it: diff --git a/examples/gas_dynamics/euler/sine-wave.py b/examples/gas_dynamics/euler/sine-wave.py index 941ee2adbee15de06ccbb106c94e0c8b550b2be5..9d8e176770000ae7a4c17a20ca6bea94b322204c 100644 --- a/examples/gas_dynamics/euler/sine-wave.py +++ b/examples/gas_dynamics/euler/sine-wave.py @@ -87,12 +87,12 @@ def main(final_time=1, write_output=False): fields = sinewave.volume_interpolant(0, discr) gamma, mu, prandtl, spec_gas_const = sinewave.properties() - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL from grudge.models.gas_dynamics import GasDynamicsOperator op = GasDynamicsOperator(dimensions=mesh.dimensions, gamma=gamma, mu=mu, prandtl=prandtl, spec_gas_const=spec_gas_const, bc_inflow=sinewave, bc_outflow=sinewave, bc_noslip=sinewave, - inflow_tag=TAG_ALL, source=None) + inflow_tag=BTAG_ALL, source=None) euler_ex = op.bind(discr) diff --git a/examples/gas_dynamics/euler/sod-2d.py b/examples/gas_dynamics/euler/sod-2d.py index 0e6320c216f0965fe65ad77cb51307025768cf34..1c4896e66b209fd1eca312e9447db672e8383fec 100644 --- a/examples/gas_dynamics/euler/sod-2d.py +++ b/examples/gas_dynamics/euler/sod-2d.py @@ -72,13 +72,13 @@ def main(): fields = sod_field.volume_interpolant(0, discr) from grudge.models.gas_dynamics import GasDynamicsOperator - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL op = GasDynamicsOperator(dimensions=2, gamma=sod_field.gamma, mu=0.0, prandtl=sod_field.prandtl, bc_inflow=sod_field, bc_outflow=sod_field, bc_noslip=sod_field, - inflow_tag=TAG_ALL, + inflow_tag=BTAG_ALL, source=None) euler_ex = op.bind(discr) diff --git a/examples/gas_dynamics/euler/vortex-adaptive-grid.py b/examples/gas_dynamics/euler/vortex-adaptive-grid.py index faff8d2877b8db24d98fdb11d85859c6f32ab211..0722726ec42113869feccac5ac9c1e4079e0f919 100644 --- a/examples/gas_dynamics/euler/vortex-adaptive-grid.py +++ b/examples/gas_dynamics/euler/vortex-adaptive-grid.py @@ -89,12 +89,12 @@ def main(write_output=True): fields = vortex.volume_interpolant(0, discr) from grudge.models.gas_dynamics import GasDynamicsOperator - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL op = GasDynamicsOperator(dimensions=2, gamma=vortex.gamma, mu=vortex.mu, prandtl=vortex.prandtl, spec_gas_const=vortex.spec_gas_const, bc_inflow=vortex, bc_outflow=vortex, bc_noslip=vortex, - inflow_tag=TAG_ALL, source=None) + inflow_tag=BTAG_ALL, source=None) euler_ex = op.bind(discr) diff --git a/examples/gas_dynamics/euler/vortex-sources.py b/examples/gas_dynamics/euler/vortex-sources.py index 548dd3998087c4519e61541003110ec7b9bd2a6f..1dbc30dfc4022b4ac1de0e9a6be0cdd1f8e2e01b 100644 --- a/examples/gas_dynamics/euler/vortex-sources.py +++ b/examples/gas_dynamics/euler/vortex-sources.py @@ -189,13 +189,13 @@ def main(write_output=True): from grudge.models.gas_dynamics import ( GasDynamicsOperator, GammaLawEOS) - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL op = GasDynamicsOperator(dimensions=2, mu=0.0, prandtl=0.72, spec_gas_const=287.1, equation_of_state=GammaLawEOS(vortex.gamma), bc_inflow=vortex, bc_outflow=vortex, bc_noslip=vortex, - inflow_tag=TAG_ALL, source=sources) + inflow_tag=BTAG_ALL, source=sources) euler_ex = op.bind(discr) diff --git a/examples/gas_dynamics/euler/vortex.py b/examples/gas_dynamics/euler/vortex.py index 70e56baca10b7033e88d5c21709310876be8cf55..5d4839753eb02c7e097d09719a371b6e456410e2 100644 --- a/examples/gas_dynamics/euler/vortex.py +++ b/examples/gas_dynamics/euler/vortex.py @@ -54,13 +54,13 @@ def main(write_output=True): from grudge.models.gas_dynamics import ( GasDynamicsOperator, PolytropeEOS, GammaLawEOS) - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL # works equally well for GammaLawEOS op = GasDynamicsOperator(dimensions=2, mu=flow.mu, prandtl=flow.prandtl, spec_gas_const=flow.spec_gas_const, equation_of_state=PolytropeEOS(flow.gamma), bc_inflow=flow, bc_outflow=flow, bc_noslip=flow, - inflow_tag=TAG_ALL, source=None) + inflow_tag=BTAG_ALL, source=None) discr = rcon.make_discretization(mesh_data, order=order, default_scalar_type=numpy.float64, diff --git a/examples/gas_dynamics/lbm-simple.py b/examples/gas_dynamics/lbm-simple.py index a8b86b328a235f59f5474a1eb4f773f56bd44fd3..0b035e1d7b8fd2f9ac5bbb513c4218ed1d501c69 100644 --- a/examples/gas_dynamics/lbm-simple.py +++ b/examples/gas_dynamics/lbm-simple.py @@ -64,7 +64,7 @@ def main(write_output=True, dtype=np.float32): from grudge.data import CompiledExpressionData def ic_expr(t, x, fields): - from grudge.optemplate import CFunction + from grudge.symbolic import CFunction from pymbolic.primitives import IfPositive from pytools.obj_array import make_obj_array @@ -76,7 +76,7 @@ def main(write_output=True, dtype=np.float32): w = 0.05 delta = 0.05 - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse u = cse(make_obj_array([ IfPositive(x[1]-1/2, u0*tanh(4*(3/4-x[1])/w), @@ -100,7 +100,7 @@ def main(write_output=True, dtype=np.float32): f_bar = CompiledExpressionData(ic_expr).volume_interpolant(0, discr) from grudge.discretization import ExponentialFilterResponseFunction - from grudge.optemplate.operators import FilterOperator + from grudge.symbolic.operators import FilterOperator mode_filter = FilterOperator( ExponentialFilterResponseFunction(min_amplification=0.9, order=4))\ .bind(discr) diff --git a/examples/maxwell/dipole.py b/examples/maxwell/dipole.py index afed4b145adab832b4d2a463cf5e3f4a6cb848c9..83e8d6dee8021dba1ad8cb5d14167cfad39fff07 100644 --- a/examples/maxwell/dipole.py +++ b/examples/maxwell/dipole.py @@ -105,7 +105,7 @@ def main(write_output=True, allow_features=None): sph_dipole.source_modulation(t)*self.num_sf ]) - from grudge.mesh import TAG_ALL, TAG_NONE + from grudge.mesh import BTAG_ALL, BTAG_NONE if dims == 2: from grudge.models.em import TMMaxwellOperator as MaxwellOperator else: @@ -114,8 +114,8 @@ def main(write_output=True, allow_features=None): op = MaxwellOperator( epsilon, mu, flux_type=1, - pec_tag=TAG_NONE, - absorb_tag=TAG_ALL, + pec_tag=BTAG_NONE, + absorb_tag=BTAG_ALL, current=PointDipoleSource(), ) diff --git a/examples/maxwell/inhom-cavity.py b/examples/maxwell/inhom-cavity.py index 80325b978156e63f549f9e199405aca5fbb6828d..4f82e749b571f281c22a016dc7779510d1c82214 100644 --- a/examples/maxwell/inhom-cavity.py +++ b/examples/maxwell/inhom-cavity.py @@ -135,14 +135,14 @@ def main(write_output=True, allow_features=None, flux_type_arg=1, #extra_discr_args.setdefault("debug", []).append("dump_optemplate_stages") from grudge.data import make_tdep_given - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL op = TEMaxwellOperator(epsilon=make_tdep_given(eps_val), mu=make_tdep_given(mu_val), \ flux_type=flux_type_arg, \ - bdry_flux_type=bdry_flux_type_arg, dimensions=2, pec_tag=TAG_ALL) + bdry_flux_type=bdry_flux_type_arg, dimensions=2, pec_tag=BTAG_ALL) # op = TEMaxwellOperator(epsilon=epsilon0, mu=mu0, # flux_type=flux_type_arg, \ - # bdry_flux_type=bdry_flux_type_arg, dimensions=2, pec_tag=TAG_ALL) + # 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(), diff --git a/examples/maxwell/maxwell-2d.py b/examples/maxwell/maxwell-2d.py index 7f44c4dbee2392a1dbb6223b4ae7b17747a25fb5..e0f5909a97bcb912952b0223ca6482108feffc05 100644 --- a/examples/maxwell/maxwell-2d.py +++ b/examples/maxwell/maxwell-2d.py @@ -67,13 +67,13 @@ def main(write_output=True): print("order %d" % order) print("#elements=", len(mesh.elements)) - from grudge.mesh import TAG_ALL, TAG_NONE + from grudge.mesh import BTAG_ALL, BTAG_NONE from grudge.models.em import TMMaxwellOperator from grudge.data import make_tdep_given, TimeIntervalGivenFunction op = TMMaxwellOperator(epsilon, mu, flux_type=1, current=TimeIntervalGivenFunction( make_tdep_given(CurrentSource()), off_time=final_time/10), - absorb_tag=TAG_ALL, pec_tag=TAG_NONE) + absorb_tag=BTAG_ALL, pec_tag=BTAG_NONE) fields = op.assemble_eh(discr=discr) from grudge.timestep import LSRK4TimeStepper diff --git a/examples/maxwell/maxwell-2d/maxwell-3.dat b/examples/maxwell/maxwell-2d/maxwell-3.dat deleted file mode 100644 index e428446bf3a175943f62f70e73317555571f8993..0000000000000000000000000000000000000000 Binary files a/examples/maxwell/maxwell-2d/maxwell-3.dat and /dev/null differ diff --git a/examples/maxwell/maxwell-pml.py b/examples/maxwell/maxwell-pml.py index 59e88b49fee5acb9965bcb7a2d81ba43a0d40eb3..6cd5d5d7fc2093824e4c1b12aa43661a5497613b 100644 --- a/examples/maxwell/maxwell-pml.py +++ b/examples/maxwell/maxwell-pml.py @@ -123,7 +123,7 @@ def main(write_output=True): if write_output: vis = VtkVisualizer(discr, rcon, "em-%d" % order) - from grudge.mesh import TAG_ALL, TAG_NONE + from grudge.mesh import BTAG_ALL, BTAG_NONE from grudge.data import GivenFunction, TimeHarmonicGivenFunction, TimeIntervalGivenFunction from grudge.models.em import MaxwellOperator from grudge.models.pml import \ @@ -133,8 +133,8 @@ def main(write_output=True): op = AbarbanelGottliebPMLTEMaxwellOperator(epsilon, mu, flux_type=1, current=Current(), - pec_tag=TAG_ALL, - absorb_tag=TAG_NONE, + pec_tag=BTAG_ALL, + absorb_tag=BTAG_NONE, add_decay=True ) diff --git a/examples/poisson/helmholtz.py b/examples/poisson/helmholtz.py index d87b581bd6df077930234ed9c982ab914be74dbf..c22c534d476d41479b240c11d9d35f6d03ebb066 100644 --- a/examples/poisson/helmholtz.py +++ b/examples/poisson/helmholtz.py @@ -114,18 +114,18 @@ def main(write_output=True): k = 1 - from grudge.mesh import TAG_NONE, TAG_ALL + from grudge.mesh import BTAG_NONE, BTAG_ALL op = HelmholtzOperator(k, discr.dimensions, #diffusion_tensor=my_diff_tensor(), #dirichlet_tag="dirichlet", #neumann_tag="neumann", - dirichlet_tag=TAG_ALL, - neumann_tag=TAG_NONE, + dirichlet_tag=BTAG_ALL, + neumann_tag=BTAG_NONE, - #dirichlet_tag=TAG_ALL, - #neumann_tag=TAG_NONE, + #dirichlet_tag=BTAG_ALL, + #neumann_tag=BTAG_NONE, #dirichlet_bc=GivenFunction(dirichlet_bc), dirichlet_bc=ConstantGivenFunction(0), diff --git a/examples/poisson/poisson.py b/examples/poisson/poisson.py index c5401a8e1efb5d3b699611e608a71a1c75f1d40f..1b0bbbdd973c17c9ec2e80a9ab39459957f0f025 100644 --- a/examples/poisson/poisson.py +++ b/examples/poisson/poisson.py @@ -86,18 +86,18 @@ def main(write_output=True): from grudge.second_order import \ IPDGSecondDerivative, LDGSecondDerivative, \ StabilizedCentralSecondDerivative - from grudge.mesh import TAG_NONE, TAG_ALL + from grudge.mesh import BTAG_NONE, BTAG_ALL op = PoissonOperator(discr.dimensions, diffusion_tensor=my_diff_tensor(), #dirichlet_tag="dirichlet", #neumann_tag="neumann", - dirichlet_tag=TAG_ALL, - neumann_tag=TAG_NONE, + dirichlet_tag=BTAG_ALL, + neumann_tag=BTAG_NONE, - #dirichlet_tag=TAG_ALL, - #neumann_tag=TAG_NONE, + #dirichlet_tag=BTAG_ALL, + #neumann_tag=BTAG_NONE, dirichlet_bc=GivenFunction(dirichlet_bc), neumann_bc=ConstantGivenFunction(-10), diff --git a/examples/wave/var-propagation-speed.py b/examples/wave/var-propagation-speed.py index 29cf0d8aae167276bc604e4bdbb041d9ffcb265d..3f4b9927c0436896d94e95e78f2d1325ec4a2045 100644 --- a/examples/wave/var-propagation-speed.py +++ b/examples/wave/var-propagation-speed.py @@ -29,13 +29,13 @@ THE SOFTWARE. import numpy as np -from grudge.mesh import TAG_ALL, TAG_NONE +from grudge.mesh import BTAG_ALL, BTAG_NONE def main(write_output=True, - dir_tag=TAG_NONE, - neu_tag=TAG_NONE, - rad_tag=TAG_ALL, + dir_tag=BTAG_NONE, + neu_tag=BTAG_NONE, + rad_tag=BTAG_ALL, flux_type_arg="upwind"): from math import sin, cos, pi, exp, sqrt # noqa @@ -78,7 +78,7 @@ def main(write_output=True, source_width = 1/16 source_omega = 3 - import grudge.optemplate as sym + import grudge.symbolic as sym sym_x = sym.nodes(2) sym_source_center_dist = sym_x - source_center @@ -190,10 +190,10 @@ def test_var_velocity_wave(): for flux_type in ["upwind", "central"]: yield ("dirichlet var-v wave equation with %s flux" % flux_type, mark_long(main), - False, TAG_ALL, TAG_NONE, TAG_NONE, flux_type) + False, BTAG_ALL, BTAG_NONE, TAG_NONE, flux_type) yield ("neumann var-v wave equation", mark_long(main), - False, TAG_NONE, TAG_ALL, TAG_NONE) + False, BTAG_NONE, BTAG_ALL, TAG_NONE) yield ("radiation-bc var-v wave equation", mark_long(main), - False, TAG_NONE, TAG_NONE, TAG_ALL) + False, BTAG_NONE, TAG_NONE, BTAG_ALL) # vim: foldmethod=marker diff --git a/examples/wave/wave-min.py b/examples/wave/wave-min.py index 28b1911088bd2d0aa321ed746acb7b69009a324d..be95db4bb4846b78d02ef7a4a855a364d80bc77c 100644 --- a/examples/wave/wave-min.py +++ b/examples/wave/wave-min.py @@ -54,9 +54,9 @@ def main(write_output=True): * sym.CFunction("exp")( -np.dot(sym_source_center_dist, sym_source_center_dist) / source_width**2)), - dirichlet_tag=TAG_NONE, - neumann_tag=TAG_NONE, - radiation_tag=TAG_ALL, + dirichlet_tag=BTAG_NONE, + neumann_tag=BTAG_NONE, + radiation_tag=BTAG_ALL, flux_type="upwind") from pytools.obj_array import join_fields diff --git a/examples/wave/wave.py b/examples/wave/wave.py index ac68c8d84ee97ac77507a9f8e59a9e18d4d8e6fc..ea0f1001c6b7473a4b17cac6422c24e7686724f3 100644 --- a/examples/wave/wave.py +++ b/examples/wave/wave.py @@ -19,12 +19,12 @@ from __future__ import division from __future__ import absolute_import from __future__ import print_function import numpy as np -from grudge.mesh import TAG_ALL, TAG_NONE +from grudge.mesh import BTAG_ALL, BTAG_NONE from six.moves import range def main(write_output=True, - dir_tag=TAG_NONE, neu_tag=TAG_NONE, rad_tag=TAG_ALL, + dir_tag=BTAG_NONE, neu_tag=TAG_NONE, rad_tag=BTAG_ALL, flux_type_arg="upwind", dtype=np.float64, debug=[]): from math import sin, cos, pi, exp, sqrt # noqa @@ -58,13 +58,13 @@ def main(write_output=True, stepper = LSRK4TimeStepper(dtype=dtype) from grudge.models.wave import StrongWaveOperator - from grudge.mesh import TAG_ALL, TAG_NONE # noqa + from grudge.mesh import BTAG_ALL, BTAG_NONE # noqa source_center = np.array([0.1, 0.22]) source_width = 0.05 source_omega = 3 - import grudge.optemplate as sym + import grudge.symbolic as sym sym_x = sym.nodes(2) sym_source_center_dist = sym_x - source_center @@ -162,7 +162,7 @@ def main(write_output=True, # }}} if __name__ == "__main__": - main(True, TAG_ALL, TAG_NONE, TAG_NONE, "upwind", np.float64, + main(True, BTAG_ALL, BTAG_NONE, TAG_NONE, "upwind", np.float64, debug=["cuda_no_plan", "dump_optemplate_stages"]) @@ -173,19 +173,19 @@ def test_wave(): mark_long = mark_test.long yield ("dirichlet wave equation with SP data", mark_long(main), - False, TAG_ALL, TAG_NONE, TAG_NONE, "upwind", np.float64) + False, BTAG_ALL, BTAG_NONE, TAG_NONE, "upwind", np.float64) yield ("dirichlet wave equation with SP complex data", mark_long(main), - False, TAG_ALL, TAG_NONE, TAG_NONE, "upwind", np.complex64) + False, BTAG_ALL, BTAG_NONE, TAG_NONE, "upwind", np.complex64) yield ("dirichlet wave equation with DP complex data", mark_long(main), - False, TAG_ALL, TAG_NONE, TAG_NONE, "upwind", np.complex128) + False, BTAG_ALL, BTAG_NONE, TAG_NONE, "upwind", np.complex128) for flux_type in ["upwind", "central"]: yield ("dirichlet wave equation with %s flux" % flux_type, mark_long(main), - False, TAG_ALL, TAG_NONE, TAG_NONE, flux_type) + False, BTAG_ALL, BTAG_NONE, TAG_NONE, flux_type) yield ("neumann wave equation", mark_long(main), - False, TAG_NONE, TAG_ALL, TAG_NONE) + False, BTAG_NONE, BTAG_ALL, TAG_NONE) yield ("radiation-bc wave equation", mark_long(main), - False, TAG_NONE, TAG_NONE, TAG_ALL) + False, BTAG_NONE, TAG_NONE, BTAG_ALL) # }}} diff --git a/examples/wave/wiggly.py b/examples/wave/wiggly.py index 489855e99249a1f159843547160bd3660d9208d9..f786074443d2123882bcaecf85972777b6694622 100644 --- a/examples/wave/wiggly.py +++ b/examples/wave/wiggly.py @@ -29,7 +29,7 @@ THE SOFTWARE. import numpy as np -from grudge.mesh import TAG_ALL, TAG_NONE # noqa +from grudge.mesh import BTAG_ALL, BTAG_NONE # noqa def main(write_output=True, @@ -63,7 +63,7 @@ def main(write_output=True, source_width = 0.05 source_omega = 3 - import grudge.optemplate as sym + import grudge.symbolic as sym sym_x = sym.nodes(2) sym_source_center_dist = sym_x - source_center @@ -75,8 +75,8 @@ def main(write_output=True, -np.dot(sym_source_center_dist, sym_source_center_dist) / source_width**2), dirichlet_tag="boundary", - neumann_tag=TAG_NONE, - radiation_tag=TAG_NONE, + neumann_tag=BTAG_NONE, + radiation_tag=BTAG_NONE, flux_type=flux_type_arg ) diff --git a/grudge/models/advection.py b/grudge/models/advection.py index c1546b88101f94df51d416cbedac543b8833be40..7f0813f155d3d8d68a92ffad1cc60c36bbf569d0 100644 --- a/grudge/models/advection.py +++ b/grudge/models/advection.py @@ -132,7 +132,7 @@ class StrongAdvectionOperator(AdvectionOperatorBase): return u.int * numpy.dot(normal, self.v) - self.weak_flux() def op_template(self): - from grudge.optemplate import Field, BoundaryPair, \ + from grudge.symbolic import Field, BoundaryPair, \ get_flux_operator, make_nabla, InverseMassOperator u = Field("u") @@ -157,7 +157,7 @@ class WeakAdvectionOperator(AdvectionOperatorBase): return self.weak_flux() def op_template(self): - from grudge.optemplate import ( + from grudge.symbolic import ( Field, BoundaryPair, get_flux_operator, @@ -263,9 +263,9 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): # }}} def bind_characteristic_velocity(self, discr): - from grudge.optemplate.operators import ( + from grudge.symbolic.operators import ( ElementwiseMaxOperator) - from grudge.optemplate import make_sym_vector + from grudge.symbolic import make_sym_vector velocity_vec = make_sym_vector("v", self.dimensions) velocity = ElementwiseMaxOperator()( numpy.dot(velocity_vec, velocity_vec)**0.5) @@ -279,13 +279,13 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): def op_template(self, with_sensor=False): # {{{ operator preliminaries ------------------------------------------ - from grudge.optemplate import (Field, BoundaryPair, get_flux_operator, + from grudge.symbolic import (Field, BoundaryPair, get_flux_operator, make_stiffness_t, InverseMassOperator, make_sym_vector, ElementwiseMaxOperator, BoundarizeOperator) - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse - from grudge.optemplate.operators import ( + from grudge.symbolic.operators import ( QuadratureGridUpsampler, QuadratureInteriorFacesGridUpsampler) @@ -308,10 +308,10 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): # {{{ boundary conditions --------------------------------------------- - from grudge.mesh import TAG_ALL - bc_c = to_quad(BoundarizeOperator(TAG_ALL)(c)) + from grudge.mesh import BTAG_ALL + bc_c = to_quad(BoundarizeOperator(BTAG_ALL)(c)) bc_u = to_quad(Field("bc_u")) - bc_v = to_quad(BoundarizeOperator(TAG_ALL)(v)) + bc_v = to_quad(BoundarizeOperator(BTAG_ALL)(v)) if self.bc_u_f is "None": bc_w = join_fields(0, bc_v, bc_c) @@ -365,15 +365,15 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): return m_inv(numpy.dot(minv_st, cse(quad_v*quad_u)) - (flux_op(quad_face_w) - + flux_op(BoundaryPair(quad_face_w, bc_w, TAG_ALL)))) \ + + flux_op(BoundaryPair(quad_face_w, bc_w, BTAG_ALL)))) \ + diffusion_part def bind(self, discr, sensor=None): compiled_op_template = discr.compile( self.op_template(with_sensor=sensor is not None)) - from grudge.mesh import check_bc_coverage, TAG_ALL - check_bc_coverage(discr.mesh, [TAG_ALL]) + from grudge.mesh import check_bc_coverage, BTAG_ALL + check_bc_coverage(discr.mesh, [BTAG_ALL]) def rhs(t, u): kwargs = {} @@ -382,7 +382,7 @@ class VariableCoefficientAdvectionOperator(HyperbolicOperator): if self.bc_u_f is not "None": kwargs["bc_u"] = \ - self.bc_u_f.boundary_interpolant(t, discr, tag=TAG_ALL) + self.bc_u_f.boundary_interpolant(t, discr, tag=BTAG_ALL) return compiled_op_template( u=u, diff --git a/grudge/models/burgers.py b/grudge/models/burgers.py index ecf169b2e4f649b93c844c0bae530da4e4cafc30..70fa2975f296fd29a240acf92582ee6c767fa24b 100644 --- a/grudge/models/burgers.py +++ b/grudge/models/burgers.py @@ -46,12 +46,12 @@ class BurgersOperator(HyperbolicOperator): self.viscosity_scheme = viscosity_scheme def characteristic_velocity_optemplate(self, field): - from grudge.optemplate.operators import ( + from grudge.symbolic.operators import ( ElementwiseMaxOperator) return ElementwiseMaxOperator()(field**2)**0.5 def bind_characteristic_velocity(self, discr): - from grudge.optemplate import Field + from grudge.symbolic import Field compiled = discr.compile( self.characteristic_velocity_optemplate( Field("u"))) @@ -62,7 +62,7 @@ class BurgersOperator(HyperbolicOperator): return do def op_template(self, with_sensor): - from grudge.optemplate import ( + from grudge.symbolic import ( Field, make_stiffness_t, make_nabla, @@ -70,7 +70,7 @@ class BurgersOperator(HyperbolicOperator): ElementwiseMaxOperator, get_flux_operator) - from grudge.optemplate.operators import ( + from grudge.symbolic.operators import ( QuadratureGridUpsampler, QuadratureInteriorFacesGridUpsampler) diff --git a/grudge/models/diffusion.py b/grudge/models/diffusion.py index eb38f77d138a2fcab7b88ad009efd2b0a772e2ae..fb92a7fcccff22be194bc88186b58ac131f3c7f4 100644 --- a/grudge/models/diffusion.py +++ b/grudge/models/diffusion.py @@ -101,9 +101,9 @@ class BoundDiffusionOperator(grudge.iterative.OperatorBase): # Check whether use of Poincaré mean-value method is required. # (for pure Neumann or pure periodic) - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL self.poincare_mean_value_hack = ( - len(self.discr.get_boundary(TAG_ALL).nodes) + len(self.discr.get_boundary(BTAG_ALL).nodes) == len(self.discr.get_boundary(diffusion_op.neumann_tag).nodes)) def __call__(self, t, u): diff --git a/grudge/models/em.py b/grudge/models/em.py index 3575e4253a40f5034c4b793c8ebbd5c216e9036b..697a388cb549074cf562943425c293776cdff4ad 100644 --- a/grudge/models/em.py +++ b/grudge/models/em.py @@ -31,7 +31,7 @@ from pytools import memoize_method import grudge.mesh from grudge.models import HyperbolicOperator -from grudge.optemplate.primitives import make_common_subexpression as cse +from grudge.symbolic.primitives import make_common_subexpression as cse from grudge.tools import make_obj_array # TODO: Check PML @@ -204,7 +204,7 @@ class MaxwellOperator(HyperbolicOperator): def h_curl(field): return self.space_cross_h(nabla, field) - from grudge.optemplate import make_nabla + from grudge.symbolic import make_nabla from grudge.tools import join_fields nabla = make_nabla(self.dimensions) @@ -220,7 +220,7 @@ class MaxwellOperator(HyperbolicOperator): from grudge.tools import count_subset fld_cnt = count_subset(self.get_eh_subset()) if w is None: - from grudge.optemplate import make_sym_vector + from grudge.symbolic import make_sym_vector w = make_sym_vector("w", fld_cnt) return w @@ -230,7 +230,7 @@ class MaxwellOperator(HyperbolicOperator): e, h = self.split_eh(self.field_placeholder(w)) from grudge.tools import join_fields - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator pec_e = BoundarizeOperator(self.pec_tag)(e) pec_h = BoundarizeOperator(self.pec_tag)(h) @@ -241,7 +241,7 @@ class MaxwellOperator(HyperbolicOperator): e, h = self.split_eh(self.field_placeholder(w)) from grudge.tools import join_fields - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator pmc_e = BoundarizeOperator(self.pmc_tag)(e) pmc_h = BoundarizeOperator(self.pmc_tag)(h) @@ -252,10 +252,10 @@ class MaxwellOperator(HyperbolicOperator): absorbing boundary conditions. """ - from grudge.optemplate import normal + from grudge.symbolic import normal absorb_normal = normal(self.absorb_tag, self.dimensions) - from grudge.optemplate import BoundarizeOperator, Field + from grudge.symbolic import BoundarizeOperator, Field from grudge.tools import join_fields e, h = self.split_eh(self.field_placeholder(w)) @@ -326,7 +326,7 @@ class MaxwellOperator(HyperbolicOperator): flux_w = join_fields(epsilon, mu, w) - from grudge.optemplate import BoundaryPair, \ + from grudge.symbolic import BoundaryPair, \ InverseMassOperator, get_flux_operator flux_op = get_flux_operator(self.flux(self.flux_type)) @@ -356,7 +356,7 @@ class MaxwellOperator(HyperbolicOperator): if self.fixed_material: return bc else: - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator return join_fields( cse(BoundarizeOperator(tag)(epsilon)), cse(BoundarizeOperator(tag)(mu)), @@ -473,7 +473,7 @@ class MaxwellOperator(HyperbolicOperator): if self.fixed_material: return 1/sqrt(self.epsilon*self.mu) # a number else: - import grudge.optemplate as sym + import grudge.symbolic as sym return sym.NodalMax()(1/sym.CFunction("sqrt")(self.epsilon*self.mu)) def max_eigenvalue(self, t, fields=None, discr=None, context={}): diff --git a/grudge/models/gas_dynamics/__init__.py b/grudge/models/gas_dynamics/__init__.py index c0caad51e17577494778bb1c70773a2a9fb58bbc..278f5ce3b07759675fa095f96ec2d7d70f15d00f 100644 --- a/grudge/models/gas_dynamics/__init__.py +++ b/grudge/models/gas_dynamics/__init__.py @@ -41,14 +41,14 @@ from grudge.second_order import ( StabilizedCentralSecondDerivative, CentralSecondDerivative, IPDGSecondDerivative) -from grudge.optemplate.primitives import make_common_subexpression as cse +from grudge.symbolic.primitives import make_common_subexpression as cse from pytools import memoize_method -from grudge.optemplate.tools import make_sym_vector +from grudge.symbolic.tools import make_sym_vector from pytools.obj_array import make_obj_array, join_fields AXES = ["x", "y", "z", "w"] -from grudge.optemplate.operators import ( +from grudge.symbolic.operators import ( QuadratureGridUpsampler, QuadratureInteriorFacesGridUpsampler) @@ -224,7 +224,7 @@ class GasDynamicsOperator(TimeDependentOperator): @memoize_method def sensor(self): - from grudge.optemplate.primitives import Field + from grudge.symbolic.primitives import Field sensor = Field("sensor") def rho(self, q): @@ -298,7 +298,7 @@ class GasDynamicsOperator(TimeDependentOperator): def primitive_to_conservative(self, prims, use_cses=True): if not use_cses: - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse else: def cse(x, name): return x @@ -314,7 +314,7 @@ class GasDynamicsOperator(TimeDependentOperator): def conservative_to_primitive(self, q, use_cses=True): if use_cses: - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse else: def cse(x, name): return x @@ -324,9 +324,9 @@ class GasDynamicsOperator(TimeDependentOperator): self.u(q)) def characteristic_velocity_optemplate(self, state): - from grudge.optemplate.operators import ElementwiseMaxOperator + from grudge.symbolic.operators import ElementwiseMaxOperator - from grudge.optemplate.primitives import CFunction + from grudge.symbolic.primitives import CFunction sqrt = CFunction("sqrt") sound_speed = cse(sqrt( @@ -498,7 +498,7 @@ class GasDynamicsOperator(TimeDependentOperator): c0 = (self.equation_of_state.gamma * p0 / rho0)**0.5 - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator bdrize_op = BoundarizeOperator(tag) class SingleBCInfo(Record): @@ -516,7 +516,7 @@ class GasDynamicsOperator(TimeDependentOperator): - p0, "dpm")) def outflow_state(self, state): - from grudge.optemplate import make_normal + from grudge.symbolic import make_normal normal = make_normal(self.outflow_tag, self.dimensions) bc = self.make_bc_info("bc_q_out", self.outflow_tag, state) @@ -552,13 +552,13 @@ class GasDynamicsOperator(TimeDependentOperator): + normal*numpy.dot(normal, bc.dumvec)/2 + bc.dpm*normal/(2*bc.c0*bc.rho0), "bc_u_"+name)) def inflow_state(self, state): - from grudge.optemplate import make_normal + from grudge.symbolic import make_normal normal = make_normal(self.inflow_tag, self.dimensions) bc = self.make_bc_info("bc_q_in", self.inflow_tag, state) return self.inflow_state_inner(normal, bc, "inflow") def noslip_state(self, state): - from grudge.optemplate import make_normal + from grudge.symbolic import make_normal state0 = join_fields( make_sym_vector("bc_q_noslip", 2), [0]*self.dimensions) @@ -567,13 +567,13 @@ class GasDynamicsOperator(TimeDependentOperator): return self.inflow_state_inner(normal, bc, "noslip") def wall_state(self, state): - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator bc = BoundarizeOperator(self.wall_tag)(state) wall_rho = self.rho(bc) wall_e = self.e(bc) # <3 eve wall_rho_u = self.rho_u(bc) - from grudge.optemplate import make_normal + from grudge.symbolic import make_normal normal = make_normal(self.wall_tag, self.dimensions) return join_fields( @@ -596,7 +596,7 @@ class GasDynamicsOperator(TimeDependentOperator): def get_conservative_boundary_conditions(self): state = self.state() - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator return { self.supersonic_inflow_tag: make_sym_vector("bc_q_supersonic_in", self.dimensions+2), @@ -614,7 +614,7 @@ class GasDynamicsOperator(TimeDependentOperator): @memoize_method def _normalize_expr(self, expr): """Normalize expressions for use as hash keys.""" - from grudge.optemplate.mappers import ( + from grudge.symbolic.mappers import ( QuadratureUpsamplerRemover, CSERemover) @@ -652,7 +652,7 @@ class GasDynamicsOperator(TimeDependentOperator): # 'cbstate' is the boundary state in conservative variables. - from grudge.optemplate.mappers import QuadratureUpsamplerRemover + from grudge.symbolic.mappers import QuadratureUpsamplerRemover expr = QuadratureUpsamplerRemover({}, do_warn=False)(expr) def subst_func(expr): @@ -664,11 +664,11 @@ class GasDynamicsOperator(TimeDependentOperator): return cbstate[expr.index] elif isinstance(expr, Variable) and expr.name =="sensor": - from grudge.optemplate import BoundarizeOperator + from grudge.symbolic import BoundarizeOperator result = BoundarizeOperator(tag)(self.sensor()) return cse(to_bdry_quad(result), "bdry_sensor") - from grudge.optemplate import SubstitutionMapper + from grudge.symbolic import SubstitutionMapper return SubstitutionMapper(subst_func)(expr) # }}} @@ -743,7 +743,7 @@ class GasDynamicsOperator(TimeDependentOperator): volq_flux = self.flux(self.volq_state()) faceq_flux = self.flux(self.faceq_state()) - from grudge.optemplate.primitives import CFunction + from grudge.symbolic.primitives import CFunction sqrt = CFunction("sqrt") speed = self.characteristic_velocity_optemplate(self.state()) @@ -754,9 +754,9 @@ class GasDynamicsOperator(TimeDependentOperator): # {{{ operator assembly ----------------------------------------------- from grudge.flux.tools import make_lax_friedrichs_flux - from grudge.optemplate.operators import InverseMassOperator + from grudge.symbolic.operators import InverseMassOperator - from grudge.optemplate.tools import make_stiffness_t + from grudge.symbolic.tools import make_stiffness_t primitive_bcs_as_quad_conservative = dict( (tag, self.primitive_to_conservative(to_bdry_quad(bc))) @@ -891,7 +891,7 @@ class SlopeLimiter1NEuler: self.dimensions=dimensions self.op=op - from grudge.optemplate.operators import AveragingOperator + from grudge.symbolic.operators import AveragingOperator self.get_average = AveragingOperator().bind(discr) def __call__(self, fields): diff --git a/grudge/models/gas_dynamics/lbm.py b/grudge/models/gas_dynamics/lbm.py index 41b09559644021d3641a5c5b0d814b71c376fae4..5921f99b652694b0f6e7d72c9e45bef1f2f66d65 100644 --- a/grudge/models/gas_dynamics/lbm.py +++ b/grudge/models/gas_dynamics/lbm.py @@ -136,7 +136,7 @@ class LatticeBoltzmannOperator(HyperbolicOperator): raise ValueError("invalid flux type") def get_advection_op(self, q, velocity): - from grudge.optemplate import ( + from grudge.symbolic import ( BoundaryPair, get_flux_operator, make_stiffness_t, @@ -149,7 +149,7 @@ class LatticeBoltzmannOperator(HyperbolicOperator): np.dot(velocity, stiff_t*q) - flux_op(q)) def f_bar(self): - from grudge.optemplate import make_sym_vector + from grudge.symbolic import make_sym_vector return make_sym_vector("f_bar", len(self.method)) def rho(self, f_bar): @@ -168,7 +168,7 @@ class LatticeBoltzmannOperator(HyperbolicOperator): zip(self.method.direction_vectors, f_bar)]) def collision_update(self, f_bar): - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse rho = cse(self.rho(f_bar), "rho") rho_u = self.rho_u(f_bar) u = cse(rho_u/rho, "u") @@ -183,8 +183,8 @@ class LatticeBoltzmannOperator(HyperbolicOperator): compiled_op_template = discr.compile( self.stream_rhs(self.f_bar())) - #from grudge.mesh import check_bc_coverage, TAG_ALL - #check_bc_coverage(discr.mesh, [TAG_ALL]) + #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) @@ -194,7 +194,7 @@ class LatticeBoltzmannOperator(HyperbolicOperator): def bind(self, discr, what): f_bar_sym = self.f_bar() - from grudge.optemplate.mappers.type_inference import ( + from grudge.symbolic.mappers.type_inference import ( type_info, NodalRepresentation) type_hints = dict( diff --git a/grudge/models/nd_calculus.py b/grudge/models/nd_calculus.py index 746cf26933c571aeb10e05c58ef39e3da746a17e..eb8281b50500de266b0bd6f6deffa49b39e3d68f 100644 --- a/grudge/models/nd_calculus.py +++ b/grudge/models/nd_calculus.py @@ -46,8 +46,8 @@ class GradientOperator(Operator): return u.int*normal - u.avg*normal def op_template(self): - from grudge.mesh import TAG_ALL - from grudge.optemplate import Field, BoundaryPair, \ + from grudge.mesh import BTAG_ALL + from grudge.symbolic import Field, BoundaryPair, \ make_nabla, InverseMassOperator, get_flux_operator u = Field("u") @@ -58,16 +58,16 @@ class GradientOperator(Operator): return nabla*u - InverseMassOperator()( flux_op(u) + - flux_op(BoundaryPair(u, bc, TAG_ALL))) + flux_op(BoundaryPair(u, bc, BTAG_ALL))) def bind(self, discr): compiled_op_template = discr.compile(self.op_template()) def op(u): - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL return compiled_op_template(u=u, - bc=discr.boundarize_volume_field(u, TAG_ALL)) + bc=discr.boundarize_volume_field(u, BTAG_ALL)) return op @@ -105,8 +105,8 @@ class DivergenceOperator(Operator): return flux def op_template(self): - from grudge.mesh import TAG_ALL - from grudge.optemplate import make_sym_vector, BoundaryPair, \ + from grudge.mesh import BTAG_ALL + from grudge.symbolic import make_sym_vector, BoundaryPair, \ get_flux_operator, make_nabla, InverseMassOperator nabla = make_nabla(self.dimensions) @@ -126,14 +126,14 @@ class DivergenceOperator(Operator): return local_op_result - m_inv( flux_op(v) + - flux_op(BoundaryPair(v, bc, TAG_ALL))) + flux_op(BoundaryPair(v, bc, BTAG_ALL))) def bind(self, discr): compiled_op_template = discr.compile(self.op_template()) def op(v): - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL return compiled_op_template(v=v, - bc=discr.boundarize_volume_field(v, TAG_ALL)) + bc=discr.boundarize_volume_field(v, BTAG_ALL)) return op diff --git a/grudge/models/pml.py b/grudge/models/pml.py index 29c6312fd49d3c35f31f5416e252fcd1b56da5e4..7472ed8eb6146aa66823ef5aece1389f6b3ac224 100644 --- a/grudge/models/pml.py +++ b/grudge/models/pml.py @@ -87,7 +87,7 @@ class AbarbanelGottliebPMLMaxwellOperator(MaxwellOperator): result[numpy.array(subset, dtype=bool)] = v return result - from grudge.optemplate import make_sym_vector + from grudge.symbolic import make_sym_vector sig = pad_vec( make_sym_vector("sigma", self.dimensions), dim_subset) @@ -133,7 +133,7 @@ class AbarbanelGottliebPMLMaxwellOperator(MaxwellOperator): from grudge.tools import count_subset fld_cnt = count_subset(self.get_eh_subset()) if w is None: - from grudge.optemplate import make_sym_vector + from grudge.symbolic import make_sym_vector w = make_sym_vector("w", fld_cnt+2*self.dimensions) from grudge.tools import join_fields diff --git a/grudge/models/poisson.py b/grudge/models/poisson.py index f8b8b49b204127de294d71ff743d3381cc90663b..d507ff3fe1d02d8e743c84db62483381610a5245 100644 --- a/grudge/models/poisson.py +++ b/grudge/models/poisson.py @@ -48,7 +48,7 @@ class LaplacianOperatorBase(object): :class:`grudge.models.diffusion.DiffusionOperator` needs this. """ - from grudge.optemplate import Field, make_sym_vector + from grudge.symbolic import Field, make_sym_vector from grudge.second_order import SecondDerivativeTarget if u is None: @@ -167,9 +167,9 @@ class BoundPoissonOperator(grudge.iterative.OperatorBase): # Check whether use of Poincaré mean-value method is required. # (for pure Neumann or pure periodic) - from grudge.mesh import TAG_ALL + from grudge.mesh import BTAG_ALL self.poincare_mean_value_hack = ( - len(self.discr.get_boundary(TAG_ALL).nodes) + len(self.discr.get_boundary(BTAG_ALL).nodes) == len(self.discr.get_boundary(poisson_op.neumann_tag).nodes)) @property @@ -236,7 +236,7 @@ class BoundPoissonOperator(grudge.iterative.OperatorBase): """ pop = self.poisson_op - from grudge.optemplate import MassOperator + from grudge.symbolic import MassOperator return (MassOperator().apply(self.discr, rhs) - self.compiled_bc_op( u=self.discr.volume_zeros(), @@ -252,7 +252,7 @@ class HelmholtzOperator(PoissonOperator): self.k = k def op_template(self, apply_minv, u=None, dir_bc=None, neu_bc=None): - from grudge.optemplate import Field + from grudge.symbolic import Field if u is None: u = Field("u") @@ -262,5 +262,5 @@ class HelmholtzOperator(PoissonOperator): if apply_minv: return result + self.k**2 * u else: - from grudge.optemplate import MassOperator + from grudge.symbolic import MassOperator return result + self.k**2 * MassOperator()(u) diff --git a/grudge/models/second_order.py b/grudge/models/second_order.py index dfdb4d4fb7603b5d720b2c014fe0ea136a038163..de8404e51654054a53837d9d2336c5e3e18aeaea 100644 --- a/grudge/models/second_order.py +++ b/grudge/models/second_order.py @@ -27,20 +27,20 @@ THE SOFTWARE. import numpy as np -import grudge.optemplate +import grudge.symbolic # {{{ stabilization term generator -class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): +class StabilizationTermGenerator(grudge.symbolic.IdentityMapper): def __init__(self, flux_args): - grudge.optemplate.IdentityMapper.__init__(self) + grudge.symbolic.IdentityMapper.__init__(self) self.flux_args = flux_args self.flux_arg_lookup = dict( (flux_arg, i) for i, flux_arg in enumerate(flux_args)) def get_flux_arg_idx(self, expr, quad_above): - from grudge.optemplate.mappers import QuadratureDetector + from grudge.symbolic.mappers import QuadratureDetector quad_below = QuadratureDetector()(expr) if quad_above: @@ -51,7 +51,7 @@ class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): # now two layers of quadrature operators. We need to change the # inner layer to be the only layer. - from grudge.optemplate.mappers import QuadratureUpsamplerChanger + from grudge.symbolic.mappers import QuadratureUpsamplerChanger expr = QuadratureUpsamplerChanger(quad_above[0])(expr) else: # Only the part of the expression above the differentiation @@ -62,7 +62,7 @@ class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): # Only the part of the expression below the differentiation # operator had quadrature--the stuff above doesn't want it. # Get rid of it. - from grudge.optemplate.mappers import QuadratureUpsamplerRemover + from grudge.symbolic.mappers import QuadratureUpsamplerRemover expr = QuadratureUpsamplerRemover({}, do_warn=False)(expr) else: # No quadrature, no headaches. @@ -77,7 +77,7 @@ class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): return flux_arg_idx def map_operator_binding(self, expr, quad_above=[]): - from grudge.optemplate.operators import ( + from grudge.symbolic.operators import ( DiffOperatorBase, FluxOperatorBase, InverseMassOperator, QuadratureInteriorFacesGridUpsampler) @@ -85,7 +85,7 @@ class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): if isinstance(expr.op, DiffOperatorBase): flux_arg_idx = self.get_flux_arg_idx(expr.field, quad_above=quad_above) - from grudge.optemplate import \ + from grudge.symbolic import \ WeakFormDiffOperatorBase, \ StrongFormDiffOperatorBase if isinstance(expr.op, WeakFormDiffOperatorBase): @@ -112,7 +112,7 @@ class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): "when generating stabilization term") return self.rec(expr.field, [expr.op]) else: - from grudge.optemplate.tools import pretty + from grudge.symbolic.tools import pretty raise ValueError("stabilization term generator doesn't know " "what to do with '%s'" % pretty(expr)) @@ -135,15 +135,15 @@ class StabilizationTermGenerator(grudge.optemplate.IdentityMapper): # {{{ neumann bc generator -class NeumannBCGenerator(grudge.optemplate.IdentityMapper): +class NeumannBCGenerator(grudge.symbolic.IdentityMapper): def __init__(self, tag, bc): - grudge.optemplate.IdentityMapper.__init__(self) + grudge.symbolic.IdentityMapper.__init__(self) self.tag = tag self.bc = bc def map_operator_binding(self, expr): - if isinstance(expr.op, grudge.optemplate.DiffOperatorBase): - from grudge.optemplate import \ + if isinstance(expr.op, grudge.symbolic.DiffOperatorBase): + from grudge.symbolic import \ WeakFormDiffOperatorBase, \ StrongFormDiffOperatorBase if isinstance(expr.op, WeakFormDiffOperatorBase): @@ -154,13 +154,13 @@ class NeumannBCGenerator(grudge.optemplate.IdentityMapper): raise RuntimeError("unknown type of differentiation " "operator encountered by stab term generator") - from grudge.optemplate import BoundaryNormalComponent + from grudge.symbolic import BoundaryNormalComponent return (self.bc * factor * BoundaryNormalComponent(self.tag, expr.op.xyz_axis)) - elif isinstance(expr.op, grudge.optemplate.FluxOperatorBase): + elif isinstance(expr.op, grudge.symbolic.FluxOperatorBase): return 0 - elif isinstance(expr.op, grudge.optemplate.InverseMassOperator): + elif isinstance(expr.op, grudge.symbolic.InverseMassOperator): return self.rec(expr.field) else: raise ValueError("neumann normal direction generator doesn't know " @@ -169,10 +169,10 @@ class NeumannBCGenerator(grudge.optemplate.IdentityMapper): # }}} -class IPDGDerivativeGenerator(grudge.optemplate.IdentityMapper): +class IPDGDerivativeGenerator(grudge.symbolic.IdentityMapper): def map_operator_binding(self, expr): - if isinstance(expr.op, grudge.optemplate.DiffOperatorBase): - from grudge.optemplate import ( + if isinstance(expr.op, grudge.symbolic.DiffOperatorBase): + from grudge.symbolic import ( WeakFormDiffOperatorBase, StrongFormDiffOperatorBase) @@ -184,19 +184,19 @@ class IPDGDerivativeGenerator(grudge.optemplate.IdentityMapper): raise RuntimeError("unknown type of differentiation " "operator encountered by stab term generator") - from grudge.optemplate import DifferentiationOperator + from grudge.symbolic import DifferentiationOperator return factor*DifferentiationOperator(expr.op.xyz_axis)(expr.field) - elif isinstance(expr.op, grudge.optemplate.FluxOperatorBase): + elif isinstance(expr.op, grudge.symbolic.FluxOperatorBase): return 0 - elif isinstance(expr.op, grudge.optemplate.InverseMassOperator): + elif isinstance(expr.op, grudge.symbolic.InverseMassOperator): return self.rec(expr.field) elif isinstance(expr.op, - grudge.optemplate.QuadratureInteriorFacesGridUpsampler): - return grudge.optemplate.IdentityMapper.map_operator_binding( + grudge.symbolic.QuadratureInteriorFacesGridUpsampler): + return grudge.symbolic.IdentityMapper.map_operator_binding( self, expr) else: - from grudge.optemplate.tools import pretty + from grudge.symbolic.tools import pretty raise ValueError("IPDG derivative generator doesn't know " "what to do with '%s'" % pretty(expr)) @@ -275,10 +275,10 @@ class SecondDerivativeTarget(object): def _local_nabla(self): if self.strong_form: - from grudge.optemplate import make_stiffness + from grudge.symbolic import make_stiffness return make_stiffness(self.dimensions) else: - from grudge.optemplate import make_stiffness_t + from grudge.symbolic import make_stiffness_t return make_stiffness_t(self.dimensions) def add_derivative(self, operand=None): @@ -289,12 +289,12 @@ class SecondDerivativeTarget(object): self.apply_diff(self._local_nabla(), operand)) def add_inner_fluxes(self, flux, expr): - from grudge.optemplate import get_flux_operator + from grudge.symbolic import get_flux_operator self.inner_fluxes = self.inner_fluxes \ + get_flux_operator(self.strong_neg*flux)(expr) def add_boundary_flux(self, flux, volume_expr, bdry_expr, tag): - from grudge.optemplate import BoundaryPair, get_flux_operator + from grudge.symbolic import BoundaryPair, get_flux_operator self.boundary_fluxes = self.boundary_fluxes + \ get_flux_operator(self.strong_neg*flux)(BoundaryPair( volume_expr, bdry_expr, tag)) @@ -309,8 +309,8 @@ class SecondDerivativeTarget(object): @property def minv_all(self): - from grudge.optemplate.primitives import make_common_subexpression as cse - from grudge.optemplate.operators import InverseMassOperator + from grudge.symbolic.primitives import make_common_subexpression as cse + from grudge.symbolic.operators import InverseMassOperator return (cse(InverseMassOperator()(self.local_derivatives), "grad_loc") + cse(InverseMassOperator()(self.fluxes), "grad_flux")) @@ -395,7 +395,7 @@ class LDGSecondDerivative(SecondDerivativeBase): return np.array([self.beta_value]*tgt.dimensions, dtype=np.float64) def grad_interior_flux(self, tgt, u): - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse n_times = tgt.normal_times_flux v_times = tgt.vec_times @@ -409,7 +409,7 @@ class LDGSecondDerivative(SecondDerivativeBase): *volume_expr* will be None to query the Neumann condition. """ - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse from grudge.flux import FluxVectorPlaceholder, PenaltyTerm n_times = tgt.normal_times_flux @@ -459,7 +459,7 @@ class IPDGSecondDerivative(SecondDerivativeBase): self.stab_coefficient = stab_coefficient def grad_interior_flux(self, tgt, u): - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse n_times = tgt.normal_times_flux return n_times(cse(u.avg, "u_avg")) @@ -469,7 +469,7 @@ class IPDGSecondDerivative(SecondDerivativeBase): *volume_expr* will be None to query the Neumann condition. """ - from grudge.optemplate.primitives import make_common_subexpression as cse + from grudge.symbolic.primitives import make_common_subexpression as cse from grudge.flux import FluxVectorPlaceholder, PenaltyTerm n_times = tgt.normal_times_flux diff --git a/grudge/models/wave.py b/grudge/models/wave.py index f483e9214d0e4ba3f5e5468cec3acb268a35eae1..67767565449e333bd15372362bd772fa548fe76d 100644 --- a/grudge/models/wave.py +++ b/grudge/models/wave.py @@ -109,7 +109,7 @@ class StrongWaveOperator(HyperbolicOperator): return -self.c*flux_strong def op_template(self): - from grudge.optemplate import \ + from grudge.symbolic import \ make_sym_vector, \ BoundaryPair, \ get_flux_operator, \ @@ -127,7 +127,7 @@ class StrongWaveOperator(HyperbolicOperator): from grudge.tools import join_fields # dirichlet BCs ------------------------------------------------------- - from grudge.optemplate import normal, Field + from grudge.symbolic import normal, Field dir_u = BoundarizeOperator(self.dirichlet_tag) * u dir_v = BoundarizeOperator(self.dirichlet_tag) * v @@ -276,7 +276,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): # }}} def bind_characteristic_velocity(self, discr): - from grudge.optemplate.operators import ElementwiseMaxOperator + from grudge.symbolic.operators import ElementwiseMaxOperator compiled = discr.compile(ElementwiseMaxOperator()(self.c)) @@ -286,7 +286,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): return do def op_template(self, with_sensor=False): - from grudge.optemplate import \ + from grudge.symbolic import \ Field, \ make_sym_vector, \ BoundaryPair, \ @@ -322,7 +322,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): neu_bc = join_fields(neu_c, neu_u, -neu_v) # Radiation - from grudge.optemplate import make_normal + from grudge.symbolic import make_normal rad_normal = make_normal(self.radiation_tag, d) rad_c = BoundarizeOperator(self.radiation_tag) * self.c @@ -415,7 +415,7 @@ class VariableVelocityStrongWaveOperator(HyperbolicOperator): return rhs def max_eigenvalue_expr(self): - import grudge.optemplate as sym + import grudge.symbolic as sym return sym.NodalMax()(sym.CFunction("fabs")(self.c)) # }}} diff --git a/grudge/symbolic/__init__.py b/grudge/symbolic/__init__.py index 7ffc8db5f281009f3e0faf01f4fcba766706923b..900214e18a0fb1c79b5fe0f445163c18f71151ac 100644 --- a/grudge/symbolic/__init__.py +++ b/grudge/symbolic/__init__.py @@ -26,7 +26,7 @@ THE SOFTWARE. """ -from grudge.optemplate.primitives import * # noqa -from grudge.optemplate.operators import * # noqa -from grudge.optemplate.mappers import * # noqa -from grudge.optemplate.tools import * # noqa +from grudge.symbolic.primitives import * # noqa +from grudge.symbolic.operators import * # noqa +from grudge.symbolic.mappers import * # noqa +from grudge.symbolic.tools import * # noqa diff --git a/grudge/symbolic/compiler.py b/grudge/symbolic/compiler.py index 76486064e31fa628c1f7d4c4d945a3149a5625c9..c1375e220a1b3254e82f779784af8d9a1c8857ab 100644 --- a/grudge/symbolic/compiler.py +++ b/grudge/symbolic/compiler.py @@ -31,7 +31,7 @@ THE SOFTWARE. from pytools import Record, memoize_method -from grudge.optemplate import IdentityMapper +from grudge.symbolic import IdentityMapper # {{{ instructions @@ -76,7 +76,7 @@ class Assign(Instruction): @memoize_method def flop_count(self): - from grudge.optemplate import FlopCounter + from grudge.symbolic import FlopCounter return sum(FlopCounter()(expr) for expr in self.exprs) def get_assignees(self): @@ -138,14 +138,14 @@ class FluxBatchAssign(Instruction): :ivar names: :ivar expressions: - A list of :class:`grudge.optemplate.primitives.OperatorBinding` + A list of :class:`grudge.symbolic.primitives.OperatorBinding` instances bound to flux operators. .. note :: All operators in :attr:`expressions` are guaranteed to yield the same operator from - :meth:`grudge.optemplate.operators.FluxOperatorBase.repr_op`. + :meth:`grudge.symbolic.operators.FluxOperatorBase.repr_op`. :ivar repr_op: The `repr_op` on which all operators agree. """ @@ -156,7 +156,7 @@ class FluxBatchAssign(Instruction): def __str__(self): from grudge.flux import PrettyFluxStringifyMapper as PFSM flux_strifier = PFSM() - from grudge.optemplate import StringifyMapper as OSM + from grudge.symbolic import StringifyMapper as OSM op_strifier = OSM(flux_stringify_mapper=flux_strifier) from pymbolic.mapper.stringifier import PREC_NONE @@ -187,7 +187,7 @@ class DiffBatchAssign(Instruction): .. note :: All operators here are guaranteed to satisfy - :meth:`grudge.optemplate.operators.DiffOperatorBase. + :meth:`grudge.symbolic.operators.DiffOperatorBase. equal_except_for_axis`. :ivar field: @@ -379,7 +379,7 @@ class Code(object): # {{{ make sure results do not get discarded from grudge.tools import with_object_array_or_scalar - from grudge.optemplate.mappers import DependencyMapper + from grudge.symbolic.mappers import DependencyMapper dm = DependencyMapper(composite_leaves=False) def remove_result_variable(result_expr): @@ -569,7 +569,7 @@ class OperatorCompilerBase(IdentityMapper): @memoize_method def dep_mapper_factory(self, include_subscripts=False): - from grudge.optemplate import DependencyMapper + from grudge.symbolic import DependencyMapper self.dep_mapper = DependencyMapper( include_operator_bindings=False, include_subscripts=include_subscripts, @@ -588,12 +588,12 @@ class OperatorCompilerBase(IdentityMapper): raise NotImplementedError def collect_diff_ops(self, expr): - from grudge.optemplate.operators import ReferenceDiffOperatorBase - from grudge.optemplate.mappers import BoundOperatorCollector + from grudge.symbolic.operators import ReferenceDiffOperatorBase + from grudge.symbolic.mappers import BoundOperatorCollector return BoundOperatorCollector(ReferenceDiffOperatorBase)(expr) def collect_flux_exchange_ops(self, expr): - from grudge.optemplate.mappers import FluxExchangeCollector + from grudge.symbolic.mappers import FluxExchangeCollector return FluxExchangeCollector()(expr) # }}} @@ -601,10 +601,10 @@ class OperatorCompilerBase(IdentityMapper): # {{{ top-level driver ---------------------------------------------------- def __call__(self, expr, type_hints={}): # Put the result expressions into variables as well. - from grudge.optemplate import make_common_subexpression as cse + from grudge.symbolic import make_common_subexpression as cse expr = cse(expr, "_result") - from grudge.optemplate.mappers.type_inference import TypeInferrer + from grudge.symbolic.mappers.type_inference import TypeInferrer self.typedict = TypeInferrer()(expr, type_hints) # {{{ flux batching @@ -720,10 +720,10 @@ class OperatorCompilerBase(IdentityMapper): except KeyError: priority = getattr(expr, "priority", 0) - from grudge.optemplate.mappers.type_inference import type_info + from grudge.symbolic.mappers.type_inference import type_info is_scalar_valued = isinstance(self.typedict[expr], type_info.Scalar) - from grudge.optemplate import OperatorBinding + from grudge.symbolic import OperatorBinding if isinstance(expr.child, OperatorBinding): # We need to catch operator bindings here and # treat them specially. They get assigned to their @@ -743,7 +743,7 @@ class OperatorCompilerBase(IdentityMapper): return cse_var def map_operator_binding(self, expr, name_hint=None): - from grudge.optemplate.operators import ( + from grudge.symbolic.operators import ( ReferenceDiffOperatorBase, FluxOperatorBase) @@ -780,7 +780,7 @@ class OperatorCompilerBase(IdentityMapper): return self.assign_to_new_var(expr, prefix="normal%d" % expr.axis) def map_call(self, expr): - from grudge.optemplate.primitives import CFunction + from grudge.symbolic.primitives import CFunction if isinstance(expr.function, CFunction): return IdentityMapper.map_call(self, expr) else: @@ -807,7 +807,7 @@ class OperatorCompilerBase(IdentityMapper): from pytools import single_valued op_class = single_valued(type(d.op) for d in all_diffs) - from grudge.optemplate.operators import \ + from grudge.symbolic.operators import \ ReferenceQuadratureStiffnessTOperator if isinstance(op_class, ReferenceQuadratureStiffnessTOperator): assign_class = QuadratureDiffBatchAssign diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py index 6bac9fbbf44f9624c708d717ada679881e0a9cc8..8b7b635ce6e37f8a33c76744247195405c30c22b 100644 --- a/grudge/symbolic/operators.py +++ b/grudge/symbolic/operators.py @@ -36,7 +36,7 @@ from pytools import Record, memoize_method class Operator(pymbolic.primitives.Leaf): def stringifier(self): - from grudge.optemplate import StringifyMapper + from grudge.symbolic import StringifyMapper return StringifyMapper def __call__(self, expr): @@ -47,14 +47,14 @@ class Operator(pymbolic.primitives.Leaf): if is_zero(subexpr): return subexpr else: - from grudge.optemplate.primitives import OperatorBinding + from grudge.symbolic.primitives import OperatorBinding return OperatorBinding(self, subexpr) return with_object_array_or_scalar(bind_one, expr) @memoize_method def bind(self, discr): - from grudge.optemplate import Field + from grudge.symbolic import Field bound_op = discr.compile(self(Field("f"))) def apply_op(field): @@ -152,10 +152,10 @@ class QuadratureStiffnessTOperator(DiffOperatorBase): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`StiffnessTOperator` is applied to a quadrature field, and then eliminated by - :class:`grudge.optemplate.mappers.GlobalToReferenceMapper` + :class:`grudge.symbolic.mappers.GlobalToReferenceMapper` in favor of operators on the reference element. """ @@ -217,7 +217,7 @@ class ReferenceQuadratureStiffnessTOperator(ReferenceDiffOperatorBase): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`StiffnessTOperator` is applied to a quadrature field. """ @@ -297,7 +297,7 @@ class QuadratureBoundaryGridUpsampler(Operator): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`MassOperator` is applied to a quadrature field. """ def __init__(self, quadrature_tag, boundary_tag): @@ -420,10 +420,10 @@ class QuadratureMassOperator(Operator): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`StiffnessTOperator` is applied to a quadrature field, and then eliminated by - :class:`grudge.optemplate.mappers.GlobalToReferenceMapper` + :class:`grudge.symbolic.mappers.GlobalToReferenceMapper` in favor of operators on the reference element. """ @@ -441,7 +441,7 @@ class ReferenceQuadratureMassOperator(Operator): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`MassOperator` is applied to a quadrature field. """ @@ -547,7 +547,7 @@ class FluxOperatorBase(Operator): # override to suppress apply-operator-to-each-operand # behavior from superclass - from grudge.optemplate.primitives import OperatorBinding + from grudge.symbolic.primitives import OperatorBinding return OperatorBinding(self, arg) def __mul__(self, arg): @@ -578,7 +578,7 @@ class BoundaryFluxOperator(BoundaryFluxOperatorBase): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`FluxOperator` is applied to a boundary field. """ def __init__(self, flux, boundary_tag, is_lift=False): @@ -596,7 +596,7 @@ class QuadratureFluxOperator(QuadratureFluxOperatorBase): .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`FluxOperator` is applied to a quadrature field. """ @@ -617,7 +617,7 @@ class QuadratureBoundaryFluxOperator( .. note:: This operator is purely for internal use. It is inserted - by :class:`grudge.optemplate.mappers.OperatorSpecializer` + by :class:`grudge.symbolic.mappers.OperatorSpecializer` when a :class:`FluxOperator` is applied to a quadrature boundary field. """ @@ -643,7 +643,7 @@ class VectorFluxOperator(object): if isinstance(arg, int) and arg == 0: return 0 from pytools.obj_array import make_obj_array - from grudge.optemplate.primitives import OperatorBinding + from grudge.symbolic.primitives import OperatorBinding return make_obj_array( [OperatorBinding(FluxOperator(f), arg) @@ -682,7 +682,7 @@ class WholeDomainFluxOperator(pymbolic.primitives.AlgebraicLeaf): @property @memoize_method def dependencies(self): - from grudge.optemplate.tools import get_flux_dependencies + from grudge.symbolic.tools import get_flux_dependencies return set(get_flux_dependencies( self.flux_expr, self.field_expr)) @@ -692,20 +692,20 @@ class WholeDomainFluxOperator(pymbolic.primitives.AlgebraicLeaf): @property @memoize_method def int_dependencies(self): - from grudge.optemplate.tools import get_flux_dependencies + from grudge.symbolic.tools import get_flux_dependencies return set(get_flux_dependencies( self.flux_expr, self.bpair, bdry="int")) @property @memoize_method def ext_dependencies(self): - from grudge.optemplate.tools import get_flux_dependencies + from grudge.symbolic.tools import get_flux_dependencies return set(get_flux_dependencies( self.flux_expr, self.bpair, bdry="ext")) def __init__(self, is_lift, interiors, boundaries, quadrature_tag): - from grudge.optemplate.tools import get_flux_dependencies + from grudge.symbolic.tools import get_flux_dependencies self.is_lift = is_lift @@ -733,7 +733,7 @@ class WholeDomainFluxOperator(pymbolic.primitives.AlgebraicLeaf): self.dep_to_tag[dep] = bflux.bpair.tag def stringifier(self): - from grudge.optemplate import StringifyMapper + from grudge.symbolic import StringifyMapper return StringifyMapper def repr_op(self): diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py index 8ce50cc8fb12abaf23f9aa8d3305cf0312694260..e09b707618b93ec4c2d4b4c3e0a84f27ef5ad774 100644 --- a/grudge/symbolic/primitives.py +++ b/grudge/symbolic/primitives.py @@ -39,7 +39,7 @@ from pytools import MovedFunctionDeprecationWrapper class LeafBase(pymbolic.primitives.AlgebraicLeaf): def stringifier(self): - from grudge.optemplate import StringifyMapper + from grudge.symbolic import StringifyMapper return StringifyMapper @@ -62,7 +62,7 @@ class ScalarParameter(pymbolic.primitives.Variable): """A placeholder for a user-supplied scalar variable.""" def stringifier(self): - from grudge.optemplate import StringifyMapper + from grudge.symbolic import StringifyMapper return StringifyMapper mapper_method = intern("map_scalar_parameter") @@ -73,7 +73,7 @@ class CFunction(pymbolic.primitives.Variable): argument of :class:`pymbolic.primitives.Call`. """ def stringifier(self): - from grudge.optemplate import StringifyMapper + from grudge.symbolic import StringifyMapper return StringifyMapper def __call__(self, expr): diff --git a/grudge/symbolic/tools.py b/grudge/symbolic/tools.py index 6ba7289f4d948557a6ca2c4971f1e1a892854c33..9d3a43e7868d44feac90ecd28ffaec396f594fb8 100644 --- a/grudge/symbolic/tools.py +++ b/grudge/symbolic/tools.py @@ -40,7 +40,7 @@ def get_flux_operator(flux): flux. """ from grudge.tools import is_obj_array - from grudge.optemplate import VectorFluxOperator, FluxOperator + from grudge.symbolic import VectorFluxOperator, FluxOperator if is_obj_array(flux): return VectorFluxOperator(flux) @@ -50,34 +50,34 @@ def get_flux_operator(flux): def make_nabla(dim): from grudge.tools import make_obj_array - from grudge.optemplate import DifferentiationOperator + from grudge.symbolic import DifferentiationOperator return make_obj_array( [DifferentiationOperator(i) for i in range(dim)]) def make_minv_stiffness_t(dim): from grudge.tools import make_obj_array - from grudge.optemplate import MInvSTOperator + from grudge.symbolic import MInvSTOperator return make_obj_array( [MInvSTOperator(i) for i in range(dim)]) def make_stiffness(dim): from grudge.tools import make_obj_array - from grudge.optemplate import StiffnessOperator + from grudge.symbolic import StiffnessOperator return make_obj_array( [StiffnessOperator(i) for i in range(dim)]) def make_stiffness_t(dim): from grudge.tools import make_obj_array - from grudge.optemplate import StiffnessTOperator + from grudge.symbolic import StiffnessTOperator return make_obj_array( [StiffnessTOperator(i) for i in range(dim)]) def integral(arg): - import grudge.optemplate as sym + import grudge.symbolic as sym return sym.NodalSum()(sym.MassOperator()(sym.Ones())*arg) @@ -85,7 +85,7 @@ def norm(p, arg): """ :arg arg: is assumed to be a vector, i.e. have shape ``(n,)``. """ - import grudge.optemplate as sym + import grudge.symbolic as sym if p == 2: comp_norm_squared = sym.NodalSum()( @@ -103,7 +103,7 @@ def norm(p, arg): def flat_end_sin(x): - from grudge.optemplate.primitives import CFunction + from grudge.symbolic.primitives import CFunction from pymbolic.primitives import IfPositive from math import pi return IfPositive(-pi/2-x, @@ -121,7 +121,7 @@ def smooth_ifpos(crit, right, left, width): # {{{ optemplate tools def is_scalar(expr): - from grudge.optemplate import ScalarParameter + from grudge.symbolic import ScalarParameter return isinstance(expr, (int, float, complex, ScalarParameter)) @@ -143,7 +143,7 @@ def get_flux_dependencies(flux, field, bdry="all"): return fld from grudge.tools import is_zero - from grudge.optemplate import BoundaryPair + from grudge.symbolic import BoundaryPair if isinstance(field, BoundaryPair): for inf in in_fields: if inf.is_interior: @@ -188,7 +188,7 @@ def split_optemplate_for_multirate(state_vector, op_template, killers.append(IndexGroupKillerSubstMap(kill_set)) - from grudge.optemplate import \ + from grudge.symbolic import \ SubstitutionMapper, \ CommutativeConstantFoldingMapper @@ -252,12 +252,12 @@ def process_optemplate(optemplate, post_bind_mapper=None, dumper=lambda name, optemplate: None, mesh=None, type_hints={}): - from grudge.optemplate.mappers import ( + from grudge.symbolic.mappers import ( OperatorBinder, CommutativeConstantFoldingMapper, EmptyFluxKiller, InverseMassContractor, DerivativeJoiner, ErrorChecker, OperatorSpecializer, GlobalToReferenceMapper) - from grudge.optemplate.mappers.bc_to_flux import BCToFluxRewriter - from grudge.optemplate.mappers.type_inference import TypeInferrer + from grudge.symbolic.mappers.bc_to_flux import BCToFluxRewriter + from grudge.symbolic.mappers.type_inference import TypeInferrer dumper("before-bind", optemplate) optemplate = OperatorBinder()(optemplate) @@ -327,7 +327,7 @@ def process_optemplate(optemplate, post_bind_mapper=None, # {{{ pretty printing def pretty(optemplate): - from grudge.optemplate.mappers import PrettyStringifyMapper + from grudge.symbolic.mappers import PrettyStringifyMapper stringify_mapper = PrettyStringifyMapper() from pymbolic.mapper.stringifier import PREC_NONE