changa
3.5
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Friends
Macros
Groups
Pages
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
20
inline
double
presPdv(
const
double
a,
const
double
b){
21
return
a;
22
}
28
inline
double
presAcc(
const
double
a,
const
double
b){
29
return
a + b;
30
}
31
36
inline
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
48
inline
double
rhoDivv(
const
double
a,
const
double
b) {
49
#ifdef GDFORCE
50
return
b;
51
#else
52
return
a;
53
#endif
54
}
55
60
inline
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
73
inline
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
91
inline
bool
diffusionLimitTest(
const
double
diffSum,
const
double
dTime,
92
GravityParticle
*a,
GravityParticle
*b) {
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
102
inline
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
111
typedef
struct
PressSmoothUpdateStruct
{
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
144
typedef
struct
PressSmoothParticleStruct
{
145
double
rNorm;
146
double
PoverRho2;
147
double
PoverRho2f;
148
}
PressSmoothParticle
;
149
150
void
updateParticle(
GravityParticle
*a,
GravityParticle
*b,
151
PressSmoothUpdate
*params,
PressSmoothParticle
*aParams,
152
PressSmoothParticle
*bParams,
int
sign);
153
154
#endif // SPHUTILS_H
PressSmoothParticleStruct
Definition:
SphUtils.h:144
GravityParticle
Fundamental type for a particle.
Definition:
GravityParticle.h:316
PressSmoothUpdateStruct
Definition:
SphUtils.h:111
Generated by
1.8.5