31 ipLineTypePradMax=-1 ,
33 ipLinePradMax=-LONG_MAX,
41 static double Piso_seq[
NISO]={0.,0.},
59 ipLinePradMax=-LONG_MAX;
73 bool lgMustEvaluate =
false;
77 bool lgMustEvaluateTrivial =
false;
87 lgMustEvaluate =
true;
88 lgMustEvaluateTrivial =
true;
92 static long int nzoneEvaluated=0, iterationEvaluated=0;
95 lgMustEvaluate =
true;
96 lgMustEvaluateTrivial =
true;
98 ipLineTypePradMax = -1;
106 lgMustEvaluate =
true;
112 nzoneEvaluated =
nzone;
138 if( ipISO >= 0 && ipISO<
NISO )
140 for(
long i=1; i<=ion; ++i )
142 long int nelec = nelem+1 - i;
240 fprintf(
ioQQQ,
"DEBUG pressure_total updates AccelTotalOutward to %.2e grav %.2e\n",
259 " PresTotCurrent nzone %li iteration %li lgMustEvaluate:%c "
260 "lgMustEvaluateTrivial:%c "
261 "pressure.lgLineRadPresOn:%c "
262 "rfield.lgDoLineTrans:%c \n",
275 if( lgMustEvaluateTrivial || Piso_seq[ipISO] > TrivialLineRadiationPressure )
277 Piso_seq[ipISO] = 0.;
278 for(
long nelem=ipISO; nelem <
LIMELM; nelem++ )
287 for(
long ipLo=0; ipLo < ipHi; ipLo++ )
289 if(
iso_sp[ipISO][nelem].trans(ipHi,ipLo).ipCont() <= 0 )
296 ( (
iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().TauTot() -
298 iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().Pesc() > FLT_EPSILON*100. )
304 ipLineTypePradMax = 2;
309 ipLinePradMax = ipLo;
311 Piso_seq[ipISO] += RadPres1;
314 enum {DEBUG_LOC=
false};
315 if( DEBUG_LOC && ipISO==
ipH_LIKE && ipLo==3 && ipHi==5 &&
nzone > 260 )
318 "DEBUG prad1 \t%.2f\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t\n",
321 iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().PopOpc(),
322 iso_sp[ipISO][nelem].st[ipLo].Pop(),
323 iso_sp[ipISO][nelem].st[ipHi].Pop(),
324 iso_sp[ipISO][nelem].trans(ipHi,ipLo).Emis().Pesc());
332 ASSERT( Piso_seq[ipISO] >= 0. );
338 enum {DEBUG_LOC=
false};
340 if( DEBUG_LOC &&
nzone > 260 )
343 "DEBUG prad2 \t%li\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\n",
346 iso_sp[ipISO][ip3].trans(ipLinePradMax,ip2).Emis().PopOpc(),
347 iso_sp[ipISO][ip3].st[0].Pop(),
348 iso_sp[ipISO][ip3].st[2].Pop(),
349 iso_sp[ipISO][ip3].st[3].Pop(),
350 iso_sp[ipISO][ip3].st[4].Pop(),
351 iso_sp[ipISO][ip3].st[5].Pop(),
352 iso_sp[ipISO][ip3].st[6].Pop());
358 "DEBUG prad3\t%.2e\t%li\t%li\t%li\t%li\t%.2e\t%.2e\t%.2e\n",
364 iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().PopOpc(),
365 iso_sp[ip4][ip3].st[ip2].Pop(),
366 1.-
iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().Pesc() );
370 if( lgMustEvaluateTrivial || PLevel2 > TrivialLineRadiationPressure )
378 if( (*
TauLine2[i].Hi()).Pop() > 1e-30 )
385 ipLineTypePradMax = 4;
397 if( lgMustEvaluateTrivial || PHfs > TrivialLineRadiationPressure )
402 if( (*
HFLines[i].Hi()).Pop() > 1e-30 )
409 ipLineTypePradMax = 8;
420 if( lgMustEvaluateTrivial || P_H2 > TrivialLineRadiationPressure )
425 P_H2 += (*diatom)->H2_RadPress();
430 ipLineTypePradMax = 9;
438 if( lgMustEvaluateTrivial || P_dBase > TrivialLineRadiationPressure )
441 for(
long ipSpecies=0; ipSpecies<
nSpecies; ipSpecies++ )
449 int ipHi = (*tr).ipHi();
452 int ipLo = (*tr).ipLo();
453 if( (*tr).ipCont() > 0 && (*(*tr).Hi()).Pop() > 1e-30 )
459 ipLineTypePradMax = 10;
463 ipLinePradMax = ipLo;
479 ipLineTypePradMax = 0;
482 fixit(
"all other line stacks need to be included here");
492 "PresTotCurrent: negative pressure, constituents follow %e %e %e %e \n",
506 " PresTotCurrent, pressure.pbeta = %e, ipLineTypePradMax%li ipLinePradMax=%li \n",
525 for(
long nelem=ipISO; nelem <
LIMELM; nelem++ )
533 iso_sp[ipISO][nelem].
st[ipHi].Pop() *
557 for(
long i=0; i < nHFLines; i++ )
577 " PresTotCurrent zn %.2f Ptot:%.5e Pgas:%.3e Prad:%.3e Pmag:%.3e Pram:%.3e "
578 "gas parts; H:%.2e He:%.2e L2:%.2e CO:%.2e fs%.2e h2%.2e turb%.2e\n",
648 if( ipLineTypePradMax == 2 )
652 ASSERT( ip4 < NISO && ip3<LIMELM );
653 ASSERT( ipLinePradMax>=0 && ip2>=0 && ip3>=0 && ip4>=0 );
657 enum {DEBUG_LOC=
false};
662 fprintf(
ioQQQ,
"DEBUG iso prad\t%li\t%li\tISO,nelem=\t%li\t%li\tnu, no=\t%li\t%li\t%.4e\t%.4e\t%e\t%e\t%e\n",
664 ip4,ip3,ip2,ipLinePradMax,
665 iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().TauIn(),
666 iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().TauTot(),
667 iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().Pesc(),
668 iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().Pelec_esc(),
669 iso_sp[ip4][ip3].trans(ip2,ipLinePradMax).Emis().Pdest());
670 if( ip2==5 && ipLinePradMax==4 )
680 else if( ipLineTypePradMax == 4 )
683 ASSERT( ipLinePradMax>=0 );
687 else if( ipLineTypePradMax == 5 )
691 else if( ipLineTypePradMax == 6 )
695 else if( ipLineTypePradMax == 7 )
700 else if( ipLineTypePradMax == 8 )
704 ASSERT( ipLinePradMax>=0 );
707 else if( ipLineTypePradMax == 9 )
712 else if( ipLineTypePradMax == 10 )
720 fprintf(
ioQQQ,
" PresTotCurrent ipLineTypePradMax set to %li, this is impossible.\n", ipLineTypePradMax);
729 " PresTotCurrent Pbeta:%.2f due to %s\n",
759 enum{DEBUG_LOC=
false};
762 fprintf(
ioQQQ,
"pressureee%li\t%.4e\t%.4e\t%.4e\t%.3f\t%.3f\t%.3f\n",
774 if( TotalPressure_v< 0. )
779 fprintf(
ioQQQ,
" The negative pressure due to ordered magnetic field overwhelms the total outward pressure - please reconsider the geometry & field.\n");
783 ASSERT( TotalPressure_v > 0. );
realnum EnergyErg() const
string chLineLbl(const TransitionProxy &t)
realnum ph1(int i, int j, int k, int l) const
long int IonHigh[LIMELM+1]
bool lgTimeDependentStatic
TransitionList HFLines("HFLines",&AnonStates)
double fudge(long int ipnt)
TransitionList TauLine2("TauLine2",&AnonStates)
double anu(size_t i) const
void TempChange(double TempNew, bool lgForceUpdate)
realnum PressureErrorAllowed
double pres_radiation_lines_curr
t_iso_sp iso_sp[NISO][LIMELM]
void PresTotCurrent(void)
double xIonDense[LIMELM][LIMELM+1]
bool lgBallistic(void) const
long int IonLow[LIMELM+1]
long int nsShells[LIMELM][LIMELM]
double PressureRadiationLine(const TransitionProxy &t, realnum DopplerWidth)
double RT_line_driving(void)
realnum DynaFlux(double depth)
realnum AccelTotalOutward
vector< diatomics * > diatoms
realnum GetDopplerWidth(realnum massAMU)
TransitionProxy trans(const long ipHi, const long ipLo)
realnum AtomicWeight[LIMELM]
#define DEBUG_ENTRY(funcname)
vector< species > dBaseSpecies
int fprintf(const Output &stream, const char *format,...)
sys_float SDIV(sys_float x)
bool lgStatic(void) const
bool lgElemsConserved(void)
vector< TransitionList > dBaseTrans
double RT_LineWidth(const TransitionProxy &t, realnum DopplerWidth)
long int nCollapsed_local
vector< diatomics * >::iterator diatom_iter
void Magnetic_evaluate(void)