cloudy trunk
Loading...
Searching...
No Matches
parse_extinguish.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/*ParseExtinguish parse the extinguish command */
4#include "cddefines.h"
5#include "rfield.h"
6#include "parser.h"
7
8/*ParseExtinguish parse the extinguish command */
10{
11 // extinguish ionizing continuum by absorbing column AFTER
12 // setting luminosity or intensity. First number is the column
13 // density (log), second number is leakage (def=0%)
14 // last number is lowest energy (ryd), last two may be omitted
15 // from right to left
16 //
17 // extinction is actually done in extin, which is called by ContSetIntensity
18
19 DEBUG_ENTRY( "ParseExtinguish()" );
20
21 rfield.ExtinguishColumnDensity = (realnum)p.FFmtRead();
22 if( p.lgEOL() )
23 p.NoNumb("extinguishing column");
24
25 // default is for the number to be the log of the column.
26 // there is a linear option for the column or optical depth,
27 // if linear does not occur then log, and convert to linear */
28 if( !p.nMatch("LINE" ) )
29 {
30 if( rfield.ExtinguishColumnDensity>35. )
31 {
32 fprintf(ioQQQ,
33 " The first parameter on this command line is the log of either the column density or optical depth.\n");
34 fprintf(ioQQQ,
35 " The value seems pretty big to me - please check it.\n");
36 /* flush it since we will probably crash */
37 fflush(ioQQQ);
38 }
39 rfield.ExtinguishColumnDensity = (realnum)pow((realnum)10.f,rfield.ExtinguishColumnDensity);
40 }
41
42 /* option to set leakage - default is 0. */
43 rfield.ExtinguishLeakage = (realnum)p.FFmtRead();
44 if( p.lgEOL() )
45 rfield.ExtinguishLeakage = 0.;
46
47 /* negative leaks are logs */
48 if( rfield.ExtinguishLeakage < 0. )
49 rfield.ExtinguishLeakage = (realnum)pow((realnum)10.f,rfield.ExtinguishLeakage);
50
51 if( rfield.ExtinguishLeakage > 1. )
52 {
53 /* but leaks greater than 1 are not allowed */
54 fprintf( ioQQQ, " A leakage of%9.0f%% was entered - this must be less than 100%%\n",
55 rfield.ExtinguishLeakage*100. );
57 }
58 // user input check that H-ionizing radiation is blocked if
59 // table Draine used */
60 rfield.lgBlockHIon = true;
61
62 /* option to set lowest energy for absorber */
63 rfield.ExtinguishLowEnergyLimit = (realnum)p.FFmtRead();
64 if( p.lgEOL() )
65 rfield.ExtinguishLowEnergyLimit = 0.99946f;
66 else
67 {
68 if( rfield.ExtinguishLowEnergyLimit <= 0. )
69 rfield.ExtinguishLowEnergyLimit = (realnum)pow((realnum)10.f,rfield.ExtinguishLowEnergyLimit);
70 if( rfield.ExtinguishLowEnergyLimit < 0.99946 )
71 fprintf( ioQQQ, " Energy less than 1 Ryd!!\n" );
72 }
73
74 /* specify optical depth at 1 Ryd rather than column density */
75 if( p.nMatch("OPTI" ) )
76 {
77 /* convert the optical depth into the proper column density */
78 rfield.ExtinguishColumnDensity /= (realnum)(rfield.ExtinguishConvertColDen2OptDepth*
79 pow(rfield.ExtinguishLowEnergyLimit,rfield.ExtinguishEnergyPowerLow) );
80 }
81
82 return;
83}
FILE * ioQQQ
Definition cddefines.cpp:7
#define EXIT_FAILURE
Definition cddefines.h:140
#define cdEXIT(FAIL)
Definition cddefines.h:434
float realnum
Definition cddefines.h:103
#define DEBUG_ENTRY(funcname)
Definition cddefines.h:684
double FFmtRead(void)
Definition parser.cpp:353
bool nMatch(const char *chKey) const
Definition parser.h:135
bool lgEOL(void) const
Definition parser.h:98
NORETURN void NoNumb(const char *chDesc) const
Definition parser.cpp:233
void ParseExtinguish(Parser &p)
t_rfield rfield
Definition rfield.cpp:8