Peano
Loading...
Searching...
No Matches
hydro.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of SWIFT.
3 * Copyright (c) 2016 Matthieu Schaller (schaller@strw.leidenuniv.nl)
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19#ifndef SWIFT_MINIMAL_HYDRO_H
20#define SWIFT_MINIMAL_HYDRO_H
21
36#include "adiabatic_index.h"
37#include "approx_math.h"
38#include "cosmology.h"
39#include "dimension.h"
40#include "entropy_floor.h"
41#include "equation_of_state.h"
42#include "hydro_parameters.h"
43#include "hydro_properties.h"
44//#include "hydro_space.h"
45#include "kernel_hydro.h"
46#include "minmax.h"
47//#include "pressure_floor.h"
48
56__attribute__((always_inline)) INLINE static float
57hydro_get_comoving_internal_energy(const struct part *restrict p,
58 const struct xpart *restrict xp) {
59
60 return xp->u_full;
61}
62
71__attribute__((always_inline)) INLINE static float
72hydro_get_physical_internal_energy(const struct part *restrict p,
73 const struct xpart *restrict xp,
74 const struct cosmology *cosmo) {
75
76 return xp->u_full * cosmo->a_factor_internal_energy;
77}
78
85__attribute__((always_inline)) INLINE static float
86hydro_get_drifted_comoving_internal_energy(const struct part *restrict p) {
87
88 return p->u;
89}
90
98__attribute__((always_inline)) INLINE static float
99hydro_get_drifted_physical_internal_energy(const struct part *restrict p,
100 const struct cosmology *cosmo) {
101
102 return p->u * cosmo->a_factor_internal_energy;
103}
104
112__attribute__((always_inline)) INLINE static float hydro_get_comoving_pressure(
113 const struct part *restrict p) {
114
115 return gas_pressure_from_internal_energy(p->rho, p->u);
116}
117
127__attribute__((always_inline)) INLINE static float hydro_get_physical_pressure(
128 const struct part *restrict p, const struct cosmology *cosmo) {
129
130 return cosmo->a_factor_pressure *
131 gas_pressure_from_internal_energy(p->rho, p->u);
132}
133
141__attribute__((always_inline)) INLINE static float hydro_get_comoving_entropy(
142 const struct part *restrict p, const struct xpart *restrict xp) {
143
144 return gas_entropy_from_internal_energy(p->rho, xp->u_full);
145}
146
155__attribute__((always_inline)) INLINE static float hydro_get_physical_entropy(
156 const struct part *restrict p, const struct xpart *restrict xp,
157 const struct cosmology *cosmo) {
158
159 /* Note: no cosmological conversion required here with our choice of
160 * coordinates. */
161 return gas_entropy_from_internal_energy(p->rho, xp->u_full);
162}
163
170__attribute__((always_inline)) INLINE static float
171hydro_get_drifted_comoving_entropy(const struct part *restrict p) {
172
173 return gas_entropy_from_internal_energy(p->rho, p->u);
174}
175
183__attribute__((always_inline)) INLINE static float
184hydro_get_drifted_physical_entropy(const struct part *restrict p,
185 const struct cosmology *cosmo) {
186
187 /* Note: no cosmological conversion required here with our choice of
188 * coordinates. */
189 return gas_entropy_from_internal_energy(p->rho, p->u);
190}
191
197__attribute__((always_inline)) INLINE static float
198hydro_get_comoving_soundspeed(const struct part *restrict p) {
199
200 return p->force.soundspeed;
201}
202
209__attribute__((always_inline)) INLINE static float
210hydro_get_physical_soundspeed(const struct part *restrict p,
211 const struct cosmology *cosmo) {
212
213 return cosmo->a_factor_sound_speed * p->force.soundspeed;
214}
215
221__attribute__((always_inline)) INLINE static float hydro_get_comoving_density(
222 const struct part *restrict p) {
223
224 return p->rho;
225}
226
233__attribute__((always_inline)) INLINE static float hydro_get_physical_density(
234 const struct part *restrict p, const struct cosmology *cosmo) {
235
236 return cosmo->a3_inv * p->rho;
237}
238
244__attribute__((always_inline)) INLINE static float hydro_get_mass(
245 const struct part *restrict p) {
246
247 return p->mass;
248}
249
256__attribute__((always_inline)) INLINE static void hydro_set_mass(
257 struct part *restrict p, float m) {
258
259 p->mass = m;
260}
261
269__attribute__((always_inline)) INLINE static float
270hydro_get_comoving_internal_energy_dt(const struct part *restrict p) {
271
272 return p->u_dt;
273}
274
283__attribute__((always_inline)) INLINE static float
284hydro_get_physical_internal_energy_dt(const struct part *restrict p,
285 const struct cosmology *cosmo) {
286
287 return p->u_dt * cosmo->a_factor_internal_energy;
288}
289
299__attribute__((always_inline)) INLINE static void
300hydro_set_comoving_internal_energy_dt(struct part *restrict p, float du_dt) {
301
302 p->u_dt = du_dt;
303}
304
314__attribute__((always_inline)) INLINE static void
315hydro_set_physical_internal_energy_dt(struct part *restrict p,
316 const struct cosmology *cosmo,
317 float du_dt) {
318
319 p->u_dt = du_dt / cosmo->a_factor_internal_energy;
320}
321
330__attribute__((always_inline)) INLINE static void hydro_set_physical_entropy(
331 struct part *p, struct xpart *xp, const struct cosmology *cosmo,
332 const float entropy) {
333
334 /* Note there is no conversion from physical to comoving entropy */
335 const float comoving_entropy = entropy;
336 xp->u_full = gas_internal_energy_from_entropy(p->rho, comoving_entropy);
337}
338
347__attribute__((always_inline)) INLINE static void
348hydro_set_physical_internal_energy(struct part *p, struct xpart *xp,
349 const struct cosmology *cosmo,
350 const float u) {
351
352 xp->u_full = u / cosmo->a_factor_internal_energy;
353}
354
362__attribute__((always_inline)) INLINE static void
363hydro_set_drifted_physical_internal_energy(
364 struct part *p, const struct cosmology *cosmo,
365 const struct pressure_floor_props *pressure_floor, const float u) {
366
367 p->u = u / cosmo->a_factor_internal_energy;
368
369 /* Now recompute the extra quantities */
370
371 /* Compute the sound speed */
372 const float pressure = gas_pressure_from_internal_energy(p->rho, p->u);
373 const float soundspeed = gas_soundspeed_from_pressure(p->rho, pressure);
374
375 /* Update variables. */
376 p->force.pressure = pressure;
377 p->force.soundspeed = soundspeed;
378
379 p->force.v_sig = MAX(p->force.v_sig, 2.f * soundspeed);
380}
381
391__attribute__((always_inline)) INLINE static void
392hydro_set_v_sig_based_on_velocity_kick(struct part *p,
393 const struct cosmology *cosmo,
394 const float dv_phys) {
395
396 /* Compute the velocity kick in comoving coordinates */
397 const float dv = dv_phys / cosmo->a_factor_sound_speed;
398
399 /* Sound speed */
400 const float soundspeed = hydro_get_comoving_soundspeed(p);
401
402 /* Update the signal velocity */
403 p->force.v_sig =
404 MAX(2.f * soundspeed, p->force.v_sig + const_viscosity_beta * dv);
405}
406
413__attribute__((always_inline)) INLINE static void hydro_set_viscosity_alpha(
414 struct part *restrict p, float alpha) {
415 /* This scheme has fixed alpha */
416}
417
424__attribute__((always_inline)) INLINE static void
425hydro_diffusive_feedback_reset(struct part *restrict p) {
426 /* This scheme has fixed alpha */
427}
428
440__attribute__((always_inline)) INLINE static float hydro_compute_timestep(
441 const struct part *restrict p, const struct xpart *restrict xp,
442 const struct hydro_props *restrict hydro_properties,
443 const struct cosmology *restrict cosmo) {
444
445 const float CFL_condition = hydro_properties->CFL_condition;
446
447 /* CFL condition */
448 const float dt_cfl = 2.f * kernel_gamma * CFL_condition * cosmo->a * p->h /
449 (cosmo->a_factor_sound_speed * p->force.v_sig);
450
451 return dt_cfl;
452}
453
466__attribute__((always_inline)) INLINE static float hydro_signal_velocity(
467 const float dx[3], const struct part *restrict pi,
468 const struct part *restrict pj, const float mu_ij, const float beta) {
469
470 const float ci = pi->force.soundspeed;
471 const float cj = pj->force.soundspeed;
472
473 return ci + cj - beta * mu_ij;
474}
475
481__attribute__((always_inline)) INLINE static float hydro_get_signal_velocity(
482 const struct part *restrict p) {
483
484 return p->force.v_sig;
485}
491__attribute__((always_inline)) INLINE static float hydro_get_div_v(
492 const struct part *restrict p) {
493
494 return p->density.div_v;
495}
496
504__attribute__((always_inline)) INLINE static void hydro_timestep_extra(
505 struct part *p, float dt) {}
506
517__attribute__((always_inline)) INLINE static void hydro_init_part(
518 struct part *restrict p, const struct hydro_space *hs) {
519
520 p->density.wcount = 0.f;
521 p->density.wcount_dh = 0.f;
522 p->rho = 0.f;
523 p->density.rho_dh = 0.f;
524 p->density.div_v = 0.f;
525 p->density.rot_v[0] = 0.f;
526 p->density.rot_v[1] = 0.f;
527 p->density.rot_v[2] = 0.f;
528}
529
543__attribute__((always_inline)) INLINE static void hydro_end_density(
544 struct part *restrict p, const struct cosmology *cosmo) {
545
546 /* Some smoothing length multiples. */
547 const float h = p->h;
548 const float h_inv = 1.0f / h; /* 1/h */
549 const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */
550 const float h_inv_dim_plus_one = h_inv_dim * h_inv; /* 1/h^(d+1) */
551
552 /* Final operation on the density (add self-contribution). */
553 p->rho += p->mass * kernel_root;
554 p->density.rho_dh -= hydro_dimension * p->mass * kernel_root;
555 p->density.wcount += kernel_root;
556 p->density.wcount_dh -= hydro_dimension * kernel_root;
557
558 /* Finish the calculation by inserting the missing h-factors */
559 p->rho *= h_inv_dim;
560 p->density.rho_dh *= h_inv_dim_plus_one;
561 p->density.wcount *= h_inv_dim;
562 p->density.wcount_dh *= h_inv_dim_plus_one;
563
564 const float rho_inv = 1.f / p->rho;
565 const float a_inv2 = cosmo->a2_inv;
566
567 /* Finish calculation of the (physical) velocity curl components */
568 p->density.rot_v[0] *= h_inv_dim_plus_one * a_inv2 * rho_inv;
569 p->density.rot_v[1] *= h_inv_dim_plus_one * a_inv2 * rho_inv;
570 p->density.rot_v[2] *= h_inv_dim_plus_one * a_inv2 * rho_inv;
571
572 /* Finish calculation of the (physical) velocity divergence */
573 p->density.div_v *= h_inv_dim_plus_one * a_inv2 * rho_inv;
574}
575
587__attribute__((always_inline)) INLINE static void hydro_prepare_gradient(
588 struct part *restrict p, struct xpart *restrict xp,
589 const struct cosmology *cosmo, const struct hydro_props *hydro_props,
590 const struct pressure_floor_props *pressure_floor) {}
591
602__attribute__((always_inline)) INLINE static void hydro_reset_gradient(
603 struct part *restrict p) {}
604
612__attribute__((always_inline)) INLINE static void hydro_end_gradient(
613 struct part *p) {}
614
626__attribute__((always_inline)) INLINE static void hydro_part_has_no_neighbours(
627 struct part *restrict p, struct xpart *restrict xp,
628 const struct cosmology *cosmo) {
629
630 /* Some smoothing length multiples. */
631 const float h = p->h;
632 const float h_inv = 1.0f / h; /* 1/h */
633 const float h_inv_dim = pow_dimension(h_inv); /* 1/h^d */
634
635 printf(
636 "Gas particle with ID %lld treated as having no neighbours (h: %g, "
637 "wcount: %g).",
638 p->id, h, p->density.wcount);
639
640 /* Re-set problematic values */
641 p->rho = p->mass * kernel_root * h_inv_dim;
642 p->density.wcount = kernel_root * h_inv_dim;
643 p->density.rho_dh = 0.f;
644 p->density.wcount_dh = 0.f;
645 p->density.div_v = 0.f;
646 p->density.rot_v[0] = 0.f;
647 p->density.rot_v[1] = 0.f;
648 p->density.rot_v[2] = 0.f;
649}
650
669__attribute__((always_inline)) INLINE static void hydro_prepare_force(
670 struct part *restrict p, struct xpart *restrict xp,
671 const struct cosmology *cosmo, const struct hydro_props *hydro_props,
672 const struct pressure_floor_props *pressure_floor, const float dt_alpha,
673 const float dt_therm) {
674
675 const float fac_Balsara_eps = cosmo->a_factor_Balsara_eps;
676
677 /* Inverse of the smoothing length */
678 const float h_inv = 1.f / p->h;
679
680 /* Compute the norm of the curl */
681 const float curl_v = sqrtf(p->density.rot_v[0] * p->density.rot_v[0] +
682 p->density.rot_v[1] * p->density.rot_v[1] +
683 p->density.rot_v[2] * p->density.rot_v[2]);
684
685 /* Compute the norm of div v including the Hubble flow term */
686 const float div_physical_v = p->density.div_v + hydro_dimension * cosmo->H;
687 const float abs_div_physical_v = fabsf(div_physical_v);
688
689 /* Compute the pressure */
690 const float pressure = gas_pressure_from_internal_energy(p->rho, p->u);
691
692 /* Compute the sound speed */
693 const float soundspeed = gas_soundspeed_from_pressure(p->rho, pressure);
694
695 /* Compute the "grad h" term - Note here that we have \tilde{x}
696 * as 1 as we use the local number density to find neighbours. This
697 * introduces a j-component that is considered in the force loop,
698 * meaning that this cached grad_h_term gives:
699 *
700 * f_ij = 1.f - grad_h_term_i / m_j */
701 const float common_factor = p->h * hydro_dimension_inv / p->density.wcount;
702
703 float grad_h_term;
704 /* Ignore changing-kernel effects when h ~= h_max */
705 if (p->h > 0.9999f * hydro_props->h_max) {
706 grad_h_term = 0.f;
707 printf("h ~ h_max for particle with ID %lld (h: %g)", p->id, p->h);
708 } else {
709 const float grad_W_term = common_factor * p->density.wcount_dh;
710 if (grad_W_term < -0.9999f) {
711 /* if we get here, we either had very small neighbour contributions
712 (which should be treated as a no neighbour case in the ghost) or
713 a very weird particle distribution (e.g. particles sitting on
714 top of each other). Either way, we cannot use the normal
715 expression, since that would lead to overflow or excessive round
716 off and cause excessively high accelerations in the force loop */
717 grad_h_term = 0.f;
718 printf(
719 "grad_W_term very small for particle with ID %lld (h: %g, wcount: "
720 "%g, wcount_dh: %g).",
721 p->id, p->h, p->density.wcount, p->density.wcount_dh);
722 } else {
723 grad_h_term = common_factor * p->density.rho_dh / (1.f + grad_W_term);
724 }
725 }
726
727 /* Compute the Balsara switch */
728 /* Pre-multiply in the AV factor; hydro_props are not passed to the iact
729 * functions */
730 const float balsara = hydro_props->viscosity.alpha * abs_div_physical_v /
731 (abs_div_physical_v + curl_v +
732 0.0001f * fac_Balsara_eps * soundspeed * h_inv);
733
734 /* Update variables. */
735 p->force.f = grad_h_term;
736 p->force.pressure = pressure;
737 p->force.soundspeed = soundspeed;
738 p->force.balsara = balsara;
739}
740
749__attribute__((always_inline)) INLINE static void hydro_reset_acceleration(
750 struct part *restrict p) {
751
752 /* Reset the acceleration. */
753 p->a_hydro[0] = 0.0f;
754 p->a_hydro[1] = 0.0f;
755 p->a_hydro[2] = 0.0f;
756
757 /* Reset the time derivatives. */
758 p->u_dt = 0.0f;
759 p->force.h_dt = 0.0f;
760 p->force.v_sig = 2.f * p->force.soundspeed;
761}
762
771__attribute__((always_inline)) INLINE static void hydro_reset_predicted_values(
772 struct part *restrict p, const struct xpart *restrict xp,
773 const struct cosmology *cosmo,
774 const struct pressure_floor_props *pressure_floor) {
775
776 /* Re-set the predicted velocities */
777 p->v[0] = xp->v_full[0];
778 p->v[1] = xp->v_full[1];
779 p->v[2] = xp->v_full[2];
780
781 /* Re-set the entropy */
782 p->u = xp->u_full;
783
784 /* Re-compute the pressure */
785 const float pressure = gas_pressure_from_internal_energy(p->rho, p->u);
786
787 /* Compute the new sound speed */
788 const float soundspeed = gas_soundspeed_from_pressure(p->rho, pressure);
789
790 /* Update variables */
791 p->force.pressure = pressure;
792 p->force.soundspeed = soundspeed;
793
794 p->force.v_sig = MAX(p->force.v_sig, 2.f * soundspeed);
795}
796
815__attribute__((always_inline)) INLINE static void hydro_predict_extra(
816 struct part *restrict p, const struct xpart *restrict xp, float dt_drift,
817 float dt_therm, float dt_kick_grav, const struct cosmology *cosmo,
818 const struct hydro_props *hydro_props,
819 const struct entropy_floor_properties *floor_props,
820 const struct pressure_floor_props *pressure_floor) {
821
822 /* Predict the internal energy */
823 p->u += p->u_dt * dt_therm;
824
825 const float h_inv = 1.f / p->h;
826
827 /* Predict smoothing length */
828 const float w1 = p->force.h_dt * h_inv * dt_drift;
829 if (fabsf(w1) < 0.2f) {
830 p->h *= approx_expf(w1); /* 4th order expansion of exp(w) */
831 } else {
832 p->h *= expf(w1);
833 }
834
835 /* Predict density */
836 const float w2 = -hydro_dimension * w1;
837 if (fabsf(w2) < 0.2f) {
838 p->rho *= approx_expf(w2); /* 4th order expansion of exp(w) */
839 } else {
840 p->rho *= expf(w2);
841 }
842
843 /* Check against entropy floor */
844 const float floor_A = entropy_floor(p, cosmo, floor_props);
845 const float floor_u = gas_internal_energy_from_entropy(p->rho, floor_A);
846
847 /* Check against absolute minimum */
848 const float min_u =
849 hydro_props->minimal_internal_energy / cosmo->a_factor_internal_energy;
850
851 p->u = MAX(p->u, floor_u);
852 p->u = MAX(p->u, min_u);
853
854 /* Compute the new pressure */
855 const float pressure = gas_pressure_from_internal_energy(p->rho, p->u);
856
857 /* Compute the new sound speed */
858 const float soundspeed = gas_soundspeed_from_pressure(p->rho, pressure);
859
860 p->force.pressure = pressure;
861 p->force.soundspeed = soundspeed;
862
863 p->force.v_sig = MAX(p->force.v_sig, 2.f * soundspeed);
864}
865
878__attribute__((always_inline)) INLINE static void hydro_end_force(
879 struct part *restrict p, const struct cosmology *cosmo) {
880
881 p->force.h_dt *= p->h * hydro_dimension_inv;
882}
883
901__attribute__((always_inline)) INLINE static void hydro_kick_extra(
902 struct part *restrict p, struct xpart *restrict xp, float dt_therm,
903 float dt_grav, float dt_grav_mesh, float dt_hydro, float dt_kick_corr,
904 const struct cosmology *cosmo, const struct hydro_props *hydro_props,
905 const struct entropy_floor_properties *floor_props) {
906
907 /* Integrate the internal energy forward in time */
908 const float delta_u = p->u_dt * dt_therm;
909
910 /* Do not decrease the energy by more than a factor of 2*/
911 xp->u_full = MAX(xp->u_full + delta_u, 0.5f * xp->u_full);
912
913 /* Check against entropy floor */
914 const float floor_A = entropy_floor(p, cosmo, floor_props);
915 const float floor_u = gas_internal_energy_from_entropy(p->rho, floor_A);
916
917 /* Check against absolute minimum */
918 const float min_u =
919 hydro_props->minimal_internal_energy / cosmo->a_factor_internal_energy;
920
921 /* Take highest of both limits */
922 const float energy_min = MAX(min_u, floor_u);
923
924 if (xp->u_full < energy_min) {
925 xp->u_full = energy_min;
926 p->u_dt = 0.f;
927 }
928}
929
943__attribute__((always_inline)) INLINE static void hydro_convert_quantities(
944 struct part *restrict p, struct xpart *restrict xp,
945 const struct cosmology *cosmo, const struct hydro_props *hydro_props,
946 const struct pressure_floor_props *pressure_floor) {
947
948 /* Convert the physcial internal energy to the comoving one. */
949 /* u' = a^(3(g-1)) u */
950 const float factor = 1.f / cosmo->a_factor_internal_energy;
951 p->u *= factor;
952 xp->u_full = p->u;
953
954 /* Apply the minimal energy limit */
955 const float min_comoving_energy =
956 hydro_props->minimal_internal_energy / cosmo->a_factor_internal_energy;
957 if (xp->u_full < min_comoving_energy) {
958 xp->u_full = min_comoving_energy;
959 p->u = min_comoving_energy;
960 p->u_dt = 0.f;
961 }
962
963 /* Compute the pressure */
964 const float pressure = gas_pressure_from_internal_energy(p->rho, p->u);
965
966 /* Compute the sound speed */
967 const float soundspeed = gas_soundspeed_from_internal_energy(p->rho, p->u);
968
969 p->force.pressure = pressure;
970 p->force.soundspeed = soundspeed;
971}
972
983__attribute__((always_inline)) INLINE static void hydro_first_init_part(
984 struct part *restrict p, struct xpart *restrict xp) {
985
986// p->time_bin = 0;
987 xp->v_full[0] = p->v[0];
988 xp->v_full[1] = p->v[1];
989 xp->v_full[2] = p->v[2];
990 xp->u_full = p->u;
991
993 hydro_init_part(p, NULL);
994}
995
1007__attribute__((always_inline)) INLINE static void
1008hydro_set_init_internal_energy(struct part *p, float u_init) {
1009
1010 p->u = u_init;
1011}
1012
1021__attribute__((always_inline)) INLINE static void hydro_remove_part(
1022 const struct part *p, const struct xpart *xp, const double time) {}
1023
1024#endif /* SWIFT_MINIMAL_HYDRO_H */
Defines the adiabatic index (polytropix index) of the problem and (fast) mathematical functions invo...
Kernel functions for SPH (scalar and vector version).
#define dt_therm
Definition main.cpp:19
Defines the dimensionality of the problem and (fast) mathematical functions involving it.
static INLINE float entropy_floor(const struct part *p, const struct cosmology *cosmo, const struct entropy_floor_properties *props)
Compute the entropy floor of a given part.
const float soundspeed
Definition hydro.h:373
const float pressure
Definition hydro.h:372
const struct xpart *restrict const struct cosmology * cosmo
Definition hydro.h:74
const struct cosmology const struct pressure_floor_props * pressure_floor
Definition hydro.h:365
struct xpart const struct cosmology const float entropy
Definition hydro.h:332
__attribute__((always_inline)) INLINE static float hydro_get_comoving_internal_energy(const struct part *restrict p
Returns the comoving internal energy of a particle at the last time the particle was kicked.
Definition hydro.h:85
const struct cosmology const float dv_phys
Definition hydro.h:394
const struct xpart *restrict xp
Definition hydro.h:58
float du_dt
Definition hydro.h:300
struct xpart const struct cosmology const float u
Definition hydro.h:350
float m
Definition hydro.h:257
const float dx[3]
Definition hydro_iact.h:54
const float const float const float struct part *restrict struct part *restrict pj
Definition hydro_iact.h:55
float dv[3]
Definition hydro_iact.h:98
const float h_inv
Definition hydro_iact.h:158
#define const_viscosity_beta
Contains all the constants and parameters of the hydro scheme.
#define INLINE
Defines inline.
Definition inline.h:36
#define MAX(a, b)
Maximum of two numbers.
Definition minmax.h:39
InlineMethod T pow_dimension(T x)
returns x^ndim
double hydro_compute_timestep(Particle *particle)
Computes the SPH time step size.
Definition Timestep.cpph:9
void hydro_reset_acceleration(Particle *localParticle)
Reset acceleration fields of a particle.
void hydro_predict_extra(Particle *localParticle)
Predict additional particle fields forward in time when drifting.
Definition Leapfrog.cpph:27
void hydro_end_force(Particle *localParticle)
Finishes the force calculation.
void hydro_reset_predicted_values(Particle *localParticle)
Sets the values to be predicted in the drifts to their values at a kick time.
void hydro_end_density(Particle *localParticle)
Finishes the density calculation.
Definition Density.cpph:52
void hydro_prepare_force(Particle *localParticle)
Prepare a particle for the force calculation.
const struct part *restrict const struct part *restrict const float const float beta
const struct part *restrict const struct part *restrict const float mu_ij
#define kernel_root
Cosmological parameters.
Definition cosmology.h:34
Properties of the entropy floor.
Contains all the constants and parameters of the hydro scheme.
float minimal_internal_energy
struct viscosity_global_data viscosity
Particle fields for the SPH particles.
Definition hydro_part.h:99
struct part::@3::@6 force
Structure for the variables only used in the force loop over neighbours.
float soundspeed
Definition hydro_part.h:176
Particle fields not needed during the SPH loops over neighbours.
Definition hydro_part.h:55
float v_full[3]
Definition hydro_part.h:64
float u_full
Definition hydro_part.h:70