@@ -1078,7 +1078,6 @@ void ReadUnitTemp(CONTROL *control, FILES *files, OPTIONS *options, int iFile) {
10781078
10791079void ReadSystemName (CONTROL * control , FILES * files , OPTIONS * options ,
10801080 SYSTEM * system , int iFile ) {
1081- /* System Name */
10821081 int lTmp = -1 ;
10831082 char cTmp [OPTLEN ];
10841083
@@ -1092,6 +1091,28 @@ void ReadSystemName(CONTROL *control, FILES *files, OPTIONS *options,
10921091 }
10931092}
10941093
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+
10951116void ReadBodyFileNames (BODY * * body , CONTROL * control , FILES * files ,
10961117 OPTIONS * options , char * cFile , char * * * saBodyFiles ,
10971118 int * iNumLines , int * iaLines ) {
@@ -1442,8 +1463,6 @@ void ReadOutputTime(BODY *body, CONTROL *control, FILES *files,
14421463 }
14431464}
14441465
1445- /* Backward integration stop time */
1446-
14471466void ReadStopTime (BODY * body , CONTROL * control , FILES * files , OPTIONS * options ,
14481467 SYSTEM * system , int iFile ) {
14491468 /* This parameter can exist in any file, but only once */
@@ -1470,6 +1489,32 @@ void ReadStopTime(BODY *body, CONTROL *control, FILES *files, OPTIONS *options,
14701489 }
14711490}
14721491
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+
14731518/* Integration timestep */
14741519
14751520void ReadTimeStep (BODY * body , CONTROL * control , FILES * files , OPTIONS * options ,
@@ -2617,7 +2662,7 @@ void fvAllocateOutputArrays(char ****saMatch, char ***saOutput, int **baNeg,
26172662
26182663 for (iIndex = 0 ; iIndex < iNumArgs ; iIndex ++ ) {
26192664 (* saMatch )[iIndex ] =
2620- malloc (MAXARRAY * sizeof (char * )); // Could be this many matches
2665+ malloc (MAXARRAY * sizeof (char * )); // Could be this many matches
26212666 for (iMatch = 0 ; iMatch < MAXARRAY ; iMatch ++ ) {
26222667 (* saMatch )[iIndex ][iMatch ] = NULL ;
26232668 }
@@ -3712,7 +3757,7 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) {
37123757 */
37133758
37143759 fvFormattedString (& options [OPT_AGE ].cName , "dAge" );
3715- fvFormattedString (& options [OPT_AGE ].cDescr , "System Age" );
3760+ fvFormattedString (& options [OPT_AGE ].cDescr , "Body's Age" );
37163761 fvFormattedString (& options [OPT_AGE ].cDefault , "0" );
37173762 fvFormattedString (& options [OPT_AGE ].cNeg , "Gyr" );
37183763 fvFormattedString (& options [OPT_AGE ].cDimension , "time" );
@@ -3724,6 +3769,20 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) {
37243769 options [OPT_AGE ].iFileType = 2 ;
37253770 fnRead [OPT_AGE ] = & ReadAge ;
37263771
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+
37273786 fvFormattedString (& options [OPT_ALBEDOGLOBAL ].cName , "dAlbedoGlobal" );
37283787 fvFormattedString (& options [OPT_ALBEDOGLOBAL ].cDescr ,
37293788 "Globally averaged albedo" );
@@ -3805,6 +3864,20 @@ void InitializeOptionsGeneral(OPTIONS *options, fnReadOption fnRead[]) {
38053864 options [OPT_STOPTIME ].iFileType = 2 ;
38063865 fnRead [OPT_STOPTIME ] = & ReadStopTime ;
38073866
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+
38083881 fvFormattedString (& options [OPT_TIMESTEP ].cName , "dTimeStep" );
38093882 fvFormattedString (& options [OPT_TIMESTEP ].cDescr , "Integration Timestep" );
38103883 fvFormattedString (& options [OPT_TIMESTEP ].cDefault , "1 year" );
0 commit comments