@@ -1078,7 +1078,6 @@ void ReadUnitTemp(CONTROL *control, FILES *files, OPTIONS *options, int iFile) {
1078
1078
1079
1079
void ReadSystemName (CONTROL * control , FILES * files , OPTIONS * options ,
1080
1080
SYSTEM * system , int iFile ) {
1081
- /* System Name */
1082
1081
int lTmp = -1 ;
1083
1082
char cTmp [OPTLEN ];
1084
1083
@@ -1092,6 +1091,28 @@ void ReadSystemName(CONTROL *control, FILES *files, OPTIONS *options,
1092
1091
}
1093
1092
}
1094
1093
1094
+ void ReadSystemAge (BODY * body , CONTROL * control , FILES * files , OPTIONS * options ,
1095
+ SYSTEM * system , int iFile ) {
1096
+ int lTmp = -1 ;
1097
+ double dTmp ;
1098
+
1099
+ AddOptionDouble (files -> Infile [iFile ].cIn , options -> cName , & dTmp , & lTmp ,
1100
+ control -> Io .iVerbose );
1101
+ if (lTmp >= 0 ) {
1102
+ CheckDuplication (files , options , files -> Infile [iFile ].cIn , lTmp ,
1103
+ control -> Io .iVerbose );
1104
+ if (dTmp < 0 ) {
1105
+ system -> dAge = dTmp * dNegativeDouble (* options , files -> Infile [iFile ].cIn ,
1106
+ control -> Io .iVerbose );
1107
+ } else {
1108
+ system -> dAge = dTmp * fdUnitsTime (control -> Units [iFile ].iTime );
1109
+ }
1110
+ UpdateFoundOption (& files -> Infile [iFile ], options , lTmp , iFile );
1111
+ } else if (iFile > 0 ) {
1112
+ AssignDefaultDouble (options , & system -> dAge , files -> iNumInputs );
1113
+ }
1114
+ }
1115
+
1095
1116
void ReadBodyFileNames (BODY * * body , CONTROL * control , FILES * files ,
1096
1117
OPTIONS * options , char * cFile , char * * * saBodyFiles ,
1097
1118
int * iNumLines , int * iaLines ) {
@@ -1442,8 +1463,6 @@ void ReadOutputTime(BODY *body, CONTROL *control, FILES *files,
1442
1463
}
1443
1464
}
1444
1465
1445
- /* Backward integration stop time */
1446
-
1447
1466
void ReadStopTime (BODY * body , CONTROL * control , FILES * files , OPTIONS * options ,
1448
1467
SYSTEM * system , int iFile ) {
1449
1468
/* This parameter can exist in any file, but only once */
@@ -1470,6 +1489,32 @@ void ReadStopTime(BODY *body, CONTROL *control, FILES *files, OPTIONS *options,
1470
1489
}
1471
1490
}
1472
1491
1492
+ void ReadStopAge (BODY * body , CONTROL * control , FILES * files , OPTIONS * options ,
1493
+ SYSTEM * system , int iFile ) {
1494
+ /* This parameter can exist in any file, but only once */
1495
+ int lTmp = -1 ;
1496
+ double dTmp ;
1497
+
1498
+ AddOptionDouble (files -> Infile [iFile ].cIn , options -> cName , & dTmp , & lTmp ,
1499
+ control -> Io .iVerbose );
1500
+ if (lTmp >= 0 ) {
1501
+ /* Option was found */
1502
+ CheckDuplication (files , options , files -> Infile [iFile ].cIn , lTmp ,
1503
+ control -> Io .iVerbose );
1504
+ if (dTmp < 0 ) {
1505
+ if (control -> Io .iVerbose >= VERBERR ) {
1506
+ fprintf (stderr , "ERROR: %s must be greater than 0.\n" , options -> cName );
1507
+ }
1508
+ LineExit (files -> Infile [iFile ].cIn , lTmp );
1509
+ }
1510
+ /* Convert stop time to cgs */
1511
+ control -> Evolve .dStopAge = dTmp * fdUnitsTime (control -> Units [iFile ].iTime );
1512
+ UpdateFoundOption (& files -> Infile [iFile ], options , lTmp , iFile );
1513
+ } else {
1514
+ AssignDefaultDouble (options , & control -> Evolve .dStopAge , files -> iNumInputs );
1515
+ }
1516
+ }
1517
+
1473
1518
/* Integration timestep */
1474
1519
1475
1520
void ReadTimeStep (BODY * body , CONTROL * control , FILES * files , OPTIONS * options ,
@@ -2617,7 +2662,7 @@ void fvAllocateOutputArrays(char ****saMatch, char ***saOutput, int **baNeg,
2617
2662
2618
2663
for (iIndex = 0 ; iIndex < iNumArgs ; iIndex ++ ) {
2619
2664
(* saMatch )[iIndex ] =
2620
- malloc (MAXARRAY * sizeof (char * )); // Could be this many matches
2665
+ malloc (MAXARRAY * sizeof (char * )); // Could be this many matches
2621
2666
for (iMatch = 0 ; iMatch < MAXARRAY ; iMatch ++ ) {
2622
2667
(* saMatch )[iIndex ][iMatch ] = NULL ;
2623
2668
}
@@ -3712,7 +3757,7 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) {
3712
3757
*/
3713
3758
3714
3759
fvFormattedString (& options [OPT_AGE ].cName , "dAge" );
3715
- fvFormattedString (& options [OPT_AGE ].cDescr , "System Age" );
3760
+ fvFormattedString (& options [OPT_AGE ].cDescr , "Body's Age" );
3716
3761
fvFormattedString (& options [OPT_AGE ].cDefault , "0" );
3717
3762
fvFormattedString (& options [OPT_AGE ].cNeg , "Gyr" );
3718
3763
fvFormattedString (& options [OPT_AGE ].cDimension , "time" );
@@ -3724,6 +3769,20 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) {
3724
3769
options [OPT_AGE ].iFileType = 2 ;
3725
3770
fnRead [OPT_AGE ] = & ReadAge ;
3726
3771
3772
+ int iOpt = OPT_SYSTEMAGE ;
3773
+ fvFormattedString (& options [iOpt ].cName , "dSystemAge" );
3774
+ fvFormattedString (& options [iOpt ].cDescr , "System Age" );
3775
+ fvFormattedString (& options [iOpt ].cDefault , "0" );
3776
+ fvFormattedString (& options [iOpt ].cNeg , "1 Gyr" );
3777
+ fvFormattedString (& options [iOpt ].cDimension , "time" );
3778
+ options [iOpt ].dDefault = 0 ;
3779
+ options [iOpt ].iType = 2 ;
3780
+ options [iOpt ].iModuleBit = 0 ;
3781
+ options [iOpt ].bNeg = 1 ;
3782
+ options [iOpt ].dNeg = 1e9 * YEARSEC ;
3783
+ options [iOpt ].iFileType = 2 ;
3784
+ fnRead [iOpt ] = & ReadSystemAge ;
3785
+
3727
3786
fvFormattedString (& options [OPT_ALBEDOGLOBAL ].cName , "dAlbedoGlobal" );
3728
3787
fvFormattedString (& options [OPT_ALBEDOGLOBAL ].cDescr ,
3729
3788
"Globally averaged albedo" );
@@ -3805,6 +3864,20 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) {
3805
3864
options [OPT_STOPTIME ].iFileType = 2 ;
3806
3865
fnRead [OPT_STOPTIME ] = & ReadStopTime ;
3807
3866
3867
+ iOpt = OPT_STOPAGE ;
3868
+ fvFormattedString (& options [iOpt ].cName , "dStopAge" );
3869
+ fvFormattedString (& options [iOpt ].cDescr , "Age to stop integration" );
3870
+ fvFormattedString (& options [iOpt ].cDefault , "10 Gigayears" );
3871
+ fvFormattedString (& options [iOpt ].cNeg , "Years" );
3872
+ fvFormattedString (& options [iOpt ].cDimension , "time" );
3873
+ options [iOpt ].dDefault = 1e10 * YEARSEC ;
3874
+ options [iOpt ].iType = 2 ;
3875
+ options [iOpt ].iModuleBit = 0 ;
3876
+ options [iOpt ].bNeg = 1 ;
3877
+ options [iOpt ].dNeg = YEARSEC ;
3878
+ options [iOpt ].iFileType = 2 ;
3879
+ fnRead [iOpt ] = & ReadStopAge ;
3880
+
3808
3881
fvFormattedString (& options [OPT_TIMESTEP ].cName , "dTimeStep" );
3809
3882
fvFormattedString (& options [OPT_TIMESTEP ].cDescr , "Integration Timestep" );
3810
3883
fvFormattedString (& options [OPT_TIMESTEP ].cDefault , "1 year" );
0 commit comments