changa  3.5
 All Classes Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Sph.h
1 /* Classes to describe smooth functions needed for SPH */
2 #ifndef __SPH_H
3 #define __SPH_H
4 
5 #ifdef DIFFUSION
6 
7 #if defined(FEEDBACKDIFFLIMIT) && !defined(DIFFUSIONHARMONIC)
8 #define DIFFUSIONHARMONIC
9 #endif
10 
11 #endif
12 
16 {
17  protected:
18  double a, H; // Cosmological parameters
19  int bActiveOnly;
20  int bConstantDiffusion;
21  double dTime;
22  double dAlphaMax;
23  int bStarting;
24  int bHaveAlpha;
26 
27  virtual void fcnSmooth(GravityParticle *p, int nSmooth,
28  pqSmoothNode *nList);
29  virtual int isSmoothActive(GravityParticle *p);
30  virtual void initTreeParticle(GravityParticle *p);
31  virtual void postTreeParticle(GravityParticle *p);
32  virtual void initSmoothParticle(GravityParticle *p);
33  virtual void initSmoothCache(GravityParticle *p);
34  virtual void combSmoothCache(GravityParticle *p1,
36  public:
47  DenDvDxSmoothParams(int _iType, int am, CSM csm, double _dTime,
48  int _bActiveOnly, int _bConstantDiffusion,
49  int _bStarting, int _bHaveAlpha, double _dAlphaMax) {
50  iType = _iType;
51  activeRung = am;
52  bActiveOnly = _bActiveOnly;
53  bConstantDiffusion = _bConstantDiffusion;
54  bStarting = _bStarting;
55  bHaveAlpha = _bHaveAlpha;
56  dAlphaMax = _dAlphaMax;
57  dTime = _dTime;
58  if(csm->bComove) {
59  H = csmTime2Hub(csm,dTime);
60  a = csmTime2Exp(csm,dTime);
61  }
62  else {
63  H = 0.0;
64  a = 1.0;
65  }
66  }
67  PUPable_decl(DenDvDxSmoothParams);
68  DenDvDxSmoothParams(CkMigrateMessage *m) : SmoothParams(m) {}
69  virtual void pup(PUP::er &p) {
70  SmoothParams::pup(p);//Call base class
71  p|dTime;
72  p|a;
73  p|H;
74  p|bActiveOnly;
75  p|bConstantDiffusion;
76  p|bStarting;
77  p|bHaveAlpha;
78  p|dAlphaMax;
79  }
80  };
81 
89 
91 {
92  virtual int isSmoothActive(GravityParticle *p);
93  virtual void initTreeParticle(GravityParticle *p) {}
94  virtual void postTreeParticle(GravityParticle *p);
95  virtual void initSmoothParticle(GravityParticle *p) {}
96  virtual void initSmoothCache(GravityParticle *p) {}
97  virtual void combSmoothCache(GravityParticle *p1,
99  public:
109  DenDvDxNeighborSmParams(int _iType, int am, CSM csm, double dTime,
110  int bConstDiffusion, double dAlphaMax)
111  : DenDvDxSmoothParams(_iType, am, csm, dTime, 0, bConstDiffusion,
112  0, 0, dAlphaMax) {}
113  PUPable_decl(DenDvDxNeighborSmParams);
114  DenDvDxNeighborSmParams(CkMigrateMessage *m) : DenDvDxSmoothParams(m) {}
115  virtual void pup(PUP::er &p) {
116  DenDvDxSmoothParams::pup(p);//Call base class
117  }
118  };
119 
122 
124 {
125  virtual void fcnSmooth(GravityParticle *p, int nSmooth,
126  pqSmoothNode *nList) {}
127  virtual int isSmoothActive(GravityParticle *p);
128  virtual void initTreeParticle(GravityParticle *p) {}
129  virtual void postTreeParticle(GravityParticle *p) {}
130  virtual void initSmoothParticle(GravityParticle *p) {}
131  virtual void initSmoothCache(GravityParticle *p) {}
132  virtual void combSmoothCache(GravityParticle *p1,
134  public:
135  MarkSmoothParams() {}
138  MarkSmoothParams(int _iType, int am) {
139  iType = _iType;
140  activeRung = am;
141  }
142  PUPable_decl(MarkSmoothParams);
143  MarkSmoothParams(CkMigrateMessage *m) : SmoothParams(m) {}
144  virtual void pup(PUP::er &p) {
145  SmoothParams::pup(p);//Call base class
146  }
147  };
148 
151 {
152  double dTime;
153  double a, H; // Cosmological parameters
154  double alpha, beta; // SPH viscosity parameters
155  double dThermalDiffusionCoeff;
156  double dMetalDiffusionCoeff;
157  double dtFacCourant; // Courant timestep factor
158  double dtFacDiffusion; // Diffusion timestep factor
159 
160  virtual void fcnSmooth(GravityParticle *p, int nSmooth,
161  pqSmoothNode *nList);
162  virtual int isSmoothActive(GravityParticle *p);
163  virtual void initTreeParticle(GravityParticle *p) {}
164  virtual void postTreeParticle(GravityParticle *p) {}
165  virtual void initSmoothParticle(GravityParticle *p);
166  virtual void initSmoothCache(GravityParticle *p);
167  virtual void combSmoothCache(GravityParticle *p1,
169  public:
177  PressureSmoothParams(int _iType, int am, CSM csm, double _dTime,
178  double _alpha, double _beta,
179  double _dThermalDiff, double _dMetalDiff,
180  double dEtaCourant, double dEtaDiffusion) {
181  iType = _iType;
182  activeRung = am;
183  dTime = _dTime;
184  if(csm->bComove) {
185  H = csmTime2Hub(csm,dTime);
186  a = csmTime2Exp(csm,dTime);
187  }
188  else {
189  H = 0.0;
190  a = 1.0;
191  }
192  alpha = _alpha;
193  beta = _beta;
194  dThermalDiffusionCoeff = _dThermalDiff;
195  dMetalDiffusionCoeff = _dMetalDiff;
196  dtFacCourant = dEtaCourant*a*2.0/1.6;
197  dtFacDiffusion = 2.0*dEtaDiffusion;
198  }
199  PUPable_decl(PressureSmoothParams);
200  PressureSmoothParams(CkMigrateMessage *m) : SmoothParams(m) {}
201  virtual void pup(PUP::er &p) {
202  SmoothParams::pup(p);//Call base class
203  p|dTime;
204  p|a;
205  p|H;
206  p|alpha;
207  p|beta;
208  p|dThermalDiffusionCoeff;
209  p|dMetalDiffusionCoeff;
210  p|dtFacCourant;
211  p|dtFacDiffusion;
212  }
213  };
214 
220 {
221  virtual void fcnSmooth(GravityParticle *p, int nSmooth,
222  pqSmoothNode *nList);
223  virtual int isSmoothActive(GravityParticle *p);
224  virtual void initSmoothParticle(GravityParticle *p) {};
225  virtual void initTreeParticle(GravityParticle *p) {}
226  virtual void postTreeParticle(GravityParticle *p) {}
227  virtual void initSmoothCache(GravityParticle *p);
228  virtual void combSmoothCache(GravityParticle *p1,
230  public:
234  DistDeletedGasSmoothParams(int _iType, int am) {
235  iType = _iType;
236  activeRung = am;
237  bUseBallMax = 0;
238  }
239  PUPable_decl(DistDeletedGasSmoothParams);
240  DistDeletedGasSmoothParams(CkMigrateMessage *m) : SmoothParams(m) {}
241  virtual void pup(PUP::er &p) {
242  SmoothParams::pup(p);//Call base class
243  }
244  };
245 
246 #ifdef SUPERBUBBLE
247 class PromoteToHotGasSmoothParams : public SmoothParams
255 {
256  double dEvapCoeff;
257  double dEvapMinTemp;
258  double dErgPerGmUnit;
259  double dGmPerCcUnit;
260  double dDeltaStarForm;
261  double dTime;
262  virtual void fcnSmooth(GravityParticle *p, int nSmooth,
263  pqSmoothNode *nList);
264  virtual int isSmoothActive(GravityParticle *p);
265  virtual void initSmoothParticle(GravityParticle *p) ;
266  virtual void initTreeParticle(GravityParticle *p) ;
267  virtual void postTreeParticle(GravityParticle *p) {}
268  virtual void initSmoothCache(GravityParticle *p);
269  virtual void combSmoothCache(GravityParticle *p1,
271  public:
272  PromoteToHotGasSmoothParams() {}
281  PromoteToHotGasSmoothParams(int _iType, int am, double _dEvapCoeff, double _dEvapMinTemp,
282  double _dErgPerGmUnit, double _dGmPerCcUnit, double _dDeltaStarForm, double _dTime) {
283  iType = _iType;
284  activeRung = am;
285  bUseBallMax = 0;
286  dEvapCoeff = _dEvapCoeff;
287  dEvapMinTemp = _dEvapMinTemp;
288  dErgPerGmUnit = _dErgPerGmUnit;
289  dGmPerCcUnit = _dGmPerCcUnit;
290  dDeltaStarForm = _dDeltaStarForm;
291  dTime = _dTime;
292  }
293  PUPable_decl(PromoteToHotGasSmoothParams);
294  PromoteToHotGasSmoothParams(CkMigrateMessage *m) : SmoothParams(m) {}
295  virtual void pup(PUP::er &p) {
296  SmoothParams::pup(p);//Call base class
297  p|dEvapCoeff;
298  p|dEvapMinTemp;
299  p|dErgPerGmUnit;
300  p|dGmPerCcUnit;
301  p|dDeltaStarForm;
302  p|dTime;
303  }
304 };
312 class ShareWithHotGasSmoothParams : public SmoothParams
313 {
314  double dEvapMinTemp;
315  double dErgPerGmUnit;
316  double dGmPerCcUnit;
317  virtual void fcnSmooth(GravityParticle *p, int nSmooth,
318  pqSmoothNode *nList);
319  virtual int isSmoothActive(GravityParticle *p);
320  virtual void initSmoothParticle(GravityParticle *p) {}
321  virtual void initTreeParticle(GravityParticle *p) {}
322  virtual void postTreeParticle(GravityParticle *p) {}
323  virtual void initSmoothCache(GravityParticle *p);
324  virtual void combSmoothCache(GravityParticle *p1,
326  public:
327  ShareWithHotGasSmoothParams() {}
333  ShareWithHotGasSmoothParams(int _iType, int am, double _dEvapMinTemp,
334  double _dErgPerGmUnit, double _dGmPerCcUnit ){
335  iType = _iType;
336  activeRung = am;
337  bUseBallMax = 0;
338  dEvapMinTemp = _dEvapMinTemp;
339  dErgPerGmUnit = _dErgPerGmUnit;
340  dGmPerCcUnit = _dGmPerCcUnit;
341  }
342  PUPable_decl(ShareWithHotGasSmoothParams);
343  ShareWithHotGasSmoothParams(CkMigrateMessage *m) : SmoothParams(m) {}
344  virtual void pup(PUP::er &p) {
345  SmoothParams::pup(p);//Call base class
346  p|dEvapMinTemp;
347  p|dErgPerGmUnit;
348  p|dGmPerCcUnit;
349  }
350 };
351 #endif
352 #endif
Class for cross processor data needed for smooth operations.
Definition: GravityParticle.h:568
Second pass in SPH: calculate pressure forces.
Definition: Sph.h:150
virtual void initSmoothCache(GravityParticle *p)
initialize particles as they come into the cache
Definition: Sph.cpp:1081
int bStarting
Definition: Sph.h:23
virtual void pup(PUP::er &p)
required method for remote entry call.
Definition: Sph.h:241
Parameters for "Mark Smooth", used to find inverse nearest neighbors.
Definition: Sph.h:123
virtual void fcnSmooth(GravityParticle *p, int nSmooth, pqSmoothNode *nList)=0
Function to apply to smooth particle and neighbors.
virtual void initTreeParticle(GravityParticle *p)=0
initialize particles in tree but not smoothed
virtual void initSmoothCache(GravityParticle *p)=0
initialize particles as they come into the cache
int bUseBallMax
Definition: smoothparams.h:14
int bHaveAlpha
Alpha has been read in.
Definition: Sph.h:25
virtual void pup(PUP::er &p)
required method for remote entry call.
Definition: Sph.h:201
Get density and velocity derivatives of "Neighbor of Active" particles.
Definition: Sph.h:90
Cosmological parameters.
Definition: cosmo.h:10
int iType
Particle type to smooth over; "TreeActive".
Definition: smoothparams.h:11
double dAlphaMax
Maximum SPH alpha.
Definition: Sph.h:22
Object for priority queue entry.
Definition: smooth.h:12
virtual void combSmoothCache(GravityParticle *p1, ExternalSmoothParticle *p2)=0
combine cache copy with home particle
DistDeletedGasSmoothParams(int _iType, int am)
Definition: Sph.h:234
virtual void pup(PUP::er &p)
required method for remote entry call.
Definition: smoothparams.h:45
virtual void fcnSmooth(GravityParticle *p, int nSmooth, pqSmoothNode *nList)
Function to apply to smooth particle and neighbors.
Definition: Sph.cpp:1092
virtual void pup(PUP::er &p)
required method for remote entry call.
Definition: Sph.h:144
virtual void initTreeParticle(GravityParticle *p)
initialize particles in tree but not smoothed
Definition: Sph.cpp:1066
Parameters and functions for the first SPH smooth: density and velocity derivatives.
Definition: Sph.h:15
virtual void initSmoothParticle(GravityParticle *p)
initialize particles to be smoothed
Definition: Sph.cpp:1061
SmoothParams class for distributing deleted gas to neighboring particles.
Definition: Sph.h:219
A base class from which parameters for all smooth operations can be derived.
Definition: smoothparams.h:8
virtual void initSmoothParticle(GravityParticle *p)=0
initialize particles to be smoothed
MarkSmoothParams(int _iType, int am)
Definition: Sph.h:138
DenDvDxNeighborSmParams(int _iType, int am, CSM csm, double dTime, int bConstDiffusion, double dAlphaMax)
Definition: Sph.h:109
virtual void postTreeParticle(GravityParticle *p)
calculation on all tree particles after all walks are done
Definition: Sph.cpp:1072
DenDvDxSmoothParams(int _iType, int am, CSM csm, double _dTime, int _bActiveOnly, int _bConstantDiffusion, int _bStarting, int _bHaveAlpha, double _dAlphaMax)
Definition: Sph.h:47
virtual void postTreeParticle(GravityParticle *p)=0
calculation on all tree particles after all walks are done
int activeRung
Currently active rung.
Definition: smoothparams.h:12
Fundamental type for a particle.
Definition: GravityParticle.h:316
virtual int isSmoothActive(GravityParticle *p)
Particle is doing a neighbor search.
Definition: Sph.cpp:1026
PressureSmoothParams(int _iType, int am, CSM csm, double _dTime, double _alpha, double _beta, double _dThermalDiff, double _dMetalDiff, double dEtaCourant, double dEtaDiffusion)
Definition: Sph.h:177
virtual void combSmoothCache(GravityParticle *p1, ExternalSmoothParticle *p2)
combine cache copy with home particle
Definition: Sph.cpp:1085
virtual void pup(PUP::er &p)
required method for remote entry call.
Definition: Sph.h:115
virtual void pup(PUP::er &p)
required method for remote entry call.
Definition: Sph.h:69
virtual int isSmoothActive(GravityParticle *p)=0
Particle is doing a neighbor search.