changa 3.5
Loading...
Searching...
No Matches
SphUtils.h
1/*
2 * This file contains inline utility functions and function declarations needed
3 * for SPH
4 *
5 * Based on the physics modules implemented by James Wadsley in GASOLINE.
6 * Implemented by Tom Quinn in ChaNGa and refactored by Isaac Backus
7 * Oct 14, 2016
8 */
9#ifndef SPHUTILS_H
10#define SPHUTILS_H
11
12// Include Sph.h for possible macro definitions in there
13#include "Sph.h"
14
20inline double presPdv(const double a, const double b){
21 return a;
22}
28inline double presAcc(const double a, const double b){
29 return a + b;
30}
31
36inline double switchCombine(GravityParticle *a, GravityParticle *b) {
37#ifdef CULLENALPHA
38 return 1.0;
39#else
40 return 0.5*(a->BalsaraSwitch()+b->BalsaraSwitch());
41#endif
42}
43
48inline double rhoDivv(const double a, const double b) {
49#ifdef GDFORCE
50 return b;
51#else
52 return a;
53#endif
54}
55
60inline double varAlpha(const double alpha, const GravityParticle *a,
61 const GravityParticle *b) {
62#if defined(VARALPHA) || defined(CULLENALPHA)
63 return alpha*0.5*(a->CullenAlpha() + b->CullenAlpha());
64#else
65 return alpha;
66#endif //VARALPHA
67}
68
73inline double varBeta(const double beta, GravityParticle *a,
74 const GravityParticle *b) {
75#if defined(VARALPHA) || defined(CULLENALPHA)
76 return beta*0.5*(a->CullenAlpha() + b->CullenAlpha());
77#else
78 return beta;
79#endif //VARALPHA
80}
81
91inline bool diffusionLimitTest(const double diffSum, const double dTime,
93#ifdef FEEDBACKDIFFLIMIT
94 return (diffSum == 0 \
95 || dTime < a->fTimeCoolIsOffUntil() \
96 || dTime < b->fTimeCoolIsOffUntil());
97#else
98 return (diffSum == 0);
99#endif
100}
101
102inline double massDiffFac(const GravityParticle *p) {
104//#ifdef MASSDIFF /* compile-time flag */
105// return p->fMass;
106//#else
107 return 1.0;
108//#endif //MASSDIFF
109}
110
112 double dvdotdr;
113 double visc;
114 double aFac;
115 Vector3D<double> dx;
116// /* not implemented */
117// #ifdef DRHODT /* compile-time flag */
118// double fDivv_Corrector;
119// #endif
120 #ifdef DIFFUSION
121// /* DIFFUSIONPRICE not implemented */
122// #ifdef DIFFUSIONPRICE /* compile-time flag */
123// double diffu;
124// #else
125 #ifndef NODIFFUSIONTHERMAL /* compile-time flag */
126 double diffu;
127 #endif
128// #endif //DIFFUSIONPRICE
129 /* not implemented */
130// #ifdef UNONCOOL
131// double diffuNc;
132// #endif
133 double diffMetals;
134 double diffMetalsOxygen;
135 double diffMetalsIron;
136// /* not implemented */
137// #ifdef MASSDIFF /* compile-time flag */
138// double diffMass;
139// Vector3D<double> diffVelocity;
140// #endif
141 #endif
142} PressSmoothUpdate;
143
145 double rNorm;
146 double PoverRho2;
147 double PoverRho2f;
148} PressSmoothParticle;
149
150void updateParticle(GravityParticle *a, GravityParticle *b,
151 PressSmoothUpdate *params, PressSmoothParticle *aParams,
152 PressSmoothParticle *bParams, int sign);
153
154#endif // SPHUTILS_H
Fundamental type for a particle.
Definition GravityParticle.h:364
Definition SphUtils.h:144
Definition SphUtils.h:111