PLUTO
maxrate.c File Reference
#include "pluto.h"
#include "cooling_defs.h"
Include dependency graph for maxrate.c:

Go to the source code of this file.

Functions

double GetMaxRate (double *v0, double *k1, double T0)
 

Function Documentation

double GetMaxRate ( double *  v0,
double *  k1,
double  T0 
)

Return an estimate of the maximum rate (dimension 1/time) in the chemical network. This will serve as a "stiffness" detector in the main ode integrator.

For integration to be carried explicitly all the time, return a small value (1.e-12).

Definition at line 5 of file maxrate.c.

15 {
16  int nv;
17  double ev1[NIONS+1];
18  double scrh, maxrate;
19  static double **J1;
20 
21  if (J1 == NULL) {
22  J1 = ARRAY_2D(NIONS+1, NIONS+1, double);
23  }
24 
25  maxrate = 0.0;
26  for (nv = 0; nv < NIONS - Fe_IONS; nv++) { /* -- exclude Iron -- */
27 
28  /* ----------------------------------------------
29  if the initial concentration is close to 0,
30  do not take Crate as a stiffness indicator
31  ---------------------------------------------- */
32 
33  if (v0[NFLX + nv] < 1.e-6) continue;
34 
35  maxrate = MAX(maxrate, CoolCoeffs.Crate[nv]);
36  }
37  maxrate *= UNIT_LENGTH/UNIT_VELOCITY;
38 
39 /*
40  Numerical_Jacobian (v0, J1);
41  lmax = Decompose(J1[0], NIONS + 1, ev1);
42  Radiat(v0, k1);
43  scrh = maxrate/fabs(lmax) - 1.0;
44  if (fabs(scrh) > 5.e-2){
45  printf ("Crate are not the max eig, %12.6e %12.6e\n",
46  maxrate, fabs(lmax));
47  QUIT_PLUTO(1);
48  }
49  return(fabs(lmax));
50 */
51 
52  return (maxrate);
53 }
#define MAX(a, b)
Definition: macros.h:101
double Crate[NIONS]
Definition: cooling_defs.h:31
tuple scrh
Definition: configure.py:200
COOL_COEFF CoolCoeffs
Definition: radiat.c:38
#define UNIT_VELOCITY
Unit velocity in cm/sec.
Definition: pluto.h:377
#define NFLX
Definition: mod_defs.h:32
#define UNIT_LENGTH
Unit Length in cm.
Definition: pluto.h:373
#define NIONS
Definition: cooling.h:28
#define Fe_IONS
Definition: cooling.h:18
#define ARRAY_2D(nx, ny, type)
Definition: prototypes.h:171