cloudy  trunk
parse_f_nu.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 /*ParseF_nu parse intensity command parameters */
4 #include "cddefines.h"
5 #include "physconst.h"
6 #include "rfield.h"
7 #include "radius.h"
8 #include "parser.h"
9 
10 void ParseF_nu(
11  Parser &p,
12  const char *chType,
13  bool lgNU2)
14 {
15  double fr;
16 
17  DEBUG_ENTRY( "ParseF_nu()" );
18 
19  /* flux density of this continuum source, at optional frequency */
20 
21  strcpy( rfield.chRSpec[p.m_nqh], chType );
22 
23  rfield.totpow[p.m_nqh] = p.FFmtRead();
24 
25  /* large luminosity but per sq cm */
26  if( rfield.totpow[p.m_nqh] > 37. &&
27  strcmp(rfield.chRSpec[p.m_nqh],"SQCM") == 0 )
28  {
29  fprintf( ioQQQ, " This intensity is VERY large. Problems? Was luminosity intended??\n" );
30  }
31 
32  if( p.lgEOL() )
33  {
34  p.NoNumb("flux density");
35  }
36 
37  strcpy( rfield.chSpNorm[p.m_nqh], "FLUX" );
38 
39  /* this is optional frequency in Rydbergs */
40  rfield.range[p.m_nqh][0] = p.FFmtRead();
41 
42  /* >>chng 96 dec 18, was 1 changed to H mass nuc ryd
43  * if( lgEOL ) range(nqh,1) = 1. */
44  if( p.lgEOL() )
45  {
46  rfield.range[p.m_nqh][0] = HIONPOT;
47  }
48 
49  if( rfield.range[p.m_nqh][0] <= 0. )
50  {
51  rfield.range[p.m_nqh][0] = pow(10.,rfield.range[p.m_nqh][0]);
52  }
53 
54  if( lgNU2 )
55  {
56  /* range is now freq in ryd, totpow is log of product nu*f_nu */
57  fr = log10(rfield.range[p.m_nqh][0]*FR1RYD);
58  rfield.totpow[p.m_nqh] -= fr;
59  }
60 
61  /* set R to large value in case R not specified (per sq cm)
62  * and this is per unit area */
63  if( strcmp(chType,"SQCM") == 0 && radius.Radius == 0. )
64  {
65  /* RDFALT in BLOCK DATA SCALAR, is 25 */
66  radius.Radius = pow(10.,radius.rdfalt);
67  }
68 
69  /* >>chng 06 mar 22, add time option to vary only some continua with time */
70  if( p.nMatch( "TIME" ) )
71  rfield.lgTimeVary[p.m_nqh] = true;
72 
73  ++p.m_nqh;
74  if( p.m_nqh >= LIMSPC )
75  {
76  fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
78  }
79  return;
80 }
FR1RYD
const UNUSED double FR1RYD
Definition: physconst.h:195
t_rfield::totpow
double totpow[LIMSPC]
Definition: rfield.h:300
Parser::nMatch
bool nMatch(const char *chKey) const
Definition: parser.h:135
Parser::FFmtRead
double FFmtRead(void)
Definition: parser.cpp:353
rfield
t_rfield rfield
Definition: rfield.cpp:8
ioQQQ
FILE * ioQQQ
Definition: cddefines.cpp:7
rfield.h
HIONPOT
const UNUSED double HIONPOT
Definition: physconst.h:119
LIMSPC
const int LIMSPC
Definition: rfield.h:18
radius
t_radius radius
Definition: radius.cpp:5
ParseF_nu
void ParseF_nu(Parser &p, const char *chType, bool lgNU2)
Definition: parse_f_nu.cpp:10
EXIT_FAILURE
#define EXIT_FAILURE
Definition: cddefines.h:140
t_rfield::chRSpec
char chRSpec[LIMSPC][5]
Definition: rfield.h:352
Parser::NoNumb
NORETURN void NoNumb(const char *chDesc) const
Definition: parser.cpp:233
Parser
Definition: parser.h:31
cddefines.h
t_radius::Radius
double Radius
Definition: radius.h:25
t_radius::rdfalt
double rdfalt
Definition: radius.h:124
radius.h
cdEXIT
#define cdEXIT(FAIL)
Definition: cddefines.h:434
Parser::lgEOL
bool lgEOL(void) const
Definition: parser.h:98
t_rfield::lgTimeVary
bool lgTimeVary[LIMSPC]
Definition: rfield.h:306
t_rfield::range
double range[LIMSPC][2]
Definition: rfield.h:347
parser.h
physconst.h
Parser::m_nqh
long int m_nqh
Definition: parser.h:41
t_rfield::chSpNorm
char chSpNorm[LIMSPC][5]
Definition: rfield.h:351
DEBUG_ENTRY
#define DEBUG_ENTRY(funcname)
Definition: cddefines.h:684