temet.ICs package

Submodules

temet.ICs.CoffeeICs module

Original coffee problem ICs for AREPO.

temet.ICs.GasCloud_Hernquist module

Idealized ICs: hydrostatic equilibrium gas sphere in a Hernquist potential.

GasRho(r)
HaloRho(r)
Rho(r)
GasMass(r)
HaloMass(r)
Mass(r)
Sigma_Integrand(r)
Sigma(r)
run()

temet.ICs.GasCloud_NFW module

Idealized ICs: hydrostatic equilibrium gas sphere in a NFW potential.

GasRho(r)
HaloRho(r)
Rho(r)
GasMass(r)
HaloMass(r)
Mass(r)
Omega(r)
Sigma_Integrand(r)
Sigma(r)
Potential(r)
run()

temet.ICs.GasCloud_NFW_tracers module

Idealized ICs: hydrostatic equilibrium gas sphere in a Hernquist potential (with Monte Carlo tracers).

GasRho(r)
HaloRho(r)
Rho(r)
GasMass(r)
HaloMass(r)
Mass(r)
Omega(r)
Sigma_Integrand(r)
Sigma(r)
Potential(r)
run()

temet.ICs.KelvinHelmholtz module

Idealized initial conditions: kelvin-helmholtz instability.

create_ics(numPartPerDim=64, filename='ics.hdf5')

Create idealized ICs for KH instability in 2D.

create_ics2(numPartPerDim=64, filename='ics.hdf5')

Different strategy, without angle, but with a higher density center (optional).

temet.ICs.ResimMakePartLoad module

Cosmological zoom/resimulation ICs: step one, i.e. handle functionality previously in P-Resim-MakePartLoad. Step two is to run the external program N-GenICResim on the generated particle load.

generate(sP, fofID, ZoomFactor=1, EnlargeHighResFactor=3.0)

Create zoom particle set (Coordinates) and save. After this file is done, create ICs as: srun -n 8 ./N-GenICResim param.txt partload_file.hdf5.

Parameters:
  • sP (simParams) – simulation instance, with redshift corresponding to the selected fofID.

  • fofID (int) – the target halo (fof) ID to zoom on.

  • ZoomFactor (int) – resolution boost of high-res region, in linear particle spacing, so total highres particles increases as ZoomFactor**3 while mass decreases by ZoomFactor**3 (1 = no increase beyond original, 2 = x8 mass resolution, 3 = x27 mass resolution, 4 = x64 mass resolution).

  • EnlargeHighResFactor (float) – set spatial size of high-res region, multiplicative factor on FoF volume.

Returns:

None. IC file written to disk.

generate_set()

Driver.

temet.ICs.Shocks2D_ICs module

Idealized initial conditions: shocks/implosion/discontinuity/”2D Riemann” tests in 2D. Following Schulz-Rinne (1993), Kurganov & Tadmor (2002), Liska & Wendroff (2003). http://www-troja.fjfi.cvut.cz/%7Eliska/CompareEuler/compare8/

create_ics(numPartPerDim=200, config=1, filename='ics.hdf5')

Create idealized ICs of Rosswog+ (2019) tests.

temet.ICs.YeeVortex_ICs module

Idealized initial conditions: Yee Vortex.

temet.ICs.readSpoonMesh module

Read mesh file for idealized ICs of “3D spoon” problem.

temet.ICs.sedov_solution module

Idealized ICs: analytical solution of the 3D Sedov blast wave, given the ICs, at some time t. Inspired by the version from SWIFT.

calc_a(g, nu=3)

exponents of the polynomials of the sedov solution g - the polytropic gamma nu - the dimension

calc_beta(v, g, nu=3)

beta values for the sedov solution (coefficients of the polynomials of the similarity variables) v - the similarity variable g - the polytropic gamma nu- the dimension

sedov(t, E0, rho0, g=1.6666666666666667, n=1000, nu=3)

Solve the sedov problem.

Parameters:
  • time (t -)

  • energy (E0 - initial)

  • density (rho0 - initial)

  • on (n - number of points to compute solution)

  • dimensionality (nu -)

  • gamma (g - polytropic gas)

solution_cgs(time_kyr=1.0)
plot_timeseries()

Run this one.

plot_rshock_vs_time()

Run this one too.

temet.ICs.sod module

Analytic/exact solutions to 1D shocktube problems. Originally from https://gitlab.com/fantaz/Riemann_exact/blob/master/sod.py with modifications.

shock_tube_function(p4, p1, p5, rho1, rho5, gamma)

Shock tube equation

calculate_regions(pl, ul, rhol, pr, ur, rhor, gamma=1.4)

Compute regions :rtype : tuple :return: returns p, rho and u for regions 1,3,4,5 as well as the shock speed

calc_positions(pl, pr, region1, region3, w, xi, t, gamma)
Returns:

tuple of positions in the following order -> Head of Rarefaction: xhd, Foot of Rarefaction: xft, Contact Discontinuity: xcd, Shock: xsh

region_states(pl, pr, region1, region3, region4, region5)
Returns:

dictionary (region no.: p, rho, u), except for rarefaction region where the value is a string.

create_arrays(pl, pr, xl, xr, positions, state1, state3, state4, state5, npts, gamma, t, xi, x_arr=None)
Returns:

tuple of x, p, rho and u values across the domain of interest

solve(left_state, right_state, geometry, t, gamma=1.4, npts=500, x_arr=None)

Solves the Sod shock tube problem (i.e. riemann problem) of discontinuity across an interface.

:rtype : tuple :param left_state: tuple (pl, rhol, ul) :param right_state: tuple (pr, rhor, ur) :param geometry: tuple (xl, xr, xi): xl - left boundary, xr - right boundary, xi - initial discontinuity :param t: time for which the states have to be calculated :param gamma: ideal gas constant, default is air: 1.4 :param npts: number of points for array of pressure, density and velocity :param x_arr: if not None, then compute solution exactly at these points :return: tuple of: dicts of positions, constant pressure, density and velocity states in distinct regions, arrays of pressure, density and velocity in domain bounded by xl, xr

temet.ICs.utilities module

Idealized initial conditions: utility (common) functions.

write_ic_file(fileName, partTypes, boxSize, massTable=None, headerExtra=None)

Helper to write a HDF5 IC file. partTypes is a dictionary with keys of the form PartTypeX, each of which is its own dictionary of particle fields and ndarrays. boxSize is a scalar float, and massTable a 6-element float array, if specified.

visualize_result_2d(basePath)

Helper function to load density_field_NNN projection files and plot a series of PNG frames.

histogram_result_2d(basePath)

Helper function to load density_field_NNN projection files and plot histograms across the time series, to see range.

Module contents

Initial condition generation. Note that with the exception of the zoom functionality inside ICs.ResimMakePartLoad, everything else here pertains to idealized simulations with typically non-cosmological integrations and non-cosmological unit systems.