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