Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Correct initialization interface #3

Open
wants to merge 2 commits into
base: disc_init
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions mirgecom/initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,9 @@ def __init__(
specifies the number of dimensions for the solution
normal_dir: int
specifies the direction (plane) the discontinuity is applied in
disc_location: float or Function[float]
location of discontinuity (in time)
disc_location: float or Callable
fixed location of discontinuity, or optionally a function that
returns the time-dependent location
nspecies: int
specifies the number of mixture species
pressure_left: float
Expand Down Expand Up @@ -936,9 +937,9 @@ def __init__(
if self._xdir >= self._dim:
self._xdir = self._dim - 1

def __call__(self, x_vec, eos, *, t=0.0):
def __call__(self, x_vec, eos, *, time=0.0):
"""
Create the mixture state at locations *x_vec*.
Create the Planar Discontinuity solution state at locations *x_vec*.

Parameters
----------
Expand All @@ -949,9 +950,9 @@ def __call__(self, x_vec, eos, *, t=0.0):
these functions:
`eos.get_density`
`eos.get_internal_energy`
t: float
Time at which solution is desired.
The location is (optionally) dependent on time
time: float
Time at which solution is desired. The location of the discontinuity
is (optionally) dependent on time.
"""
if x_vec.shape != (self._dim,):
raise ValueError(f"Position vector has unexpected dimensionality,"
Expand All @@ -962,7 +963,7 @@ def __call__(self, x_vec, eos, *, t=0.0):
if isinstance(self._disc_location, Number):
x0 = self._disc_location
else:
x0 = self._disc_location(t)
x0 = self._disc_location(time)

xtanh = 1.0/self._sigma*(x0 - x)
weight = 0.5*(1.0 - actx.np.tanh(xtanh))
Expand Down