MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
hydra.c
Go to the documentation of this file.
1 #include <mpi.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <math.h>
6 #include <gsl/gsl_math.h>
7 
8 #include "physconst.h"
9 #include "walltime.h"
10 #include "slotsmanager.h"
11 #include "treewalk.h"
12 #include "density.h"
13 #include "hydra.h"
14 #include "winds.h"
15 #include "utils.h"
16 
25 static struct hydro_params
26 {
27  /* Enables density independent (Pressure-entropy) SPH */
29  /* limit of density contrast ratio for hydro force calculation (only effective with Density Indep. Sph) */
34 
35 /*Set the parameters of the hydro module*/
36 void
38 {
39  int ThisTask;
40  MPI_Comm_rank(MPI_COMM_WORLD, &ThisTask);
41  if(ThisTask == 0) {
42  HydroParams.ArtBulkViscConst = param_get_double(ps, "ArtBulkViscConst");
43  HydroParams.DensityContrastLimit = param_get_double(ps, "DensityContrastLimit");
44  HydroParams.DensityIndependentSphOn= param_get_int(ps, "DensityIndependentSphOn");
45  }
46  MPI_Bcast(&HydroParams, sizeof(struct hydro_params), MPI_BYTE, 0, MPI_COMM_WORLD);
47 }
48 
50 {
52 }
53 
54 /* Function to get the center of mass density and HSML correction factor for an SPH particle with index i.
55  * Encodes the main difference between pressure-entropy SPH and regular SPH.*/
56 static MyFloat SPH_EOMDensity(const struct sph_particle_data * const pi)
57 {
59  return pi->EgyWtDensity;
60  else
61  return pi->Density;
62 }
63 
64 /* Compute pressure using the predicted density (EgyWtDensity if Pressure-Entropy SPH,
65  * Density otherwise) and predicted entropy*/
66 static double
67 PressurePred(MyFloat EOMDensityPred, double EntVarPred)
68 {
69  return pow(EntVarPred * EOMDensityPred, GAMMA);
70 }
71 
72 struct HydraPriv {
73  double * PressurePred;
75  /* Time-dependent constant factors, brought out here because
76  * they need an expensive pow().*/
77  double fac_mu;
78  double fac_vsic_fix;
79  double hubble_a2;
80  double atime;
82  double MinEgySpec;
83  double FgravkickB;
84  double gravkicks[TIMEBINS+1];
85  double hydrokicks[TIMEBINS+1];
86  double drifts[TIMEBINS+1];
87 };
88 
89 #define HYDRA_GET_PRIV(tw) ((struct HydraPriv*) ((tw)->priv))
90 
91 typedef struct {
93  /* These are only used for DensityIndependentSphOn*/
96 
97  double Vel[3];
106 
107 typedef struct {
109  MyFloat Acc[3];
113 
114 typedef struct {
117  double soundspeed_i;
118 
121 
122 static int
123 hydro_haswork(int n, TreeWalk * tw);
124 
125 static void
126 hydro_postprocess(int i, TreeWalk * tw);
127 
128 static void
130  TreeWalkQueryHydro * I,
132  TreeWalkNgbIterHydro * iter,
133  LocalTreeWalk * lv
134  );
135 
136 static void
137 hydro_copy(int place, TreeWalkQueryHydro * input, TreeWalk * tw);
138 
139 static void
140 hydro_reduce(int place, TreeWalkResultHydro * result, enum TreeWalkReduceMode mode, TreeWalk * tw);
141 
146 void
147 hydro_force(const ActiveParticles * act, const double atime, struct sph_pred_data * SPH_predicted, double MinEgySpec, const DriftKickTimes times, Cosmology * CP, const ForceTree * const tree)
148 {
149  int i;
150  TreeWalk tw[1] = {{0}};
151 
152  struct HydraPriv priv[1];
153 
154  tw->ev_label = "HYDRO";
158  tw->haswork = hydro_haswork;
164  tw->tree = tree;
165  tw->priv = priv;
166 
167  if(!tree->hmax_computed_flag)
168  endrun(5, "Hydro called before hmax computed\n");
169  /* Cache the pressure for speed*/
170  HYDRA_GET_PRIV(tw)->SPH_predicted = SPH_predicted;
171  HYDRA_GET_PRIV(tw)->PressurePred = (double *) mymalloc("PressurePred", SlotsManager->info[0].size * sizeof(double));
172  memset(HYDRA_GET_PRIV(tw)->PressurePred, 0, SlotsManager->info[0].size * sizeof(double));
173 
174  /* Compute pressure for active particles*/
175  if(act->ActiveParticle) {
176  #pragma omp parallel for
177  for(i = 0; i < act->NumActiveParticle; i++) {
178  int p_i = act->ActiveParticle[i];
179  if(P[p_i].Type != 0)
180  continue;
181  int pi = P[p_i].PI;
182  HYDRA_GET_PRIV(tw)->PressurePred[pi] = PressurePred(SPH_EOMDensity(&SphP[pi]), SPH_predicted->EntVarPred[pi]);
183  }
184  }
185  else{
186  /* Do it in slot order for memory locality*/
187  #pragma omp parallel for
188  for(i = 0; i < SlotsManager->info[0].size; i++)
189  HYDRA_GET_PRIV(tw)->PressurePred[i] = PressurePred(SPH_EOMDensity(&SphP[i]), SPH_predicted->EntVarPred[i]);
190  }
191 
192 
193  double timeall = 0, timenetwork = 0;
194  double timecomp, timecomm, timewait;
195 
196  walltime_measure("/SPH/Hydro/Init");
197 
198  /* Initialize some time factors*/
199  const double hubble = hubble_function(CP, atime);
200  HYDRA_GET_PRIV(tw)->fac_mu = pow(atime, 3 * (GAMMA - 1) / 2) / atime;
201  HYDRA_GET_PRIV(tw)->fac_vsic_fix = hubble * pow(atime, 3 * GAMMA_MINUS1);
202  HYDRA_GET_PRIV(tw)->atime = atime;
203  HYDRA_GET_PRIV(tw)->hubble_a2 = hubble * atime * atime;
204  priv->MinEgySpec = MinEgySpec;
205  priv->times = &times;
207  memset(priv->gravkicks, 0, sizeof(priv->gravkicks[0])*(TIMEBINS+1));
208  memset(priv->hydrokicks, 0, sizeof(priv->hydrokicks[0])*(TIMEBINS+1));
209  memset(priv->drifts, 0, sizeof(priv->drifts[0])*(TIMEBINS+1));
210  /* Compute the factors to move a current kick times velocity to the drift time velocity.
211  * We need to do the computation for all timebins up to the maximum because even inactive
212  * particles may have interactions. */
213  #pragma omp parallel for
214  for(i = times.mintimebin; i <= TIMEBINS; i++)
215  {
218  /* For density: last active drift time is Ti_kick - 1/2 timestep as the kick time is half a timestep ahead.
219  * For active particles no density drift is needed.*/
222  }
223 
225 
227  /* collect some timing information */
228 
229  timeall += walltime_measure(WALLTIME_IGNORE);
230 
231  timecomp = tw->timecomp1 + tw->timecomp2 + tw->timecomp3;
232  timewait = tw->timewait1 + tw->timewait2;
233  timecomm = tw->timecommsumm1 + tw->timecommsumm2;
234 
235  walltime_add("/SPH/Hydro/Compute", timecomp);
236  walltime_add("/SPH/Hydro/Wait", timewait);
237  walltime_add("/SPH/Hydro/Comm", timecomm);
238  walltime_add("/SPH/Hydro/Misc", timeall - (timecomp + timewait + timecomm + timenetwork));
239 }
240 
241 static void
242 hydro_copy(int place, TreeWalkQueryHydro * input, TreeWalk * tw)
243 {
244  double soundspeed_i;
245  MyFloat * velpred = HYDRA_GET_PRIV(tw)->SPH_predicted->VelPred;
246  /*Compute predicted velocity*/
247  input->Vel[0] = velpred[3 * P[place].PI];
248  input->Vel[1] = velpred[3 * P[place].PI + 1];
249  input->Vel[2] = velpred[3 * P[place].PI + 2];
250  input->Hsml = P[place].Hsml;
251  input->Mass = P[place].Mass;
252  input->Density = SPHP(place).Density;
253 
255  input->EgyRho = SPHP(place).EgyWtDensity;
256  MyFloat * entvarpred = HYDRA_GET_PRIV(tw)->SPH_predicted->EntVarPred;
257 
258  input->EntVarPred = entvarpred[P[place].PI];
259  }
260 
261  input->SPH_DhsmlDensityFactor = SPHP(place).DhsmlEgyDensityFactor;
262 
263  input->Pressure = HYDRA_GET_PRIV(tw)->PressurePred[P[place].PI];
264  input->dloga = get_dloga_for_bin(P[place].TimeBin, HYDRA_GET_PRIV(tw)->times->Ti_Current);
265  /* calculation of F1 */
266  soundspeed_i = sqrt(GAMMA * input->Pressure / SPH_EOMDensity(&SPHP(place)));
267  input->F1 = fabs(SPHP(place).DivVel) /
268  (fabs(SPHP(place).DivVel) + SPHP(place).CurlVel +
269  0.0001 * soundspeed_i / P[place].Hsml / HYDRA_GET_PRIV(tw)->fac_mu);
270 }
271 
272 static void
273 hydro_reduce(int place, TreeWalkResultHydro * result, enum TreeWalkReduceMode mode, TreeWalk * tw)
274 {
275  int k;
276 
277  for(k = 0; k < 3; k++)
278  {
279  TREEWALK_REDUCE(SPHP(place).HydroAccel[k], result->Acc[k]);
280  }
281 
282  TREEWALK_REDUCE(SPHP(place).DtEntropy, result->DtEntropy);
283 
284  if(mode == TREEWALK_PRIMARY || SPHP(place).MaxSignalVel < result->MaxSignalVel)
285  SPHP(place).MaxSignalVel = result->MaxSignalVel;
286 
287 }
288 
289 /* Find the density predicted forward to the current drift time.
290  * The Density in the SPHP struct is evaluated at the last time
291  * the particle was active. Good for both EgyWtDensity and Density,
292  * cube of the change in Hsml in drift.c. */
293 double
294 SPH_DensityPred(MyFloat Density, MyFloat DivVel, double dtdrift)
295 {
296  /* Note minus sign!*/
297  return Density - DivVel * Density * dtdrift;
298 }
299 
304 static void
306  TreeWalkQueryHydro * I,
308  TreeWalkNgbIterHydro * iter,
309  LocalTreeWalk * lv
310  )
311 {
312  if(iter->base.other == -1) {
313  iter->base.Hsml = I->Hsml;
314  iter->base.mask = 1;
316 
318  iter->soundspeed_i = sqrt(GAMMA * I->Pressure / I->EgyRho);
319  else
320  iter->soundspeed_i = sqrt(GAMMA * I->Pressure / I->Density);
321 
322  /* initialize variables before SPH loop is started */
323 
324  O->Acc[0] = O->Acc[1] = O->Acc[2] = O->DtEntropy = 0;
326 
328  iter->p_over_rho2_i = I->Pressure / (I->EgyRho * I->EgyRho);
329  else
330  iter->p_over_rho2_i = I->Pressure / (I->Density * I->Density);
331 
332  O->MaxSignalVel = iter->soundspeed_i;
333  return;
334  }
335 
336  int other = iter->base.other;
337  double rsq = iter->base.r2;
338  double * dist = iter->base.dist;
339  double r = iter->base.r;
340 
341  if(P[other].Mass == 0) {
342  endrun(12, "Encountered zero mass particle during hydro;"
343  " We haven't implemented tracer particles and this shall not happen\n");
344  }
345 
346  /* Wind particles do not interact hydrodynamically: don't produce hydro acceleration
347  * or change the signalvel.*/
348  if(winds_is_particle_decoupled(other))
349  return;
350 
351  DensityKernel kernel_j;
352 
353  density_kernel_init(&kernel_j, P[other].Hsml, GetDensityKernelType());
354 
355  /* Check we are within the density kernel*/
356  if(rsq <= 0 || !(rsq < iter->kernel_i.HH || rsq < kernel_j.HH))
357  return;
358 
359  struct HydraPriv * priv = HYDRA_GET_PRIV(lv->tw);
360 
361  double EntVarPred;
362  #pragma omp atomic read
363  EntVarPred = HYDRA_GET_PRIV(lv->tw)->SPH_predicted->EntVarPred[P[other].PI];
364  /* Lazily compute the predicted quantities. We need to do this again here, even though we do it in density,
365  * because this treewalk is symmetric and that one is asymmetric. In density() hmax has not been computed
366  * yet so we cannot merge them. We can do this
367  * with minimal locking since nothing happens should we compute them twice.
368  * Zero can be the special value since there should never be zero entropy.*/
369  MyFloat VelPred[3];
370  if(EntVarPred == 0) {
371  int bin = P[other].TimeBin;
372  double a3inv = pow(priv->atime, -3);
373  double dloga = dloga_from_dti(priv->times->Ti_Current - priv->times->Ti_kick[bin], priv->times->Ti_Current);
374  EntVarPred = SPH_EntVarPred(P[other].PI, priv->MinEgySpec, a3inv, dloga);
375  SPH_VelPred(other, VelPred, priv->FgravkickB, priv->gravkicks[bin], priv->hydrokicks[bin]);
376  /* Note this goes first to avoid threading issues: EntVarPred will only be set after this is done.
377  * The worst that can happen is that some data points get copied twice.*/
378  int i;
379  for(i = 0; i < 3; i++) {
380  #pragma omp atomic write
381  priv->SPH_predicted->VelPred[3 * P[other].PI + i] = VelPred[i];
382  }
383  #pragma omp atomic write
384  priv->SPH_predicted->EntVarPred[P[other].PI] = EntVarPred;
385  }
386  else {
387  int i;
388  for(i = 0; i < 3; i++) {
389  #pragma omp atomic read
390  VelPred[i] = priv->SPH_predicted->VelPred[3 * P[other].PI + i];
391  }
392  }
393 
394  /* Predict densities. Note that for active timebins the density is up to date so SPH_DensityPred is just returns the current densities.
395  * This improves on the technique used in Gadget-2 by being a linear prediction that does not become pathological in deep timebins.*/
396  int bin = P[other].TimeBin;
397  const double density_j = SPH_DensityPred(SPHP(other).Density, SPHP(other).DivVel, priv->drifts[bin]);
398  const double eomdensity = SPH_DensityPred(SPH_EOMDensity(&SPHP(other)), SPHP(other).DivVel, priv->drifts[bin]);;
399 
400  /* Compute pressure lazily*/
401  double Pressure_j;
402  #pragma omp atomic read
403  Pressure_j = HYDRA_GET_PRIV(lv->tw)->PressurePred[P[other].PI];
404  if(Pressure_j == 0) {
405  Pressure_j = PressurePred(eomdensity, EntVarPred);
406  #pragma omp atomic write
407  priv->PressurePred[P[other].PI] = Pressure_j;
408  }
409 
410  double p_over_rho2_j = Pressure_j / (eomdensity * eomdensity);
411  double soundspeed_j = sqrt(GAMMA * Pressure_j / eomdensity);
412 
413  double dv[3];
414  int d;
415  for(d = 0; d < 3; d++) {
416  dv[d] = I->Vel[d] - VelPred[d];
417  }
418 
419  double vdotr = dotproduct(dist, dv);
420  double vdotr2 = vdotr + HYDRA_GET_PRIV(lv->tw)->hubble_a2 * rsq;
421 
422  double dwk_i = density_kernel_dwk(&iter->kernel_i, r * iter->kernel_i.Hinv);
423  double dwk_j = density_kernel_dwk(&kernel_j, r * kernel_j.Hinv);
424 
425  double visc = 0;
426 
427  if(vdotr2 < 0) /* ... artificial viscosity visc is 0 by default*/
428  {
429  /*See Gadget-2 paper: eq. 13*/
430  const double mu_ij = HYDRA_GET_PRIV(lv->tw)->fac_mu * vdotr2 / r; /* note: this is negative! */
431  const double rho_ij = 0.5 * (I->Density + density_j);
432  double vsig = iter->soundspeed_i + soundspeed_j;
433 
434  vsig -= 3 * mu_ij;
435 
436  if(vsig > O->MaxSignalVel)
437  O->MaxSignalVel = vsig;
438 
439  /* Note this uses the CurlVel of an inactive particle, which is not at the present drift time*/
440  const double f2 = fabs(SPHP(other).DivVel) / (fabs(SPHP(other).DivVel) +
441  SPHP(other).CurlVel + 0.0001 * soundspeed_j / HYDRA_GET_PRIV(lv->tw)->fac_mu / P[other].Hsml);
442 
443  /*Gadget-2 paper, eq. 14*/
444  visc = 0.25 * HydroParams.ArtBulkViscConst * vsig * (-mu_ij) / rho_ij * (I->F1 + f2);
445  /* .... end artificial viscosity evaluation */
446  /* now make sure that viscous acceleration is not too large */
447 
448  /*XXX: why is this dloga ?*/
449  double dloga = 2 * DMAX(I->dloga, get_dloga_for_bin(P[other].TimeBin, HYDRA_GET_PRIV(lv->tw)->times->Ti_Current));
450  if(dloga > 0 && (dwk_i + dwk_j) < 0)
451  {
452  if((I->Mass + P[other].Mass) > 0) {
453  visc = DMIN(visc, 0.5 * HYDRA_GET_PRIV(lv->tw)->fac_vsic_fix * vdotr2 /
454  (0.5 * (I->Mass + P[other].Mass) * (dwk_i + dwk_j) * r * dloga));
455  }
456  }
457  }
458  const double hfc_visc = 0.5 * P[other].Mass * visc * (dwk_i + dwk_j) / r;
459  double hfc = hfc_visc;
460  double rr1 = 1, rr2 = 1;
461 
463  /*This enables the grad-h corrections*/
464  rr1 = 0, rr2 = 0;
465  /* leading-order term */
466  hfc += P[other].Mass *
467  (dwk_i*iter->p_over_rho2_i*EntVarPred/I->EntVarPred +
468  dwk_j*p_over_rho2_j*I->EntVarPred/EntVarPred) / r;
469 
470  /* enable grad-h corrections only if contrastlimit is non negative */
472  rr1 = I->EgyRho / I->Density;
473  rr2 = eomdensity / density_j;
475  /* apply the limit if it is enabled > 0*/
478  }
479  }
480  }
481 
482  /* grad-h corrections: enabled if DensityIndependentSphOn = 0, or DensityConstrastLimit >= 0 */
483  /* Formulation derived from the Lagrangian */
484  hfc += P[other].Mass * (iter->p_over_rho2_i*I->SPH_DhsmlDensityFactor * dwk_i * rr1
485  + p_over_rho2_j*SPHP(other).DhsmlEgyDensityFactor * dwk_j * rr2) / r;
486 
487  for(d = 0; d < 3; d ++)
488  O->Acc[d] += (-hfc * dist[d]);
489 
490  O->DtEntropy += (0.5 * hfc_visc * vdotr2);
491 
492 }
493 
494 static int
496 {
497  return P[i].Type == 0;
498 }
499 
500 static void
502 {
503  if(P[i].Type == 0)
504  {
505  /* Translate energy change rate into entropy change rate */
506  SPHP(i).DtEntropy *= GAMMA_MINUS1 / (HYDRA_GET_PRIV(tw)->hubble_a2 * pow(SPHP(i).Density, GAMMA_MINUS1));
507 
508  /* if we have winds, we decouple particles briefly if delaytime>0 */
510  {
512  }
513  }
514 }
double hubble_function(const Cosmology *CP, double a)
Definition: cosmology.c:58
void SPH_VelPred(int i, MyFloat *VelPred, const double FgravkickB, double gravkick, double hydrokick)
Definition: density.c:89
MyFloat SPH_EntVarPred(int PI, double MinEgySpec, double a3inv, double dloga)
Definition: density.c:71
enum DensityKernelType GetDensityKernelType(void)
Definition: density.c:63
double density_kernel_dwk(DensityKernel *kernel, double u)
void density_kernel_init(DensityKernel *kernel, double H, enum DensityKernelType type)
static double dotproduct(const double v1[3], const double v2[3])
Definition: densitykernel.h:53
void endrun(int where, const char *fmt,...)
Definition: endrun.c:147
static void hydro_reduce(int place, TreeWalkResultHydro *result, enum TreeWalkReduceMode mode, TreeWalk *tw)
Definition: hydra.c:273
static void hydro_copy(int place, TreeWalkQueryHydro *input, TreeWalk *tw)
Definition: hydra.c:242
static MyFloat SPH_EOMDensity(const struct sph_particle_data *const pi)
Definition: hydra.c:56
static void hydro_ngbiter(TreeWalkQueryHydro *I, TreeWalkResultHydro *O, TreeWalkNgbIterHydro *iter, LocalTreeWalk *lv)
Definition: hydra.c:305
static void hydro_postprocess(int i, TreeWalk *tw)
Definition: hydra.c:501
void hydro_force(const ActiveParticles *act, const double atime, struct sph_pred_data *SPH_predicted, double MinEgySpec, const DriftKickTimes times, Cosmology *CP, const ForceTree *const tree)
Definition: hydra.c:147
static double PressurePred(MyFloat EOMDensityPred, double EntVarPred)
Definition: hydra.c:67
double SPH_DensityPred(MyFloat Density, MyFloat DivVel, double dtdrift)
Definition: hydra.c:294
void set_hydro_params(ParameterSet *ps)
Definition: hydra.c:37
int DensityIndependentSphOn(void)
Definition: hydra.c:49
static struct hydro_params HydroParams
#define HYDRA_GET_PRIV(tw)
Definition: hydra.c:89
static int hydro_haswork(int n, TreeWalk *tw)
Definition: hydra.c:495
static double dloga
Definition: lightcone.c:21
#define mymalloc(name, size)
Definition: mymalloc.h:15
#define myfree(x)
Definition: mymalloc.h:19
double param_get_double(ParameterSet *ps, const char *name)
Definition: paramset.c:336
int param_get_int(ParameterSet *ps, const char *name)
Definition: paramset.c:368
#define P
Definition: partmanager.h:88
#define GAMMA_MINUS1
Definition: physconst.h:35
#define GAMMA
Definition: physconst.h:34
static Cosmology * CP
Definition: power.c:27
struct slots_manager_type SlotsManager[1]
Definition: slotsmanager.c:7
#define SPHP(i)
Definition: slotsmanager.h:124
#define SphP
Definition: slotsmanager.h:119
int * ActiveParticle
Definition: timestep.h:13
int64_t NumActiveParticle
Definition: timestep.h:12
inttime_t PM_kick
Definition: timestep.h:31
inttime_t Ti_lastactivedrift[TIMEBINS+1]
Definition: timestep.h:25
inttime_t Ti_Current
Definition: timestep.h:27
inttime_t Ti_kick[TIMEBINS+1]
Definition: timestep.h:23
int mintimebin
Definition: timestep.h:20
int hmax_computed_flag
Definition: forcetree.h:80
double fac_mu
Definition: hydra.c:77
double hubble_a2
Definition: hydra.c:79
double drifts[TIMEBINS+1]
Definition: hydra.c:86
double gravkicks[TIMEBINS+1]
Definition: hydra.c:84
double * PressurePred
Definition: hydra.c:73
double MinEgySpec
Definition: hydra.c:82
double atime
Definition: hydra.c:80
double FgravkickB
Definition: hydra.c:83
DriftKickTimes const * times
Definition: hydra.c:81
double hydrokicks[TIMEBINS+1]
Definition: hydra.c:85
struct sph_pred_data * SPH_predicted
Definition: hydra.c:74
double fac_vsic_fix
Definition: hydra.c:78
TreeWalk * tw
Definition: treewalk.h:47
double dist[3]
Definition: treewalk.h:40
enum NgbTreeFindSymmetric symmetric
Definition: treewalk.h:37
DensityKernel kernel_i
Definition: hydra.c:119
double soundspeed_i
Definition: hydra.c:117
TreeWalkNgbIterBase base
Definition: hydra.c:115
double p_over_rho2_i
Definition: hydra.c:116
double Vel[3]
Definition: hydra.c:97
TreeWalkQueryBase base
Definition: hydra.c:92
MyFloat EntVarPred
Definition: hydra.c:95
MyFloat Hsml
Definition: hydra.c:98
MyFloat Pressure
Definition: hydra.c:101
MyFloat EgyRho
Definition: hydra.c:94
MyFloat F1
Definition: hydra.c:102
MyFloat Density
Definition: hydra.c:100
MyFloat Mass
Definition: hydra.c:99
MyFloat dloga
Definition: hydra.c:104
MyFloat SPH_DhsmlDensityFactor
Definition: hydra.c:103
MyFloat Acc[3]
Definition: hydra.c:109
MyFloat DtEntropy
Definition: hydra.c:110
MyFloat MaxSignalVel
Definition: hydra.c:111
TreeWalkResultBase base
Definition: hydra.c:108
void * priv
Definition: treewalk.h:85
TreeWalkHasWorkFunction haswork
Definition: treewalk.h:100
size_t ngbiter_type_elsize
Definition: treewalk.h:97
double timecomp2
Definition: treewalk.h:124
double timecomp3
Definition: treewalk.h:125
double timecommsumm1
Definition: treewalk.h:126
const ForceTree * tree
Definition: treewalk.h:88
TreeWalkProcessFunction postprocess
Definition: treewalk.h:104
TreeWalkNgbIterFunction ngbiter
Definition: treewalk.h:103
TreeWalkReduceResultFunction reduce
Definition: treewalk.h:102
const char * ev_label
Definition: treewalk.h:91
double timewait2
Definition: treewalk.h:122
TreeWalkVisitFunction visit
Definition: treewalk.h:99
size_t result_type_elsize
Definition: treewalk.h:96
TreeWalkFillQueryFunction fill
Definition: treewalk.h:101
double timecomp1
Definition: treewalk.h:123
double timewait1
Definition: treewalk.h:121
double timecommsumm2
Definition: treewalk.h:127
size_t query_type_elsize
Definition: treewalk.h:95
int DensityIndependentSphOn
Definition: hydra.c:28
double DensityContrastLimit
Definition: hydra.c:30
double ArtBulkViscConst
Definition: hydra.c:32
int64_t size
Definition: slotsmanager.h:12
struct slot_info info[6]
Definition: slotsmanager.h:112
MyFloat EgyWtDensity
Definition: slotsmanager.h:85
MyFloat * EntVarPred
Definition: density.h:28
MyFloat * VelPred
Definition: density.h:34
int ThisTask
Definition: test_exchange.c:23
#define DMIN(x, y)
Definition: test_interp.c:12
#define DMAX(x, y)
Definition: test_interp.c:11
double dloga_from_dti(inttime_t dti, const inttime_t Ti_Current)
Definition: timebinmgr.c:256
double get_dloga_for_bin(int timebin, const inttime_t Ti_Current)
Definition: timebinmgr.c:279
#define TIMEBINS
Definition: timebinmgr.h:13
double get_exact_hydrokick_factor(Cosmology *CP, inttime_t ti0, inttime_t ti1)
Definition: timefac.c:75
double get_exact_drift_factor(Cosmology *CP, inttime_t ti0, inttime_t ti1)
Definition: timefac.c:64
double get_exact_gravkick_factor(Cosmology *CP, inttime_t ti0, inttime_t ti1)
Definition: timefac.c:70
int is_timebin_active(int i, inttime_t current)
Definition: timestep.c:149
int treewalk_visit_ngbiter(TreeWalkQueryBase *I, TreeWalkResultBase *O, LocalTreeWalk *lv)
Definition: treewalk.c:924
void treewalk_run(TreeWalk *tw, int *active_set, size_t size)
Definition: treewalk.c:619
int(* TreeWalkVisitFunction)(TreeWalkQueryBase *input, TreeWalkResultBase *output, LocalTreeWalk *lv)
Definition: treewalk.h:68
void(* TreeWalkReduceResultFunction)(const int j, TreeWalkResultBase *result, const enum TreeWalkReduceMode mode, TreeWalk *tw)
Definition: treewalk.h:76
TreeWalkReduceMode
Definition: treewalk.h:15
@ TREEWALK_PRIMARY
Definition: treewalk.h:16
void(* TreeWalkProcessFunction)(const int i, TreeWalk *tw)
Definition: treewalk.h:73
void(* TreeWalkNgbIterFunction)(TreeWalkQueryBase *input, TreeWalkResultBase *output, TreeWalkNgbIterBase *iter, LocalTreeWalk *lv)
Definition: treewalk.h:70
void(* TreeWalkFillQueryFunction)(const int j, TreeWalkQueryBase *query, TreeWalk *tw)
Definition: treewalk.h:75
#define TREEWALK_REDUCE(A, B)
Definition: treewalk.h:189
@ NGB_TREEFIND_SYMMETRIC
Definition: treewalk.h:11
LOW_PRECISION MyFloat
Definition: types.h:19
#define walltime_measure(name)
Definition: walltime.h:8
#define WALLTIME_IGNORE
Definition: walltime.h:6
#define walltime_add(name, dt)
Definition: walltime.h:9
int winds_is_particle_decoupled(int i)
Definition: winds.c:124
void winds_decoupled_hydro(int i, double atime)
Definition: winds.c:133