temet.ICs

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.

temet.ICs.ResimMakePartLoad

Cosmological zoom/resimulation initial conditions.

This code is step one, i.e. handle functionality previously in P-Resim-MakePartLoad. Step two is to run the external program P-Resim-MakeICs 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.coffee

Original coffee problem ICs for AREPO.

create_ics(filename='ics.hdf5')

Create idealized ICs.

temet.ICs.coffee_readSpoonMesh

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

create_ics(filename='spoon-new_ics.hdf5')

Create idealized ICs.

temet.ICs.halo_Hernquist

Idealized ICs: hydrostatic equilibrium gas sphere in a Hernquist potential (live DM optional).

create_ics(filename='ics.hdf5')

Create idealized ICs.

temet.ICs.halo_NFW

Idealized ICs: hydrostatic equilibrium gas sphere (optionally with live halo particles) in a NFW potential.

create_ics(filename='ics.hdf5')

Create idealized ICs.

temet.ICs.halo_NFW_tracers

Idealized ICs: hydrostatic gas in a NFW potential (with Monte Carlo tracers; no live halo).

create_ics(filename='ics.hdf5')

Create idealized ICs.

temet.ICs.kelvin_helmholtz

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.sedov_solution

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

calc_a(g, nu=3)

Exponents of the polynomials of the sedov solution.

Parameters:
  • g (float) – the polytropic gamma

  • nu (int) – the dimension

calc_beta(v, g, nu=3)

Beta values for the sedov solution (coefficients of the polynomials of the similarity variables).

Parameters:
  • v (float) – the similarity variable

  • g (float) – the polytropic gamma

  • nu (int) – the dimension

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

Solve the sedov problem.

Parameters:
  • t (float) – time

  • E0 (float) – initial energy

  • rho0 (float) – initial density

  • g (float) – polytropic gas gamma

  • n (int) – number of points to compute solution on

  • nu (int) – dimensionality

solution_cgs(time_kyr=1.0)

Compute the Sedov solution.

plot_timeseries()

Plot the Sedov solution as a function of time.

plot_rshock_vs_time()

Plot the shock radius as a function of time.

temet.ICs.shocks2d

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.

uniform_ics_3d(N=64)

Create completely uniform ICs of gas (in 3D).

vis_test(conf=0)

Quick vis test.

temet.ICs.sod_solution

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)

Calculation positions of waves.

Returns:

Head of Rarefaction: xhd, Foot of Rarefaction: xft,

Contact Discontinuity: xcd, Shock: xsh

Return type:

tuple (float,4)

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

Region states.

Returns:

for each of the five regions, provide (p,rho, u), except for rarefaction region where the value is a string.

Return type:

dict

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.

Parameters:
  • left_state (tuple) – pl, rhol, ul

  • right_state (tuple) – pr, rhor, ur

  • geometry (tuple) – (xl, xr, xi): xl - left boundary, xr - right boundary, xi - initial discontinuity

  • t (float) – time for which the states have to be calculated

  • gamma (float) – ideal gas constant, default is air: 1.4

  • npts (int) – number of points for array of pressure, density and velocity

  • x_arr (array or None) – if not None, then compute solution exactly at these points

Returns:

three dicts of positions,

constant pressure, density and velocity states in distinct regions, arrays of pressure, density and velocity in domain bounded by xl, xr

Return type:

tuple

temet.ICs.utilities

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, noaxes=False)

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 vs time, to see range.

temet.ICs.yee_vortex

Idealized initial conditions: Yee Vortex.

create_ics(filename='ics.hdf5')

Create idealized ICs.