PLUTO
cooling.c File Reference

Take a source step using power-law cooling. More...

#include "pluto.h"
Include dependency graph for cooling.c:

Go to the source code of this file.

Functions

void PowerLawCooling (Data_Arr VV, double dt, Time_Step *Dts, Grid *grid)
 

Detailed Description

Take a source step using power-law cooling.

Integrate the ODE

\[ dp_{\rm cgs}/dt_{\rm cgs} = -(\Gamma - 1) \Lambda(\rho_{\rm cgs}, T_{\rm cgs}) \qquad{\rm where}\qquad \Lambda = \frac{a_{br}}{(\mu m_H)^2} \rho_{\rm cgs}^2 \sqrt{T_{\rm cgs}} \,,\qquad a_{br} = 2.e-27 c.g.s \]

which accounts for bremmstrahlung cooling. Here the subscript 'cgs' means that the corresponding quantity is given in c.g.s units. We denote with mu the molecular weight, mH the hydrogen mass (in c.g.s).

The previous integration is carried out analytically since the density does not change during this step. In non-dimensional form:

\[ \frac{dp}{dt} = -{\rm cost} \;\rho (\rho p)^{\HALF} \]

[notice that since p/rho=T/KELVIN this is equivalent to: dp/dt=-cost rho^2 (T/KELVIN)^(1/2) ]

The quantity cost is determined by transforming the dimensional equation into the non-dimensional one. If p, rho and t are in code (non-dimensional) units and if L_0, rho_0, and V_0 are the unit length, density and velocity, then cost is found to be:

                 a_br * (gamma - 1) * L_0 * rho_0
      cost = -------------------------------------------
              sqrt(kB * mu * mH) * kB * mu * mH * V_0^2

where a_{br} = 2.e-27 (in c.g.s), kB is the Boltmann constant

Authors
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
July 28, 2014

Definition in file cooling.c.

Function Documentation

void PowerLawCooling ( Data_Arr  VV,
double  dt,
Time_Step Dts,
Grid grid 
)
Parameters
[in,out]VVa pointer to the PLUTO 3D data array containing pimitive variables.
[in]dtthe current integration time step
[in]Dtsa pointer to the Time_Step structure
[in]gridpointer to an array of Grid structures

Definition at line 50 of file cooling.c.

59 {
60  int i, j, k;
61  double cost, dE;
62  double rho, p, T, p_f, T_f;
63 
65  cost *= 2.e-27*(g_gamma-1.0)/ (0.5*CONST_mH*sqrt(0.5*CONST_mH*CONST_kB));
66 
67 /* -------------------------------------------------------------
68  Integrate analytically
69  ------------------------------------------------------------- */
70 
71  dE = 1.e-18;
72  DOM_LOOP(k,j,i){
73 
74 /* ---- Find initial temperature in Kelvin ---- */
75 
76  rho = VV[RHO][k][j][i];
77  p = VV[PRS][k][j][i];
78 
79  T = (p/rho*KELVIN);
80 
81  if (T < g_minCoolingTemp) continue;
82 
83 /* ---- Find final energy ---- */
84 
85  p_f = sqrt(p) - 0.5*cost*rho*sqrt(rho)*dt;
86  p_f = MAX(p_f, 0.0);
87  p_f = p_f*p_f;
88  T_f = p_f/rho*KELVIN;
89  T_f = MAX (T_f, g_minCoolingTemp);
90 
91 /* ---- Update Energy ---- */
92 
93  p_f = T_f*rho/KELVIN;
94 
95  VV[PRS][k][j][i] = p_f;
96  dE = fabs(1.0 - p_f/p) + 1.e-18;
97 
98  Dts->dt_cool = MIN(Dts->dt_cool, dt*g_maxCoolingRate/dE);
99  }
100 
101 }
#define MAX(a, b)
Definition: macros.h:101
tuple T
Definition: Sph_disk.py:33
double g_gamma
Definition: globals.h:112
#define UNIT_DENSITY
Unit density in gr/cm^3.
Definition: pluto.h:369
DOM_LOOP(k, j, i)
Definition: analysis.c:22
#define RHO
Definition: mod_defs.h:19
#define KELVIN
Definition: pluto.h:401
#define MIN(a, b)
Definition: macros.h:104
#define UNIT_VELOCITY
Unit velocity in cm/sec.
Definition: pluto.h:377
double dt_cool
Cooling time step.
Definition: structs.h:219
#define UNIT_LENGTH
Unit Length in cm.
Definition: pluto.h:373
#define CONST_kB
Boltzmann constant.
Definition: pluto.h:259
#define CONST_mH
Hydrogen atom mass.
Definition: pluto.h:264
int j
Definition: analysis.c:2
int k
Definition: analysis.c:2
double g_minCoolingTemp
The minimum temperature (in K) below which cooling is suppressed.
Definition: globals.h:106
int i
Definition: analysis.c:2
double g_maxCoolingRate
The maximum fractional variation due to cooling from one step to the next.
Definition: globals.h:104

Here is the call graph for this function:

Here is the caller graph for this function: