cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 }
t_mole_global mole_global
Definition: mole.cpp:6
int num_calc
Definition: mole.h:314
const realnum SMALLFLOAT
Definition: cpu.h:178
#define MAX2
Definition: cddefines.h:786
chem_atom * null_atom
t_mole_local mole
Definition: mole.cpp:7
float realnum
Definition: cddefines.h:107
valarray< class molezone > species
Definition: mole.h:355
#define EXIT_FAILURE
Definition: cddefines.h:144
void FeII_Colden(const char *chLabel)
Definition: atom_feii.cpp:177
#define cdEXIT(FAIL)
Definition: cddefines.h:438
diatomics h2("h2", 4100.,&hmi.H2_total, Yan_H2_CS)
void molcol(const char *chLabel, FILE *ioMEAN)
Definition: molcol.cpp:12
t_radius radius
Definition: radius.cpp:5
Definition: mole.h:37
string label(void) const
Definition: mole.h:55
double drad_x_fillfac
Definition: radius.h:71
void H2_Colden(const char *chLabel)
Definition: mole_h2.cpp:2361
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:688
MoleculeList list
Definition: mole.h:317