MP-Gadget
5.0.1.dev1-76bc7d4726-dirty
|
SPH density computation and smoothing length determination. More...
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <gsl/gsl_math.h>
#include <omp.h>
#include "physconst.h"
#include "walltime.h"
#include "cooling.h"
#include "density.h"
#include "treewalk.h"
#include "timefac.h"
#include "slotsmanager.h"
#include "timestep.h"
#include "utils.h"
#include "gravity.h"
#include "winds.h"
Go to the source code of this file.
Classes | |
struct | TreeWalkNgbIterDensity |
struct | TreeWalkQueryDensity |
struct | TreeWalkResultDensity |
struct | DensityPriv |
Macros | |
#define | DENSITY_GET_PRIV(tw) ((struct DensityPriv*) ((tw)->priv)) |
Functions | |
void | set_densitypar (struct density_params dp) |
void | set_density_params (ParameterSet *ps) |
double | GetNumNgb (enum DensityKernelType KernelType) |
enum DensityKernelType | GetDensityKernelType (void) |
MyFloat | SPH_EntVarPred (int PI, double MinEgySpec, double a3inv, double dloga) |
void | SPH_VelPred (int i, MyFloat *VelPred, const double FgravkickB, double gravkick, double hydrokick) |
static void | density_ngbiter (TreeWalkQueryDensity *I, TreeWalkResultDensity *O, TreeWalkNgbIterDensity *iter, LocalTreeWalk *lv) |
static int | density_haswork (int n, TreeWalk *tw) |
static void | density_postprocess (int i, TreeWalk *tw) |
static void | density_check_neighbours (int i, TreeWalk *tw) |
static void | density_reduce (int place, TreeWalkResultDensity *remote, enum TreeWalkReduceMode mode, TreeWalk *tw) |
static void | density_copy (int place, TreeWalkQueryDensity *I, TreeWalk *tw) |
void | density (const ActiveParticles *act, int update_hsml, int DoEgyDensity, int BlackHoleOn, double MinEgySpec, const DriftKickTimes times, Cosmology *CP, struct sph_pred_data *SPH_predicted, MyFloat *GradRho, const ForceTree *const tree) |
struct sph_pred_data | slots_allocate_sph_pred_data (int nsph) |
void | slots_free_sph_pred_data (struct sph_pred_data *sph_scratch) |
Variables | |
static struct density_params | DensityParams |
SPH density computation and smoothing length determination.
This file contains the "first SPH loop", where the SPH densities and some auxiliary quantities are computed. There is also functionality that corrects the smoothing length if needed.
Definition in file density.c.
#define DENSITY_GET_PRIV | ( | tw | ) | ((struct DensityPriv*) ((tw)->priv)) |
void density | ( | const ActiveParticles * | act, |
int | update_hsml, | ||
int | DoEgyDensity, | ||
int | BlackHoleOn, | ||
double | MinEgySpec, | ||
const DriftKickTimes | times, | ||
Cosmology * | CP, | ||
struct sph_pred_data * | SPH_predicted, | ||
MyFloat * | GradRho, | ||
const ForceTree *const | tree | ||
) |
This function computes the local density for each active SPH particle, the number of neighbours in the current smoothing radius, and the divergence and rotation of the velocity field. The pressure is updated as well. If a particle with its smoothing region is fully inside the local domain, it is not exported to the other processors. The function also detects particles that have a number of neighbours outside the allowed tolerance range. For these particles, the smoothing length is adjusted accordingly, and the density() computation is called again. Note that the smoothing length is not allowed to fall below the lower bound set by MinGasHsml (this may mean that one has to deal with substantially more than normal number of neighbours.)
Definition at line 203 of file density.c.
References DensityPriv::a3inv, ActiveParticles::ActiveParticle, DensityPriv::BlackHoleOn, ForceTree::BoxSize, CP, density_copy(), DENSITY_GET_PRIV, density_haswork(), density_ngbiter(), density_postprocess(), density_reduce(), density_params::DensityKernelType, DensityParams, DensityPriv::DhsmlDensityFactor, dloga, dloga_from_dti(), DensityPriv::DoEgyDensity, sph_pred_data::EntVarPred, TreeWalk::ev_label, DensityPriv::FgravkickB, TreeWalk::fill, FORCE_SOFTENING(), get_exact_gravkick_factor(), get_exact_hydrokick_factor(), GetNumNgb(), DensityPriv::GradRho, DensityPriv::gravkicks, TreeWalk::haswork, DensityPriv::hydrokicks, slots_manager_type::info, DensityPriv::Left, loga_from_ti(), DensityPriv::MinEgySpec, density_params::MinGasHsmlFractional, DriftKickTimes::mintimebin, myfree, mymalloc, TreeWalk::ngbiter, TreeWalk::ngbiter_type_elsize, TreeWalk::NoNgblist, ActiveParticles::NumActiveParticle, DensityPriv::NumNgb, part_manager_type::NumPart, P, PartManager, DriftKickTimes::PM_kick, TreeWalk::postprocess, TreeWalk::priv, TreeWalk::query_type_elsize, TreeWalk::reduce, TreeWalk::result_type_elsize, DensityPriv::Right, DensityPriv::Rot, slot_info::size, SlotsManager, SPH_EntVarPred(), DensityPriv::SPH_predicted, SPH_VelPred(), DriftKickTimes::Ti_Current, DriftKickTimes::Ti_kick, TIMEBINS, TreeWalk::timecommsumm1, TreeWalk::timecommsumm2, TreeWalk::timecomp1, TreeWalk::timecomp2, TreeWalk::timecomp3, DensityPriv::times, TreeWalk::timewait1, TreeWalk::timewait2, TreeWalk::tree, treewalk_do_hsml_loop(), treewalk_visit_nolist_ngbiter(), DensityPriv::update_hsml, sph_pred_data::VelPred, TreeWalk::visit, walltime_add, WALLTIME_IGNORE, and walltime_measure.
Referenced by density_postprocess(), do_density_test(), get_compton_cooling(), get_equilib_ne(), get_heatingcooling_rate(), get_helium_ion_phys_cgs(), get_individual_cooling(), get_ne_by_nh(), get_neutral_fraction_phys_cgs(), get_temp(), run(), runfof(), setup_density_indep_entropy(), and setup_smoothinglengths().
|
static |
Definition at line 554 of file density.c.
References density_params::BlackHoleMaxAccretionRadius, density_params::BlackHoleNgbFactor, ForceTree::BoxSize, DENSITY_GET_PRIV, DensityParams, endrun(), MAXITER, TreeWalk::maxnumngb, density_params::MaxNumNgbDeviation, message(), TreeWalk::minnumngb, TreeWalk::Niteration, TreeWalk::NPLeft, TreeWalk::NPRedo, NUMDIMS, P, TreeWalk::Redo_thread_alloc, and TreeWalk::tree.
Referenced by density_postprocess().
|
static |
Definition at line 316 of file density.c.
References DENSITY_GET_PRIV, TreeWalkQueryDensity::Hsml, P, TreeWalkQueryDensity::Type, and TreeWalkQueryDensity::Vel.
Referenced by density().
|
static |
|
static |
Definition at line 388 of file density.c.
References DensityPriv::a3inv, TreeWalkNgbIterDensity::base, crossproduct(), DENSITY_GET_PRIV, density_kernel_dW(), density_kernel_dwk(), density_kernel_init(), density_kernel_volume(), density_kernel_wk(), density_params::DensityKernelType, DensityParams, TreeWalkResultDensity::DhsmlDensity, TreeWalkResultDensity::DhsmlEgyDensity, TreeWalkNgbIterBase::dist, TreeWalkResultDensity::Div, dloga, dloga_from_dti(), dotproduct(), dwk, TreeWalkResultDensity::EgyRho, endrun(), sph_pred_data::EntVarPred, DensityPriv::FgravkickB, TreeWalkResultDensity::GradRho, DensityPriv::gravkicks, DensityKernel::Hinv, TreeWalkQueryDensity::Hsml, TreeWalkNgbIterBase::Hsml, DensityPriv::hydrokicks, TreeWalkNgbIterDensity::kernel, kernel(), TreeWalkNgbIterDensity::kernel_volume, TreeWalkNgbIterBase::mask, DensityPriv::MinEgySpec, TreeWalkResultDensity::Ngb, NGB_TREEFIND_ASYMMETRIC, TreeWalkNgbIterBase::other, P, TreeWalkNgbIterBase::r, TreeWalkNgbIterBase::r2, TreeWalkResultDensity::Rho, TreeWalkResultDensity::Rot, SPH_EntVarPred(), SPH_VelPred(), TreeWalkNgbIterBase::symmetric, DriftKickTimes::Ti_Current, DriftKickTimes::Ti_kick, DensityPriv::times, LocalTreeWalk::tw, TreeWalkQueryDensity::Type, TreeWalkQueryDensity::Vel, sph_pred_data::VelPred, winds_is_particle_decoupled(), and wk.
Referenced by density().
|
static |
Definition at line 512 of file density.c.
References BHP, density(), density_check_neighbours(), DENSITY_GET_PRIV, endrun(), sph_pred_data::EntVarPred, NUMDIMS, DensityPriv::NumNgb, P, and SPHP.
Referenced by density().
|
static |
Definition at line 339 of file density.c.
References BHP, DENSITY_GET_PRIV, TreeWalkResultDensity::DhsmlDensity, DensityPriv::DhsmlDensityFactor, TreeWalkResultDensity::DhsmlEgyDensity, TreeWalkResultDensity::Div, DensityPriv::DoEgyDensity, TreeWalkResultDensity::EgyRho, TreeWalkResultDensity::GradRho, TreeWalkResultDensity::Ngb, DensityPriv::NumNgb, P, TreeWalkResultDensity::Rho, DensityPriv::Rot, TreeWalkResultDensity::Rot, SPHP, and TREEWALK_REDUCE.
Referenced by density().
enum DensityKernelType GetDensityKernelType | ( | void | ) |
Definition at line 55 of file density.c.
References density_kernel_desnumngb(), density_kernel_init(), DensityParams, density_params::DensityResolutionEta, and kernel().
Referenced by blackhole_accretion_ngbiter(), blackhole_dynfric_ngbiter(), blackhole_feedback_ngbiter(), do_density_test(), hydro_ngbiter(), metal_return_ngbiter(), petaio_write_header(), set_density_params(), set_init_hsml(), setup_smoothinglengths(), stellar_density(), and stellar_density_ngbiter().
double GetNumNgb | ( | enum DensityKernelType | KernelType | ) |
Definition at line 55 of file density.c.
Referenced by density(), do_density_test(), set_density_params(), set_init_hsml(), setup_smoothinglengths(), and stellar_density().
void set_density_params | ( | ParameterSet * | ps | ) |
Definition at line 32 of file density.c.
References density_params::BlackHoleMaxAccretionRadius, density_params::BlackHoleNgbFactor, density_kernel_init(), density_params::DensityKernelType, DensityParams, density_params::DensityResolutionEta, GetDensityKernelType(), GetNumNgb(), kernel(), density_params::MaxNumNgbDeviation, message(), density_params::MinGasHsmlFractional, param_get_double(), param_get_enum(), and ThisTask.
Referenced by read_parameter_file().
void set_densitypar | ( | struct density_params | dp | ) |
Definition at line 25 of file density.c.
References DensityParams.
Referenced by do_density_test(), and setup_density().
struct sph_pred_data slots_allocate_sph_pred_data | ( | int | nsph | ) |
Definition at line 554 of file density.c.
Referenced by run(), runfof(), setup_density(), and setup_smoothinglengths().
void slots_free_sph_pred_data | ( | struct sph_pred_data * | sph_scratch | ) |
Definition at line 665 of file density.c.
References sph_pred_data::EntVarPred, myfree, and sph_pred_data::VelPred.
Referenced by run(), runfof(), and setup_smoothinglengths().
MyFloat SPH_EntVarPred | ( | int | PI, |
double | MinEgySpec, | ||
double | a3inv, | ||
double | dloga | ||
) |
Definition at line 71 of file density.c.
References dloga, GAMMA, GAMMA_MINUS1, and SphP.
Referenced by density(), density_ngbiter(), and hydro_ngbiter().
void SPH_VelPred | ( | int | i, |
MyFloat * | VelPred, | ||
const double | FgravkickB, | ||
double | gravkick, | ||
double | hydrokick | ||
) |
Definition at line 89 of file density.c.
Referenced by density(), density_ngbiter(), and hydro_ngbiter().
|
static |
Definition at line 1 of file density.c.
Referenced by density(), density_check_neighbours(), density_ngbiter(), GetDensityKernelType(), set_density_params(), and set_densitypar().