cloudy  trunk
molcol.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 /*molcol generate and print molecular column densities */
4 #include "cddefines.h"
5 #include "radius.h"
6 #include "colden.h"
7 #include "h2.h"
8 #include "mole.h"
9 #include "atomfeii.h"
10 #include "molcol.h"
11 
12 void molcol(
13  const char *chLabel,
14  /* file for printout */
15  FILE *ioMEAN )
16 {
17  long int i;
18 
19  DEBUG_ENTRY( "molcol()" );
20 
21  /* call large H2 and CO column density routines which will do their jobs */
22  FeII_Colden( chLabel);
23  h2.H2_Colden( chLabel);
24 
25  if( strcmp(chLabel,"ZERO") == 0 )
26  {
27  /* zero out the column densities */
28  for( i=0; i < mole_global.num_calc; i++ )
29  {
30  mole.species[i].column = 0.;
31  }
32  }
33 
34  else if( strcmp(chLabel,"ADD ") == 0 )
35  {
36  /* add together column densities */
37  for( i=0; i < mole_global.num_calc; i++ )
38  {
39  mole.species[i].column += (realnum)(mole.species[i].den*radius.drad_x_fillfac);
40  }
41  }
42 
43  else if( strcmp(chLabel,"PRIN") == 0 )
44  {
45  bool lgFirstPrint = true;
46  /* print the molecular column densities */
47  int j=0;
48  chem_atom *heavyAtom = null_atom, *lastHeavyAtom = null_atom;
49  for( i=0; i < mole_global.num_calc; i++ )
50  {
51  if(mole.species[i].location == NULL && ( !mole_global.list[i]->isMonatomic() || !mole_global.list[i]->lgGas_Phase ) )
52  {
53  lastHeavyAtom = heavyAtom;
54  heavyAtom = mole_global.list[i]->heavyAtom();
55  if(j == 8 || heavyAtom != lastHeavyAtom)
56  {
57  fprintf( ioMEAN, "\n" );
58  if (heavyAtom != lastHeavyAtom)
59  {
60  fprintf ( ioMEAN, "==== %-*.*s compounds ====",
61  CHARS_ISOTOPE_SYM, CHARS_ISOTOPE_SYM, heavyAtom->label().c_str() );
62  if( lgFirstPrint )
63  {
64  fprintf ( ioMEAN, " Log10 column densities [cm^-2}");
65  lgFirstPrint = false;
66  }
67  fprintf(ioMEAN, "\n");
68  }
69  j = 0;
70  }
71  fprintf( ioMEAN, " %-*.*s:", CHARS_SPECIES, CHARS_SPECIES, mole_global.list[i]->label.c_str() );
72  fprintf( ioMEAN, "%7.3f",log10(MAX2(SMALLFLOAT,mole.species[i].column )));
73  j++;
74  }
75  }
76  if (j != 0)
77  fprintf( ioMEAN, "\n" );
78  }
79 
80  else
81  {
82  fprintf( ioMEAN, " molcol does not understand the label %4.4s\n",
83  chLabel );
85  }
86  return;
87 
88 }
colden.h
h2
diatomics h2("h2", 4100., &hmi.H2_total, Yan_H2_CS)
FeII_Colden
void FeII_Colden(const char *chLabel)
Definition: atom_feii.cpp:177
realnum
float realnum
Definition: cddefines.h:103
mole.h
t_mole_global::list
MoleculeList list
Definition: mole.h:317
diatomics::H2_Colden
void H2_Colden(const char *chLabel)
Definition: mole_h2.cpp:2378
radius
t_radius radius
Definition: radius.cpp:5
CHARS_SPECIES
@ CHARS_SPECIES
Definition: cddefines.h:274
EXIT_FAILURE
#define EXIT_FAILURE
Definition: cddefines.h:140
mole
t_mole_local mole
Definition: mole.cpp:7
cddefines.h
radius.h
molcol
void molcol(const char *chLabel, FILE *ioMEAN)
Definition: molcol.cpp:12
MAX2
#define MAX2
Definition: cddefines.h:782
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
chem_atom::label
string label(void) const
Definition: mole.h:55
molcol.h
chem_atom
Definition: mole.h:37
t_radius::drad_x_fillfac
double drad_x_fillfac
Definition: radius.h:71
null_atom
chem_atom * null_atom
Definition: mole_species.cpp:68
t_mole_local::species
valarray< class molezone > species
Definition: mole.h:398
h2.h
mole_global
t_mole_global mole_global
Definition: mole.cpp:6
atomfeii.h
t_mole_global::num_calc
int num_calc
Definition: mole.h:314
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684
SMALLFLOAT
const realnum SMALLFLOAT
Definition: cpu.h:191
CHARS_ISOTOPE_SYM
@ CHARS_ISOTOPE_SYM
Definition: cddefines.h:275