changa  3.5
 All Classes Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
GravityParticle.h
Go to the documentation of this file.
1 
4 #ifndef GRAVITYPARTICLE_H
5 #define GRAVITYPARTICLE_H
6 
7 #include <charm.h> /* for CkAssert */
8 #include "cooling.h"
9 #include "cosmoType.h"
10 #include "SFC.h"
11 #include <vector>
12 
13 #if defined(DTADJUST) || defined(SUPERBUBBLE)
14 #define NEED_DT
15 #endif
16 
19 public:
20 
21  int finished;
22 
23  BucketGravityRequest(unsigned int bucketSize = 0) : finished(0) {
24  }
25 
26 };
27 
34  public:
35 
36  cosmoType mass;
37  cosmoType soft;
38  Vector3D<cosmoType> position;
39 
40 #ifdef __CHARMC__
41  void pup(PUP::er &p) {
42  p | position;
43  p | mass;
44  p | soft;
45  }
46 #endif
47 };
48 
51 {
52  private:
53  double _u; /* Internal Energy */
54  double _fMetals; /* Metalicity */
55 #ifdef SPLITGAS
56  int64_t _iSplitOrder; /* Gas from which this particle split*/
57 #endif
58  double _fMFracOxygen; /* Oxygen mass fraction */
59  double _fMFracIron; /* Iron mass fraction */
60  double _fESNrate; /* SN energy rate */
61  double _fTimeCoolIsOffUntil;/* time cooling is turned back on */
62  Vector3D<double> _vPred; /* Predicted velocities for velocity
63  dependent forces */
64  double _uPred; /* Predicted internal energy */
65  double _divv; /* Diverence of the velocity */
66  Vector3D<double> _curlv; /* Curl of the velocity */
67  double _mumax; /* */
68  double _PdV;
69  double _uDotPdV;
70  double _uDotAV;
71  double _uDotDiff;
72  double _c; /* Speed of Sound */
73  double _PoverRho2; /* Pressure/rho^2 */
74  double _BalsaraSwitch; /* Pressure/rho^2 */
75  double _fBallMax; /* Radius for inverse neighbor finding */
76 #ifdef CULLENALPHA
77  double _CullenAlpha; /* Alpha from Cullen & Dehnen 2010 */
78  double _TimeDivV; /* Time at which dvds was last updated */
79  double _dvds;
80  double _dvdsOnSFull;
81  double _dvds_old;
82 #endif
83 #ifdef DTADJUST
84  double _dtNew; /* New timestep from gas pressure */
85 #endif
86  double _dTimeFB; /* Track feedback time */
87 #ifndef COOLING_NONE
88  double _uDot; /* Rate of change of u, for
89  predicting u */
90  COOLPARTICLE _CoolParticle; /* Abundances and any other cooling
91  internal variables */
92 #endif
93 #ifdef DIFFUSION
94  double _diff; /* Diffusion coefficient, based on Smagorinski */
95  double _fMetalsDot;
96  double _fMetalsPred;
97  double _fMFracOxygenDot;
98  double _fMFracIronDot;
99  double _fMFracOxygenPred;
100  double _fMFracIronPred;
101 #endif
102 #ifdef SUPERBUBBLE
103  COOLPARTICLE _CoolParticleHot;
104  int _cpHotInit; /* Do we need to initialize the Hot Coolparticle? */
105  double _uHot; /* Hot phase energy */
106  double _uHotDot; /* Hot phase rate of energy change */
107  double _uHotPred; /* Hot phase predicted energy */
108  double _massHot; /* Hot phase mass*/
109  double _fDensityU; /* Energy-scaled density */
110  double _fThermalCond; /* Conduction rate */
111  double _fPromoteSum; /* Total evaporated mass */
112  double _fPromoteSumuPred; /* Total evaporating energy */
113  double _fPromoteuPredInit; /* Original energy pre-evaporation */
114 #endif
115 
116  public:
117  inline double& u() {return _u;}
118 #ifdef SPLITGAS
119  inline int64_t& iSplitOrder() {return _iSplitOrder;}
120 #endif
121  inline double& fMetals() {return _fMetals;}
122  inline double& fMFracOxygen() {return _fMFracOxygen;}
123  inline double& fMFracIron() {return _fMFracIron;}
124  inline double& fESNrate() {return _fESNrate;}
125  inline double& fTimeCoolIsOffUntil() {return _fTimeCoolIsOffUntil;}
126  inline Vector3D<double>& vPred() {return _vPred;}
127  inline double& uPred() {return _uPred;}
128  inline double& divv() {return _divv;}
129  inline Vector3D<double>& curlv() {return _curlv;}
130  inline double& mumax() {return _mumax;}
131  inline double& PdV() {return _PdV;}
132  inline double& uDotPdV() {return _uDotPdV;}
133  inline double& uDotAV() {return _uDotAV;}
134  inline double& uDotDiff() {return _uDotDiff;}
135  inline double& c() {return _c;}
136  inline double& PoverRho2() {return _PoverRho2;}
137  inline double& BalsaraSwitch() {return _BalsaraSwitch;}
138  inline double& fBallMax() {return _fBallMax;}
139 #ifdef CULLENALPHA
140  inline double CullenAlpha() const {return _CullenAlpha;}
141  inline double& CullenAlpha() {return _CullenAlpha;}
142  inline double& TimeDivV() {return _TimeDivV;}
143  inline double& dvds() {return _dvds;}
144  inline double& dvdsOnSFull() {return _dvdsOnSFull;}
145  inline double& dvds_old() {return _dvds_old;}
146 #endif
147 #ifdef DTADJUST
148  inline double& dtNew() {return _dtNew;}
149 #endif
150  inline double& dTimeFB() {return _dTimeFB;}
151 #ifndef COOLING_NONE
152  inline double& uDot() {return _uDot;}
153  inline COOLPARTICLE& CoolParticle() {return _CoolParticle;}
154 #endif
155 #ifdef DIFFUSION
156  inline double& diff() {return _diff;}
157  inline double& fMetalsDot() {return _fMetalsDot;}
158  inline double& fMetalsPred() {return _fMetalsPred;}
159  inline double& fMFracOxygenDot() {return _fMFracOxygenDot;}
160  inline double& fMFracOxygenPred() {return _fMFracOxygenPred;}
161  inline double& fMFracIronDot() {return _fMFracIronDot;}
162  inline double& fMFracIronPred() {return _fMFracIronPred;}
163 #endif
164 #ifdef SUPERBUBBLE
165  inline COOLPARTICLE& CoolParticleHot() {return _CoolParticleHot;}
166  inline int& cpHotInit() {return _cpHotInit;}
167  inline double& uHot() {return _uHot;}
168  inline double& uHotPred() {return _uHotPred;}
169  inline double& uHotDot() {return _uHotDot;}
170  inline double& massHot() {return _massHot;}
171  inline double& fDensityU() {return _fDensityU;}
172  inline double& fThermalCond() {return _fThermalCond;}
173  inline double& fPromoteSum() {return _fPromoteSum;}
174  inline double& fPromoteSumuPred() {return _fPromoteSumuPred;}
175  inline double& fPromoteuPredInit() {return _fPromoteuPredInit;}
176 #endif
177 #ifdef __CHARMC__
178  void pup(PUP::er &p) {
179  p | _u;
180 #ifdef SPLITGAS
181  p | _iSplitOrder;
182 #endif
183  p | _fMetals;
184  p | _fMFracIron;
185  p | _fMFracOxygen;
186  p | _fESNrate;
187  p | _fTimeCoolIsOffUntil;
188  p | _vPred;
189  p | _uPred;
190  p | _divv;
191  p | _curlv;
192  p | _mumax;
193  p | _PdV;
194  p | _uDotPdV;
195  p | _uDotAV;
196  p | _uDotDiff;
197  p | _c;
198  p | _PoverRho2;
199  p | _BalsaraSwitch;
200  p | _fBallMax;
201 #ifdef CULLENALPHA
202  p | _CullenAlpha;
203  p | _TimeDivV;
204  p | _dvds;
205  p | _dvdsOnSFull;
206  p | _dvds_old;
207 #endif
208 #ifdef DTADJUST
209  p | _dtNew;
210 #endif
211  p | _dTimeFB;
212 #ifndef COOLING_NONE
213  p | _uDot;
214  p((char *) &_CoolParticle, sizeof(_CoolParticle)); /* PUPs as bytes */
215 #endif
216 #ifdef DIFFUSION
217  p| _diff;
218  p| _fMetalsDot;
219  p| _fMetalsPred;
220  p| _fMFracOxygenDot;
221  p| _fMFracOxygenPred;
222  p| _fMFracIronDot;
223  p| _fMFracIronPred;
224 #endif
225 #ifdef SUPERBUBBLE
226  p((char *) &_CoolParticleHot, sizeof(_CoolParticleHot)); /* PUPs as bytes */
227  p| _cpHotInit;
228  p| _uHot;
229  p| _uHotDot;
230  p| _uHotPred;
231  p| _massHot;
232  p| _fDensityU;
233  p| _fThermalCond;
234  p| _fPromoteSum;
235  p| _fPromoteSumuPred;
236  p| _fPromoteuPredInit;
237 #endif
238  }
239 #endif
240  };
241 
244 {
245  private:
246  double _fMetals; /* Metalicity */
247  double _fTimeForm; /* Formation time */
248  double _fMassForm; /* Formation mass */
249  double _fESNrate; /* SN energy rate */
250  double _fNSN; /* number of SN exploding */
251  double _fMSN; /* mass of feedback ejecta */
252  double _fMFracOxygen; /* Oxygen mass fraction */
253  double _fMFracIron; /* Iron mass fraction */
254  double _fSNMetals; /* Ejected metals from feedback */
255  double _fMOxygenOut; /* Ejected oxygen */
256  double _fMIronOut; /* Ejected iron */
257  int64_t _iGasOrder; /* Gas from which this star formed */
258  int64_t _iEaterOrder; /* iOrder for merging black holes */
259  double _dMDot; /* Accretion rate of black holes */
260  double _dDeltaM; /* Actual Mass Accreted on black holes */
261 #ifdef COOLING_MOLECULARH
262  double _dStarLymanWerner; /* Lyman Werner radiation emmited from star particles */
263 #endif /*COOLING_MOLECULARH*/
264  public:
265  inline double& fMetals() {return _fMetals;}
266  inline double& fTimeForm() {return _fTimeForm;}
267  inline double& fMassForm() {return _fMassForm;}
268  inline double& fESNrate() {return _fESNrate;}
269  inline double& fNSN() {return _fNSN;}
270  inline double& fMSN() {return _fMSN;}
271  inline double& fMFracOxygen() {return _fMFracOxygen;}
272  inline double& fMFracIron() {return _fMFracIron;}
273  inline double& fMIronOut() {return _fMIronOut;}
274  inline double& fMOxygenOut() {return _fMOxygenOut;}
275  inline double& fSNMetals() {return _fSNMetals;}
276  inline int64_t& iGasOrder() {return _iGasOrder;}
277  inline int64_t& iEaterOrder() {return _iEaterOrder;}
278  inline double& dMDot() {return _dMDot;}
279  inline double& dDeltaM() {return _dDeltaM;}
280 #ifdef COOLING_MOLECULARH
281  inline double dStarLymanWerner() const {return _dStarLymanWerner;}
282  inline double& dStarLymanWerner() {return _dStarLymanWerner;}
283 #endif /*COOLING_MOLECULARH*/
284  void pup(PUP::er &p) {
285  p | _fMetals;
286  p | _fTimeForm;
287  p | _fMassForm;
288  p | _fESNrate;
289  p | _fNSN;
290  p | _fMSN;
291  p | _fMFracOxygen;
292  p | _fMFracIron;
293  p | _fSNMetals;
294  p | _fMOxygenOut;
295  p | _fMIronOut;
296  p | _iGasOrder;
297  p | _iEaterOrder;
298  p | _dMDot;
299  p | _dDeltaM;
300 #ifdef COOLING_MOLECULARH
301  p | _dStarLymanWerner;
302 #endif /*COOLINg_MOLECULARH*/
303  }
304  };
305 
306 class GravityParticle;
307 int TYPETest(const GravityParticle *a, unsigned int b);
308 
310 
315 
317 public:
318  SFC::Key key;
319  Vector3D<double> velocity;
320  Vector3D<cosmoType> treeAcceleration;
321  cosmoType potential;
322  cosmoType dtGrav;
323  double fBall;
327  double fDensity;
328  int64_t iOrder;
329  int rung;
330  unsigned int iType;
331 #ifdef SIDMINTERACT
332  int iNSIDMInteractions; // SIDM number of interactions
333 #endif
334 #ifdef CHANGESOFT
335  cosmoType fSoft0;
336 #endif
337 #ifdef NEED_DT
338  double dt;
339 #endif
340  void *extraData; /* SPH or Star particle data */
341 
342 #if COSMO_STATS > 1
343  double intcellmass;
344  double intpartmass;
345  double extcellmass;
346  double extpartmass;
347 #endif
348 
349  cosmoType interMass;
350 
351  GravityParticle(SFC::Key k) : ExternalGravityParticle() {
352  key = k;
353  }
355  }
356 
358  inline bool operator<(const GravityParticle& p) const {
359  return key < p.key;
360  }
361 
362 #ifdef __CHARMC__
363  void pup(PUP::er &p) {
364  ExternalGravityParticle::pup(p);
365  p | key;
366  p | velocity;
367  p | treeAcceleration;
368  p | dtGrav;
369  p | fDensity;
370  p | fBall;
371  p | iOrder;
372  p | rung;
373  p | iType;
374 #ifdef SIDMINTERACT
375  p | iNSIDMInteractions; // SIDM
376 #endif
377 #ifdef CHANGESOFT
378  p | fSoft0;
379 #endif
380 #ifdef NEED_DT
381  p | dt;
382 #endif
383  }
384 #endif
385 
386 // Debugging macros for the extra data fields.
387 // To enable, define GP_DEBUG_EXTRAS
388 
389 #define GP_DEBUG_EXTRAS
390 
391 #ifdef GP_DEBUG_EXTRAS
392 #define IMAGAS CkAssert(isGas())
395 #define IMASTAR CkAssert(isStar())
398 #else
399 #define IMAGAS
400 #define IMASTAR
401 #endif
402 
403  // Access SPH quantities
406  inline double& u() { IMAGAS; return (((extraSPHData*)extraData)->u());}
407 #ifdef SPLITGAS
408  inline int64_t& iSplitOrder() { IMAGAS; return (((extraSPHData*)extraData)->iSplitOrder());}
409 #endif
410  inline double& fMetals() { IMAGAS; return (((extraSPHData*)extraData)->fMetals());}
411  inline double& fMFracOxygen() {IMAGAS; return (((extraSPHData*)extraData)->fMFracOxygen());}
412  inline double& fMFracIron() {IMAGAS; return (((extraSPHData*)extraData)->fMFracIron());}
413  inline double& fESNrate() {IMAGAS; return (((extraSPHData*)extraData)->fESNrate());}
414  inline double& fTimeCoolIsOffUntil() {IMAGAS; return (((extraSPHData*)extraData)->fTimeCoolIsOffUntil());}
415  inline Vector3D<double>& vPred() { IMAGAS; return (((extraSPHData*)extraData)->vPred());}
416  inline double& uPred() {IMAGAS; return (((extraSPHData*)extraData)->uPred());}
417  inline double& divv() { IMAGAS; return (((extraSPHData*)extraData)->divv());}
418  inline Vector3D<double>& curlv() { IMAGAS; return (((extraSPHData*)extraData)->curlv());}
419  inline double& mumax() { IMAGAS; return (((extraSPHData*)extraData)->mumax());}
420  inline double& PdV() { IMAGAS; return (((extraSPHData*)extraData)->PdV());}
421  inline double& uDotPdV() { IMAGAS; return (((extraSPHData*)extraData)->uDotPdV());}
422  inline double& uDotAV() { IMAGAS; return (((extraSPHData*)extraData)->uDotAV());}
423  inline double& uDotDiff() { IMAGAS; return (((extraSPHData*)extraData)->uDotDiff());}
424  inline double& c() { IMAGAS; return (((extraSPHData*)extraData)->c());}
425  inline double& PoverRho2() { IMAGAS; return (((extraSPHData*)extraData)->PoverRho2());}
426  inline double& BalsaraSwitch() { IMAGAS; return (((extraSPHData*)extraData)->BalsaraSwitch());}
427  inline double& fBallMax() { IMAGAS; return (((extraSPHData*)extraData)->fBallMax());}
428 #ifdef CULLENALPHA
429  inline double CullenAlpha() const {IMAGAS; return (((extraSPHData*)extraData)->CullenAlpha());}
430  inline double& CullenAlpha() {IMAGAS; return (((extraSPHData*)extraData)->CullenAlpha());}
431  inline double& TimeDivV() {IMAGAS; return (((extraSPHData*)extraData)->TimeDivV());}
432  inline double& dvds() {IMAGAS; return (((extraSPHData*)extraData)->dvds());}
433  inline double& dvdsOnSFull() {IMAGAS; return (((extraSPHData*)extraData)->dvdsOnSFull());}
434  inline double& dvds_old() {IMAGAS; return (((extraSPHData*)extraData)->dvds_old());}
435 #endif
436 #ifdef DTADJUST
437  inline double& dtNew() { IMAGAS; return (((extraSPHData*)extraData)->dtNew());}
438 #endif
439  inline double& dTimeFB() { IMAGAS; return (((extraSPHData*)extraData)->dTimeFB());}
440 #ifndef COOLING_NONE
441  inline double& uDot() { IMAGAS; return (((extraSPHData*)extraData)->uDot());}
442  inline COOLPARTICLE& CoolParticle() { IMAGAS; return (((extraSPHData*)extraData)->CoolParticle());}
443 #endif
444 #ifdef DIFFUSION
445  inline double& diff() { IMAGAS; return (((extraSPHData*)extraData)->diff());}
446  inline double& fMetalsDot() { IMAGAS; return (((extraSPHData*)extraData)->fMetalsDot());}
447  inline double& fMetalsPred() { IMAGAS; return (((extraSPHData*)extraData)->fMetalsPred());}
448  inline double& fMFracOxygenDot() { IMAGAS; return (((extraSPHData*)extraData)->fMFracOxygenDot());}
449  inline double& fMFracIronDot() { IMAGAS; return (((extraSPHData*)extraData)->fMFracIronDot());}
450  inline double& fMFracOxygenPred() { IMAGAS; return (((extraSPHData*)extraData)->fMFracOxygenPred());}
451  inline double& fMFracIronPred() { IMAGAS; return (((extraSPHData*)extraData)->fMFracIronPred());}
452 #endif
453 #ifdef SUPERBUBBLE
454  inline COOLPARTICLE& CoolParticleHot() { IMAGAS; return (((extraSPHData*)extraData)->CoolParticleHot());}
455  inline int& cpHotInit() { IMAGAS; return (((extraSPHData*)extraData)->cpHotInit());}
456  inline double& uHot() { IMAGAS; return (((extraSPHData*)extraData)->uHot());}
457  inline double& uHotPred() { IMAGAS; return (((extraSPHData*)extraData)->uHotPred());}
458  inline double& uHotDot() { IMAGAS; return (((extraSPHData*)extraData)->uHotDot());}
459  inline double& massHot() { IMAGAS; return (((extraSPHData*)extraData)->massHot());}
460  inline double& fDensityU() { IMAGAS; return (((extraSPHData*)extraData)->fDensityU());}
461  inline double& fThermalCond() { IMAGAS; return (((extraSPHData*)extraData)->fThermalCond());}
462  inline double& fPromoteSum() { IMAGAS; return (((extraSPHData*)extraData)->fPromoteSum());}
463  inline double& fPromoteSumuPred() { IMAGAS; return (((extraSPHData*)extraData)->fPromoteSumuPred());}
464  inline double& fPromoteuPredInit() { IMAGAS; return (((extraSPHData*)extraData)->fPromoteuPredInit());}
465 #endif
466  // Access Star Quantities
467  // XXX Beware overlaps with SPH; we could fix this by aligning
468  // all common variables up at the start of the extraData structure.
469  inline double& fStarMetals() { IMASTAR; return (((extraStarData*)extraData)->fMetals());}
470  inline double& fStarMFracOxygen() {IMASTAR; return (((extraStarData*)extraData)->fMFracOxygen());}
471  inline double& fStarMFracIron() {IMASTAR; return (((extraStarData*)extraData)->fMFracIron());}
472  inline double& fTimeForm() { IMASTAR; return (((extraStarData*)extraData)->fTimeForm());}
473  inline double& fMassForm() { IMASTAR; return (((extraStarData*)extraData)->fMassForm());}
474  inline double& fStarESNrate() {IMASTAR; return (((extraStarData*)extraData)->fESNrate());}
475  inline double& fNSN() {IMASTAR; return (((extraStarData*)extraData)->fNSN());}
476  inline double& fMSN() {IMASTAR; return (((extraStarData*)extraData)->fMSN());}
477  inline double& fMIronOut() {IMASTAR; return (((extraStarData*)extraData)->fMIronOut());}
478  inline double& fMOxygenOut() {IMASTAR; return (((extraStarData*)extraData)->fMOxygenOut());}
479  inline double& fSNMetals() {IMASTAR; return (((extraStarData*)extraData)->fSNMetals());}
480  inline int64_t& iGasOrder() { IMASTAR; return (((extraStarData*)extraData)->iGasOrder());}
481  inline int64_t& iEaterOrder() { IMASTAR; return (((extraStarData*)extraData)->iEaterOrder());}
482  inline double& dDeltaM() { IMASTAR; return (((extraStarData*)extraData)->dDeltaM());}
483  inline double& dMDot() { IMASTAR; return (((extraStarData*)extraData)->dMDot());}
484 #ifdef COOLING_MOLECULARH
485  inline double dStarLymanWerner() const { IMASTAR; return (((extraStarData*)extraData)->dStarLymanWerner());}
486  inline double& dStarLymanWerner() { IMASTAR; return (((extraStarData*)extraData)->dStarLymanWerner());}
487 #endif /*COOLING_MOLECULARH*/
488 
489 // See above debugging macros
490 #undef IMAGAS
491 #undef IMASTAR
492 
493 /* Particle Type Masks */
494 
495 #define TYPE_GAS (1<<0)
496 #define TYPE_DARK (1<<1)
497 #define TYPE_STAR (1<<2)
498 
499 #define TYPE_DELETED (1<<3)
500 
501 #define TYPE_PHOTOGENIC (1<<4)
502 #define TYPE_NbrOfACTIVE (1<<5)
503 #define TYPE_SMOOTHACTIVE (1<<6)
504 
505 #define TYPE_SINK (1<<7)
506 #define TYPE_SINKING (1<<8)
507 #define TYPE_NEWSINKING (1<<9)
508 #define TYPE_PROMOTED (1<<10)
509 #define TYPE_FEEDBACK (1<<11)
510 #define TYPE_MAXTYPE (1<<12)
511 
512  inline bool isDark() const { return TYPETest(this, TYPE_DARK);}
513  inline bool isGas() const { return TYPETest(this, TYPE_GAS);}
514  inline bool isStar() const { return TYPETest(this, TYPE_STAR);}
515 
516  GravityParticle &operator=(const ExternalGravityParticle &p){
517  mass = p.mass;
518  soft = p.soft;
519  position = p.position;
520  return *this;
521  }
522 };
523 
525 inline int TYPETest(const GravityParticle *a, unsigned int b) {
526  return a->iType & b;
527  }
529 inline int TYPESet(GravityParticle *a, unsigned int b) {
530  return a->iType |= b;
531  }
533 inline int TYPEReset(GravityParticle *a, unsigned int b) {
534  return a->iType &= (~b);
535  }
536 inline int TYPEClear(GravityParticle *a) {
537  return a->iType = 0;
538  }
539 
542 {
543  CkAssert(TYPETest(p, TYPE_DELETED));
544 
545  TYPEReset(p, TYPE_DELETED);
546  }
547 
550 {
551  TYPESet(p, TYPE_DELETED);
552  }
553 
557 {
558  GravityParticle starp = *p;
559  TYPESet(&starp, TYPE_STAR);
560  starp.extraData = new extraStarData;
561  starp.fStarMetals() = p->fMetals();
562  starp.fStarMFracOxygen() = p->fMFracOxygen();
563  starp.fStarMFracIron() = p->fMFracIron();
564  return starp;
565  }
566 
569  public:
570 
571  cosmoType mass;
572  double fBall;
573  double fDensity;
574  Vector3D<cosmoType> position;
575  Vector3D<double> velocity;
576  int64_t iOrder;
577  unsigned int iType; // Bitmask to hold particle type information
578  int rung;
579 #ifdef DTADJUST
580  double dt;
581  double dtNew;
582 #endif
583  Vector3D<double> vPred;
584  Vector3D<cosmoType> treeAcceleration;
585  double mumax;
586  double PdV;
587  double uDotPdV;
588  double uDotAV;
589  double uDotDiff;
590  double c;
591  double PoverRho2;
592  double BalsaraSwitch;
593  double fBallMax;
594 #ifdef CULLENALPHA
595  double CullenAlpha;
596  double TimeDivV;
597  double dvds;
598  double dvds_old;
599 #endif
600  double u;
601  double uPred;
602  double uDot;
603  double fESNrate;
604  double fMetals;
605  double fMFracOxygen;
606  double fMFracIron;
607  double fTimeCoolIsOffUntil;
608  Vector3D<double> curlv; /* Curl of the velocity */
609 #ifdef DIFFUSION
610  double diff;
611  double fMetalsDot;
612  double fMFracOxygenDot;
613  double fMFracIronDot;
614 #endif
615 #ifdef SUPERBUBBLE
616  COOLPARTICLE CoolParticle;
617  double uHot;
618  double uHotDot;
619  double uHotPred;
620  double massHot;
621  double fDensityU;
622  double fThermalCond;
623  double fPromoteSum;
624  double fPromoteSumuPred;
625  double fPromoteuPredInit;
626 #endif
627  double fNSN;
628  int64_t iEaterOrder;
629  double dTimeFB;
630  int iBucketOff; /* Used by the Cache */
631 
633 
635  {
636  mass = p->mass;
637  fBall = p->fBall;
638  fDensity = p->fDensity;
639  position = p->position;
640  velocity = p->velocity;
641  iOrder = p->iOrder;
642  iType = p->iType;
643  rung = p->rung;
644  treeAcceleration = p->treeAcceleration;
645  if(TYPETest(p, TYPE_GAS)) {
646  vPred = p->vPred();
647  mumax = p->mumax();
648  PdV = p->PdV();
649  uDotPdV = p->uDotPdV();
650  uDotAV = p->uDotAV();
651  uDotDiff = p->uDotDiff();
652  c = p->c();
653  PoverRho2 = p->PoverRho2();
654  BalsaraSwitch = p->BalsaraSwitch();
655  fBallMax = p->fBallMax();
656 #ifdef CULLENALPHA
657  CullenAlpha = p->CullenAlpha();
658  TimeDivV = p->TimeDivV();
659  dvds = p->dvds();
660  dvds_old = p->dvds_old();
661 #endif
662  curlv = p->curlv();
663  u = p->u();
664 #ifndef COOLING_NONE
665  uDot = p->uDot();
666 #endif
667  uPred = p->uPred();
668  fMetals = p->fMetals();
669  fESNrate = p->fESNrate();
670  fMFracOxygen = p->fMFracOxygen();
671  fMFracIron = p->fMFracIron();
672  fTimeCoolIsOffUntil = p->fTimeCoolIsOffUntil();
673 #ifdef DIFFUSION
674  diff = p->diff();
675  fMetalsDot = p->fMetalsDot();
676  fMFracOxygenDot = p->fMFracOxygenDot();
677  fMFracIronDot = p->fMFracIronDot();
678 #endif
679 #ifdef SUPERBUBBLE
680  CoolParticle = p->CoolParticle();
681  uHot = p->uHot();
682  uHotPred = p->uHotPred();
683  uHotDot = p->uHotDot();
684  massHot = p->massHot();
685  fDensityU = p->fDensityU();
686  fThermalCond = p->fThermalCond();
687  fPromoteSum = p->fPromoteSum();
688  fPromoteSumuPred = p->fPromoteSumuPred();
689  fPromoteuPredInit = p->fPromoteuPredInit();
690 #endif
691 #ifdef DTADJUST
692  dt = p->dt;
693  dtNew = p->dtNew();
694 #endif
695  dTimeFB = p->dTimeFB();
696  }
697  if(TYPETest(p, TYPE_STAR)) {
698  fNSN = p->fNSN();
699  iEaterOrder = p->iEaterOrder();
700  }
701  }
702 
704  inline void getParticle(GravityParticle *tmp) const {
705  tmp->mass = mass;
706  tmp->fBall = fBall;
707  tmp->fDensity = fDensity;
708  tmp->position = position;
709  tmp->velocity = velocity;
710  tmp->iOrder = iOrder;
711  tmp->iType = iType;
712  tmp->rung = rung;
713  tmp->treeAcceleration = treeAcceleration;
714  if(TYPETest(tmp, TYPE_GAS)) {
715  tmp->vPred() = vPred;
716  tmp->mumax() = mumax;
717  tmp->PdV() = PdV;
718  tmp->uDotPdV() = uDotPdV;
719  tmp->uDotAV() = uDotAV;
720  tmp->uDotDiff() = uDotDiff;
721  tmp->c() = c;
722  tmp->PoverRho2() = PoverRho2;
723  tmp->BalsaraSwitch() = BalsaraSwitch;
724  tmp->fBallMax() = fBallMax;
725 #ifdef CULLENALPHA
726  tmp->CullenAlpha() = CullenAlpha;
727  tmp->TimeDivV() = TimeDivV;
728  tmp->dvds() = dvds;
729  tmp->dvds_old() = dvds_old;
730 #endif
731  tmp->curlv() = curlv;
732  tmp->u() = u;
733 #ifndef COOLING_NONE
734  tmp->uDot() = uDot;
735 #endif
736  tmp->uPred() = uPred;
737  tmp->fMetals() = fMetals;
738  tmp->fESNrate() = fESNrate;
739  tmp->fMFracOxygen() = fMFracOxygen;
740  tmp->fMFracIron() = fMFracIron;
741  tmp->fTimeCoolIsOffUntil() = fTimeCoolIsOffUntil;
742 #ifdef DIFFUSION
743  tmp->diff() = diff;
744  tmp->fMetalsDot() = fMetalsDot;
745  tmp->fMFracOxygenDot() = fMFracOxygenDot;
746  tmp->fMFracIronDot() = fMFracIronDot;
747 #endif
748 #ifdef SUPERBUBBLE
749  tmp->CoolParticle() = CoolParticle;
750  tmp->uHot() = uHot;
751  tmp->uHotPred() = uHotPred;
752  tmp->uHotDot() = uHotDot;
753  tmp->massHot() = massHot;
754  tmp->fDensityU() = fDensityU;
755  tmp->fThermalCond() = fThermalCond;
756  tmp->fPromoteSum() = fPromoteSum;
757  tmp->fPromoteSumuPred() = fPromoteSumuPred;
758  tmp->fPromoteuPredInit() = fPromoteuPredInit;
759 #endif
760 #ifdef DTADJUST
761  tmp->dt = dt;
762  tmp->dtNew() = dtNew;
763 #endif
764  tmp->dTimeFB() = dTimeFB;
765  }
766  if(TYPETest(tmp, TYPE_STAR)) {
767  tmp->fNSN() = fNSN;
768  tmp->iEaterOrder() = iEaterOrder;
769  }
770  }
771 
772 #ifdef __CHARMC__
773  void pup(PUP::er &p) {
774  p | position;
775  p | velocity;
776  p | mass;
777  p | fBall;
778  p | fDensity;
779  p | iOrder;
780  p | iType;
781  p | rung;
782 #ifdef DTADJUST
783  p | dt;
784  p | dtNew;
785 #endif
786  p | treeAcceleration;
787  p | vPred;
788  p | mumax;
789  p | PdV;
790  p | uDotPdV;
791  p | uDotAV;
792  p | uDotDiff;
793  p | c;
794  p | PoverRho2;
795  p | BalsaraSwitch;
796  p | fBallMax;
797 #ifdef CULLENALPHA
798  p | CullenAlpha;
799  p | TimeDivV;
800  p | dvds;
801  p | dvds_old;
802 #endif
803  p | u;
804  p | uPred;
805  p | uDot;
806  p | curlv;
807  p | fMetals;
808  p | fESNrate;
809  p | fMFracOxygen;
810  p | fMFracIron;
811  p | fTimeCoolIsOffUntil;
812 #ifdef DIFFUSION
813  p | diff;
814  p | fMetalsDot;
815  p | fMFracOxygenDot;
816  p | fMFracIronDot;
817 #endif
818 #ifdef SUPERBUBBLE
819  p((char *) &CoolParticle, sizeof(CoolParticle)); /* PUPs as bytes */
820  p | uHot;
821  p | uHotPred;
822  p | uHotDot;
823  p | massHot;
824  p | fDensityU;
825  p | fThermalCond;
826  p | fPromoteSum;
827  p | fPromoteSumuPred;
828  p | fPromoteuPredInit;
829 #endif
830  p | fNSN;
831  p | iEaterOrder;
832  p | dTimeFB;
833  p | iBucketOff;
834  }
835 #endif
836 };
837 
839 { return ExternalSmoothParticle(this); }
840 
841 inline int TYPETest(ExternalSmoothParticle *a, unsigned int b) {
842  return a->iType & b;
843  }
844 
845 #endif
Class for cross processor data needed for smooth operations.
Definition: GravityParticle.h:568
unsigned int iType
Bitmask to hold particle type information.
Definition: GravityParticle.h:330
int64_t iOrder
Input order of particles; unique particle ID.
Definition: GravityParticle.h:328
int TYPEReset(GravityParticle *a, unsigned int b)
Unset a type flag.
Definition: GravityParticle.h:533
void getParticle(GravityParticle *tmp) const
Fill in a full gravity particle from this object.
Definition: GravityParticle.h:704
Extra data needed for SPH.
Definition: GravityParticle.h:50
bool operator<(const GravityParticle &p) const
Used to sort the particles into tree order.
Definition: GravityParticle.h:358
GravityParticle StarFromGasParticle(GravityParticle *p)
Create star particle from gas particle Note that new memory is allocated for the extradata.
Definition: GravityParticle.h:556
int TYPESet(GravityParticle *a, unsigned int b)
Set a type flag.
Definition: GravityParticle.h:529
Information needed to calculate gravity.
Definition: GravityParticle.h:33
Object to bookkeep a Bucket Walk.
Definition: GravityParticle.h:18
void unDeleteParticle(GravityParticle *p)
unmark particle as deleted
Definition: GravityParticle.h:541
unsigned int bucketSize
Definition: ParallelGravity.cpp:125
void deleteParticle(GravityParticle *p)
mark particle as deleted
Definition: GravityParticle.h:549
per-particle cooling data
Definition: cooling_boley.h:68
#define IMASTAR
Definition: GravityParticle.h:397
int TYPETest(const GravityParticle *a, unsigned int b)
Test for a type flag.
Definition: GravityParticle.h:525
Fundamental type for a particle.
Definition: GravityParticle.h:316
cosmoType dtGrav
Definition: GravityParticle.h:322
Extra data needed for Stars.
Definition: GravityParticle.h:243
double fBall
Neighbor search radius for smoothing.
Definition: GravityParticle.h:326
ExternalSmoothParticle getExternalSmoothParticle()
Get quantities needed for SPH smooths.
Definition: GravityParticle.h:838
#define IMAGAS
Definition: GravityParticle.h:394
int rung
the current rung (greater means faster)
Definition: GravityParticle.h:329