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