cloudy trunk
Loading...
Searching...
No Matches
eden_change.cpp
Go to the documentation of this file.
1/* This file is part of Cloudy and is copyright (C)1978-2013 by Gary J. Ferland and
2 * others. For conditions of distribution and use see copyright notice in license.txt */
3/*EdenChange - update electron density and its dependent quantities */
4#include "cddefines.h"
5#include "dense.h"
6#include "rfield.h"
7#include "thermal.h"
8#include "phycon.h"
9#include "conv.h"
10#include "rt.h"
11
12void EdenChange( double EdenNew )
13{
14 static double EdenOld=-1;
15
16 DEBUG_ENTRY( "EdenChange()" );
17
18 // init EdenOld on first sweep through this sim
19 if( conv.nTotalIoniz==0 )
20 EdenOld = dense.eden;
21
22 // this confirms that eden is only changed in this routine
23 ASSERT( fp_equal(dense.eden , EdenOld ) );
24
25 dense.eden = EdenNew;
26 EdenOld = EdenNew;
27
29 /* dense.HCorrFac is unity by default and changed with the set HCOR command */
34 dense.SqrtEden = sqrt(dense.eden);
35
36 /* evaluate the plasma frequency one time per zone to avoid PF moving across
37 * a line during convergence loops */
39 {
42
43 if( rfield.ipPlasma > 0 )
44 {
45 /* increase index for plasma frequency until within proper cell */
48
49 /* decrease index for plasma frequency until within proper cell */
52 }
53
54 /* also remember the largest plasma frequency we encounter */
56
57 /* is plasma frequency within energy grid? */
58 if( rfield.plsfrq > rfield.anu[0] )
59 {
60 rfield.lgPlasNu = true;
61 }
62 }
63
64 // if plasma frequency has changed we need to update transitions - those
65 // below plasma frequency do not exist - emission rate set to smallfloat
66 // only do this in search phase since plasma frequency moving across transition
67 // would create discontinuous changes in cooling that would present noise
68 // to the solver. The electron density should not change by much during the
69 // solution for a zone
70 static double EdenEval=-1;
71 if( conv.lgSearch && !fp_equal(EdenEval,dense.eden) )
72 {
73 EdenEval = dense.eden;
75 }
76
77 return;
78}
long int nzone
Definition: cddefines.cpp:14
#define ASSERT(exp)
Definition: cddefines.h:578
float realnum
Definition: cddefines.h:103
#define MAX2
Definition: cddefines.h:782
bool fp_equal(sys_float x, sys_float y, int n=3)
Definition: cddefines.h:812
const int ipHYDROGEN
Definition: cddefines.h:305
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
t_conv conv
Definition: conv.cpp:5
t_dense dense
Definition: dense.cpp:24
void EdenChange(double EdenNew)
Definition: eden_change.cpp:12
t_phycon phycon
Definition: phycon.cpp:6
UNUSED const double FR1RYD
Definition: physconst.h:195
UNUSED const double PI
Definition: physconst.h:29
UNUSED const double ELECTRON_MASS
Definition: physconst.h:91
UNUSED const double COLL_CONST
Definition: physconst.h:229
UNUSED const double ELEM_CHARGE_ESU
Definition: physconst.h:147
t_rfield rfield
Definition: rfield.cpp:8
void RT_line_all(void)
Definition: rt_line_all.cpp:26
long int nTotalIoniz
Definition: conv.h:166
bool lgSearch
Definition: conv.h:175
realnum HCorrFac
Definition: dense.h:111
double eden
Definition: dense.h:190
double SqrtEden
Definition: dense.h:212
double cdsqte
Definition: dense.h:235
double EdenHCorr
Definition: dense.h:216
realnum EdenHCorr_f
Definition: dense.h:218
double xIonDense[LIMELM][LIMELM+1]
Definition: dense.h:125
double edensqte
Definition: dense.h:230
double sqrte
Definition: phycon.h:48
realnum plsfrqmax
Definition: rfield.h:449
realnum plsfrq
Definition: rfield.h:447
bool lgPlasNu
Definition: rfield.h:445
long int ipPlasma
Definition: rfield.h:453
realnum * widflx
Definition: rfield.h:65
double * anu
Definition: rfield.h:58
long int nZonePlsFrqEval
Definition: rfield.h:451