From 47fb8a9e279e3d5a62ea90357c367205aaf12e7b Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 15 Sep 2024 14:40:37 -0400 Subject: [PATCH] remove gresho from lm_atm + add docstring for bubble (#280) it is not clear where the gresho initial conditions for low Mach stratified flow came from. --- pyro/lm_atm/problems/__init__.py | 2 +- pyro/lm_atm/problems/bubble.py | 5 ++ pyro/lm_atm/problems/gresho.py | 89 ------------------------------ pyro/lm_atm/problems/inputs.gresho | 33 ----------- 4 files changed, 6 insertions(+), 123 deletions(-) delete mode 100644 pyro/lm_atm/problems/gresho.py delete mode 100644 pyro/lm_atm/problems/inputs.gresho diff --git a/pyro/lm_atm/problems/__init__.py b/pyro/lm_atm/problems/__init__.py index 6496898d8..48e709910 100644 --- a/pyro/lm_atm/problems/__init__.py +++ b/pyro/lm_atm/problems/__init__.py @@ -1 +1 @@ -__all__ = ['bubble', 'gresho'] +__all__ = ['bubble'] diff --git a/pyro/lm_atm/problems/bubble.py b/pyro/lm_atm/problems/bubble.py index abdb2b0b4..025f496f3 100644 --- a/pyro/lm_atm/problems/bubble.py +++ b/pyro/lm_atm/problems/bubble.py @@ -1,3 +1,8 @@ +"""Initialize a buoyant bubble in a hydrostatic atmosphere. This is +meant to be used to compare with the compressible solver bubble +problem. +""" + import numpy from pyro.util import msg diff --git a/pyro/lm_atm/problems/gresho.py b/pyro/lm_atm/problems/gresho.py deleted file mode 100644 index 430461087..000000000 --- a/pyro/lm_atm/problems/gresho.py +++ /dev/null @@ -1,89 +0,0 @@ -import numpy - -from pyro.util import msg - -DEFAULT_INPUTS = "inputs.gresho" - -PROBLEM_PARAMS = {"gresho.dens_base": 10.0, # density at the base of the atmosphere - "gresho.scale_height": 2.0, # scale height of the isothermal atmosphere - "gresho.r": 1.0, - "gresho.u0": 1.0, - "gresho.p0": 1.0, - "gresho.dens_cutoff": 0.01} - - -def init_data(my_data, base, rp): - """ initialize the Gresho vortex problem """ - - if rp.get_param("driver.verbose"): - msg.bold("initializing the Gresho vortex problem...") - - # get the density and velocities - dens = my_data.get_var("density") - xvel = my_data.get_var("x-velocity") - yvel = my_data.get_var("y-velocity") - eint = my_data.get_var("eint") - - grav = rp.get_param("lm-atmosphere.grav") - - gamma = rp.get_param("eos.gamma") - - scale_height = rp.get_param("gresho.scale_height") - dens_base = rp.get_param("gresho.dens_base") - dens_cutoff = rp.get_param("gresho.dens_cutoff") - - R = rp.get_param("gresho.r") - u0 = rp.get_param("gresho.u0") - - # initialize the components -- we'll get a pressure too - # but that is used only to initialize the base state - xvel[:, :] = 0.0 - yvel[:, :] = 0.0 - dens[:, :] = dens_cutoff - - # set the density to be stratified in the y-direction - myg = my_data.grid - pres = myg.scratch_array() - - for j in range(myg.jlo, myg.jhi+1): - dens[:, j] = max(dens_base*numpy.exp(-myg.y[j]/scale_height), - dens_cutoff) - - cs2 = scale_height*abs(grav) - - # set the pressure (P = cs2*dens) - pres = cs2*dens - eint[:, :] = pres/(gamma - 1.0)/dens - - x_centre = 0.5 * (myg.x[0] + myg.x[-1]) - y_centre = 0.5 * (myg.y[0] + myg.y[-1]) - - r = numpy.sqrt((myg.x2d - x_centre)**2 + (myg.y2d - y_centre)**2) - - pres[r <= R] += 0.5 * (u0 * r[r <= R]/R)**2 - pres[(r > R) & (r <= 2*R)] += u0**2 * \ - (0.5 * (r[(r > R) & (r <= 2*R)]/R)**2 + - 4 * (1 - r[(r > R) & (r <= 2*R)]/R + - numpy.log(r[(r > R) & (r <= 2*R)]/R))) - pres[r > 2*R] += u0**2 * (4 * numpy.log(2) - 2) - # - uphi = numpy.zeros_like(pres) - uphi[r <= R] = u0 * r[r <= R]/R - uphi[(r > R) & (r <= 2*R)] = u0 * (2 - r[(r > R) & (r <= 2*R)]/R) - - xvel[:, :] = -uphi[:, :] * (myg.y2d - y_centre) / r[:, :] - yvel[:, :] = uphi[:, :] * (myg.x2d - x_centre) / r[:, :] - - dens[:, :] = pres[:, :]/(eint[:, :]*(gamma - 1.0)) - - # do the base state - base["rho0"].d[:] = numpy.mean(dens, axis=0) - base["p0"].d[:] = numpy.mean(pres, axis=0) - - # redo the pressure via HSE - for j in range(myg.jlo+1, myg.jhi): - base["p0"].d[j] = base["p0"].d[j-1] + 0.5*myg.dy*(base["rho0"].d[j] + base["rho0"].d[j-1])*grav - - -def finalize(): - """ print out any information to the user at the end of the run """ diff --git a/pyro/lm_atm/problems/inputs.gresho b/pyro/lm_atm/problems/inputs.gresho deleted file mode 100644 index 49863f6d3..000000000 --- a/pyro/lm_atm/problems/inputs.gresho +++ /dev/null @@ -1,33 +0,0 @@ -# simple inputs files for the unsplit CTU hydro scheme - -[driver] -max_steps = 2000 -tmax = 10000.0 -cfl = 0.8 - - -[LM-atmosphere] - - -[io] -basename = lm_gresho_128_ -n_out = 1 - - -[mesh] -nx = 128 -ny = 128 -xmax = 1.0 -ymax = 1.0 - -xlboundary = periodic -xrboundary = periodic - -ylboundary = reflect -yrboundary = outflow - - -[gresho] -r = 0.2 -u0 = 0.1 -p0 = 1