diff --git a/y3prediction/prediction.py b/y3prediction/prediction.py index 7dd9d08..171e813 100644 --- a/y3prediction/prediction.py +++ b/y3prediction/prediction.py @@ -2683,6 +2683,7 @@ def inlet_ramp_pressure(t): dim=dim, nspecies=nspecies, disc_sigma=500., + disc_loc=shock_loc_x, pressure_bulk=pres_bkrnd, temperature_bulk=temp_bkrnd, velocity_bulk=vel_outflow, @@ -5032,15 +5033,13 @@ def inflow_ramp_pressure(t): mach=inlet_mach, p_fun=inflow_ramp_pressure) else: - smooth_r0 = fluid_nodes - smooth_r0[1] = actx.np.zeros_like(fluid_nodes[0]) - smooth_r0[2] = actx.np.zeros_like(fluid_nodes[0]) + r0 = np.zeros(shape=(dim,)) inflow_state = IsentropicInflow( dim=dim, temp_wall=temp_wall, temp_sigma=temp_sigma, vel_sigma=vel_sigma, - smooth_r0=smooth_r0, + smooth_r0=r0, smooth_r1=0.013, normal_dir=normal_dir, gamma=gamma, @@ -5415,15 +5414,13 @@ def _sponge_sigma(sponge_field, x_vec): thickness=outlet_sponge_thickness, amplitude=sponge_amp, direction=1) - #sponge_init_top = InitSponge(x0=top_sponge_x0, - #thickness=top_sponge_thickness, - #amplitude=sponge_amp, - #direction=1) def _sponge_sigma(sponge_field, x_vec): sponge_field = sponge_init_outlet(sponge_field=sponge_field, x_vec=x_vec) sponge_field = sponge_init_inlet(sponge_field=sponge_field, x_vec=x_vec) - sponge_field = sponge_init_top(sponge_field=sponge_field, x_vec=x_vec) + if dim == 2: + sponge_field = sponge_init_top( + sponge_field=sponge_field, x_vec=x_vec) return sponge_field sponge_sigma = actx.np.zeros_like(restart_cv.mass) @@ -5948,7 +5945,6 @@ def my_write_viz(step, t, t_wall, viz_state, viz_dv, if viz_level > 2: if use_species_limiter: - print(f"{theta_rho.shape=}") viz_ext = [("theta_rho", theta_rho), ("theta_Y", theta_Y), ("theta_pressure", theta_pres)] diff --git a/y3prediction/unstart.py b/y3prediction/unstart.py index aaa414d..f5e6ea5 100644 --- a/y3prediction/unstart.py +++ b/y3prediction/unstart.py @@ -19,7 +19,7 @@ class InitUnstartRamp: .. automethod:: add_injection """ - def __init__(self, *, dim=2, nspecies=0, disc_sigma, + def __init__(self, *, dim=2, nspecies=0, disc_sigma, disc_loc, pressure_bulk, temperature_bulk, velocity_bulk, mass_frac_bulk, pressure_inlet, temperature_inlet, velocity_inlet, @@ -44,6 +44,7 @@ def __init__(self, *, dim=2, nspecies=0, disc_sigma, self._dim = dim self._nspecies = nspecies self._disc_sigma = disc_sigma + self._disc_loc = disc_loc self._temp_wall = temp_wall self._temp_sigma = temp_sigma self._vel_sigma = vel_sigma @@ -135,7 +136,7 @@ def inlet_smoothing_func(self, x_vec, sigma): else: r1 = 0.013 radius = actx.np.sqrt((x_vec[1])**2 + (x_vec[2])**2) - smth_radial = smooth_step(actx, -sigma*(radius - r1)) + smth_radial = smooth_step(actx, sigma*actx.np.abs(radius - r1)) return smth_radial def outlet_smoothing_func(self, x_vec, sigma): @@ -150,7 +151,7 @@ def outlet_smoothing_func(self, x_vec, sigma): else: r1 = 0.2 radius = actx.np.sqrt((x_vec[1])**2 + (x_vec[2])**2) - smth_radial = smooth_step(actx, -sigma*(radius - r1)) + smth_radial = smooth_step(actx, sigma*actx.np.abs(radius - r1)) return smth_radial def add_inlet(self, cv, pressure, temperature, x_vec, eos, *, time=0.0): @@ -183,11 +184,9 @@ def add_inlet(self, cv, pressure, temperature, x_vec, eos, *, time=0.0): # initial discontinuity location if self._dim == 2: - y0 = -0.325 - dist = y0 - x_vec[1] + dist = self._disc_loc - x_vec[1] else: - x0 = -0.325 - dist = x0 - x_vec[0] + dist = self._disc_loc - x_vec[0] # now solve for T, P, velocity xtanh = self._disc_sigma*dist diff --git a/y3prediction/utils.py b/y3prediction/utils.py index c8dc152..b46e4e3 100644 --- a/y3prediction/utils.py +++ b/y3prediction/utils.py @@ -508,7 +508,6 @@ def __init__(self, *, dim, T0, P0, mass_frac, mach, gamma, self._x0 = smooth_x0 self._y0 = smooth_y0 self._z0 = smooth_z0 - self._r0 = smooth_r0 self._x1 = smooth_x1 self._y1 = smooth_y1 self._z1 = smooth_z1 @@ -517,6 +516,8 @@ def __init__(self, *, dim, T0, P0, mass_frac, mach, gamma, if smooth_r0 is None: self._r0 = np.zeros(shape=(dim,)) self._r0[0] = 1 + else: + self._r0 = smooth_r0 if normal_dir is None: self._normal_dir = np.zeros(shape=(dim,))