44 fprintf(
ioQQQ,
" Globule distance is negative, internal overflow has occured, sorry.\n" );
45 fprintf(
ioQQQ,
" This is routine lgConvPres, GLBDST is%10.2e\n",
63 fprintf(
ioQQQ,
" PROBLEM WIND called with zero velocity - this is impossible.\n Sorry.\n" );
79 fprintf(
ioQQQ,
" lgConvPres sets AccelGravity %.3e lgDisk?%c\n",
91 fixit(
"RHS of comparison should be ~ sound speed squared");
115 fprintf(
ioQQQ,
" lgConvPres new wind V zn%li %.3e AccelTotalOutward %.3e AccelGravity %.3e\n",
126 fprintf(
ioQQQ,
"chDenseLaw==\"WIND\" must now be ballistic or static\n");
195 fprintf(
ioQQQ,
" Insanity, lgConvPres gets chCPres=%4.4s\n",
202 static bool lgWARN2BIG=
false;
206 fprintf(
ioQQQ,
"\n\n >========== Warning! The tabulated or functional change in density as a function of depth was VERY large. This is zone %li.\n",
nzone);
207 fprintf(
ioQQQ,
" >========== Warning! This will cause convergence problems. \n");
210 fprintf(
ioQQQ,
" >========== Warning! Consider using a more modest change in density vs radius. \n\n\n");
223 fprintf(
ioQQQ,
" Unknown density law=%s= This is a major internal error.\n",
278 density_change_factor *= dP_chng_factor;
279 density_change_factor =
MIN2(density_change_factor,+pdelta);
280 density_change_factor =
MAX2(density_change_factor,-pdelta);
281 return 1.+density_change_factor;
290 bool&
lgAbort,
bool &lgStable )
313 enum{DEBUG_LOC=
false};
314 static long int nsave=-1;
320 fprintf(
ioQQQ,
"nnzzone\t%li\t%.2f%%\t%.3f\t%.2e\t%.2e\t%.2e\n",
322 density_change_factor,
334 " PressureChange called, changing HDEN from %10.3e to %10.3e Set fill fac to %10.3e\n",
339 bool lgChange = ( density_change_factor != 1. );
354 if( lgTempStatus != 0 )
359 double dpdrho = (new_pressure-old_pressure)/(new_density-old_density);
360 double dpdrhoScale = (new_pressure+old_pressure)/(new_density+old_density);
363 if ( dpdrho < -0.01*dpdrhoScale )
368 if ( dpdrho > 0.01*dpdrhoScale )
372 fprintf(
ioQQQ,
"ConvPres STABLE??? nz %ld od %.2e nd %.2e eps %.2e op %.2e np %.2e dpdn %.2e cmp %.2e %c\n",
373 nzone,old_density,new_density,new_density/old_density-1.0,
374 old_pressure,new_pressure,dpdrho,dpdrhoScale,
TorF(lgStable));
379 fixit(
"Disabled test on stability");
387 enum {DEBUG_LOC=
false};
389 if( DEBUG_LOC && (
nzone>215) )
392 "%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%.2e\t%c\n",
431 double PresTotlCorrect = st.
press;
441 " DynaPresChngFactor set PresTotlCorrect=%.3e PresTotlInit=%.3e PresInteg=%.3e DivergePresInteg=%.3e\n",
447 fprintf(
ioQQQ,
"Pressure: init %g +rad %g +diverge %g = %g cf %g\n",
453 double rhohat, dpdrho;
466 rhohat = densityCurrent - er/dpdrho;
472 dpdrho = (st.
erp-er)/(st.
dp-densityCurrent);
473 rhohat = densityCurrent - er/dpdrho;
483 rhohat = 1.03*densityCurrent;
485 rhohat = 0.97*densityCurrent;
490 rhohat = 1.03*densityCurrent;
492 rhohat = 0.97*densityCurrent;
496 st.
dp = densityCurrent;
510 " PresChng %s density old %.3e new %.3e current %.3e correct %.3e dpdn %.3e\n",
512 PresTotlCorrect, dpdrho
518 " DynaPresChngFactor mode %s new density %.3f vel %.3e\n",
669 printf(
"Need to set global pressure mode\n");
697 fixit(
"check correct zone pressure for NFW");
vector< double > hist_pres_density
STATIC void logPressureState()
realnum GetDensity(realnum z)
double MaxFractionalDensityStepPerIteration
double pressureZone(const PresMode &presmode)
vector< double > hist_pres_error
NORETURN void TotalInsanity(void)
void PressureChange(double dP_chng_factor, const PresMode &presmode, solverState &st, bool &lgAbort, bool &lgStable)
STATIC bool lgTestPressureConvergence(double new_density)
void TempChange(double TempNew, bool lgForceUpdate)
realnum PressureErrorAllowed
int ConvTempEdenIoniz(void)
double pres_radiation_lines_curr
void PresTotCurrent(void)
bool lgBallistic(void) const
void ScaleAllDensities(realnum factor)
realnum DynaFlux(double depth)
vector< double > hist_pres_current
realnum AccelTotalOutward
double tabval(double r0, double depth) const
realnum gas_phase[LIMELM]
STATIC double stepDensity(const PresMode &presmode, solverState &st)
#define DEBUG_ENTRY(funcname)
realnum scalingDensity(void)
STATIC double limitedDensityScaling(double new_density, double dP_chng_factor)
int fprintf(const Output &stream, const char *format,...)
double dense_fabden(double radius, double depth)
double dense_parametric_wind(double rad)
bool lgStatic(void) const