00001
00002
00003
00004 #include "cddefines.h"
00005 #include "rfield.h"
00006 #include "thermal.h"
00007 #include "input.h"
00008 #include "optimize.h"
00009 #include "phycon.h"
00010 #include "radius.h"
00011 #include "dynamics.h"
00012 #include "parser.h"
00013 #include "atmdat.h"
00014
00015
00016 void ParseCoronal(Parser &p)
00017 {
00018 double a;
00019
00020 DEBUG_ENTRY( "ParseCoronal()" );
00021
00022
00023
00024 if( p.nMatch( "INIT" ) && p.nMatch( "TIME" ) )
00025 {
00026 dynamics.lg_coronal_time_init = true;
00027 if( p.nMatch( "TRAC" ) )
00028 dynamics.lgTracePrint = true;
00029 }
00030
00031
00032 thermal.lgTemperatureConstant = true;
00033 thermal.lgTemperatureConstantCommandParsed = true;
00034
00035
00036
00037
00038
00039
00040 if( !atmdat.lgChiantiLevelsSet )
00041 {
00042 atmdat.nChiantiMaxLevelsFe = atmdat.nChiantiCollLevelsFe;
00043 atmdat.nChiantiMaxLevels = atmdat.nChiantiCollLevels;
00044 }
00045
00046 a = p.FFmtRead();
00047 if( p.lgEOL() )
00048 {
00049 fprintf( ioQQQ, " There should be a temperature on this line.\n" );
00050 cdEXIT(EXIT_FAILURE);
00051 }
00052
00053
00054 if( (a <= 10. && !p.nMatch("LINE")) || p.nMatch(" LOG") )
00055 {
00056 thermal.ConstTemp = (realnum)pow(10.,a);
00057 }
00058 else
00059 {
00060 thermal.ConstTemp = (realnum)a;
00061 }
00062
00063
00064 if( thermal.ConstTemp < phycon.TEMP_LIMIT_LOW )
00065 {
00066 thermal.ConstTemp = (realnum)(1.0001*phycon.TEMP_LIMIT_LOW);
00067 fprintf( ioQQQ, " PROBLEM Te too low, reset to %g K.\n",
00068 thermal.ConstTemp );
00069 }
00070 if( thermal.ConstTemp > phycon.TEMP_LIMIT_HIGH )
00071 {
00072 thermal.ConstTemp = (realnum)(0.9999*phycon.TEMP_LIMIT_HIGH);
00073 fprintf( ioQQQ, " PROBLEM Te too high, reset to %g K.\n",
00074 thermal.ConstTemp );
00075 }
00076
00077
00078 strcpy( rfield.chSpType[rfield.nShape], "LASER" );
00079
00080 rfield.slope[rfield.nShape] = rfield.egamry*0.99;
00081
00082 rfield.cutoff[rfield.nShape][0] = 0.05;
00083
00084
00085 strcpy( rfield.chRSpec[p.m_nqh], "SQCM" );
00086 strcpy( rfield.chSpNorm[p.m_nqh], "IONI" );
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 rfield.totpow[p.m_nqh] = -20.f;
00098
00099 ++rfield.nShape;
00100 if( rfield.nShape >= LIMSPC )
00101 {
00102
00103 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00104 cdEXIT(EXIT_FAILURE);
00105 }
00106 ++p.m_nqh;
00107 if( p.m_nqh >= LIMSPC )
00108 {
00109
00110 fprintf( ioQQQ, " Too many continua entered; increase LIMSPC\n" );
00111 cdEXIT(EXIT_FAILURE);
00112 }
00113
00114
00115
00116
00117 if( !radius.lgRadiusKnown )
00118 {
00119 radius.Radius = pow(10.,radius.rdfalt);
00120 }
00121
00122
00123 if( optimize.lgVarOn )
00124 {
00125
00126 optimize.nvarxt[optimize.nparm] = 1;
00127 strcpy( optimize.chVarFmt[optimize.nparm], "COROnal equilibrium %f LOG" );
00128 if( dynamics.lg_coronal_time_init )
00129 strcat( optimize.chVarFmt[optimize.nparm], " TIME INIT" );
00130
00131
00132 optimize.nvfpnt[optimize.nparm] = input.nRead;
00133
00134
00135 optimize.vparm[0][optimize.nparm] = (realnum)log10(thermal.ConstTemp);
00136 optimize.vincr[optimize.nparm] = 0.1f;
00137 optimize.varang[optimize.nparm][0] = (realnum)log10(1.00001*phycon.TEMP_LIMIT_LOW);
00138 optimize.varang[optimize.nparm][1] = (realnum)log10(0.99999*phycon.TEMP_LIMIT_HIGH);
00139 ++optimize.nparm;
00140 }
00141 return;
00142 }