From beb9b371845af7eaf091f1e95ed8d82ee84d4cd9 Mon Sep 17 00:00:00 2001 From: Russell Deitrick <russell.deitrick@gmail.com> Date: Fri, 18 Aug 2023 11:23:18 -0700 Subject: [PATCH 1/5] tmp fix of log issue in flare.c --- src/flare.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flare.c b/src/flare.c index 3fd173922..5e1353c71 100644 --- a/src/flare.c +++ b/src/flare.c @@ -615,7 +615,7 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { fnRead[OPT_FLAREBANDPASS] = &ReadFlareBandPass; sprintf(options[OPT_FLAREBANDPASS].cLongDescr, " If UV or GOES is selected, the code will convert \n" - " the input energy of flares from the UV band \n" + /* " the input energy of flares from the UV band \n" "(3000-4300 Å) or GOES band (1-8 Å) to kepler band \n" "(4000-9000 Å) to calculate the FFD and to the SXR \n" "band (1.24 - 1239.85 Å) to calculate the luminosity.\n" @@ -634,7 +634,7 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { "Gunther et al 2020 (https://doi.org/10.3847/1538-3881/ab5d3a). \n" "If the BOLOMETRIC its selected, the code will convert the input \n" "energy of flares using the convertion values are taken \n" - "from Osten and Wolk (2015) (doi:10.1088/0004-637X/809/1/79).\n"); + "from Osten and Wolk (2015) (doi:10.1088/0004-637X/809/1/79).\n"*/); /* sprintf(options[OPT_FLARESLOPEUNITS].cName, "sFlareSlopeUnits"); sprintf(options[OPT_FLARESLOPEUNITS].cDescr, From ed94e53f59f90fc696208f815ca4b2c91dbf263c Mon Sep 17 00:00:00 2001 From: Russell Deitrick <russell.deitrick@gmail.com> Date: Wed, 14 Feb 2024 17:03:37 -0800 Subject: [PATCH 2/5] fixed distrot so that forced precession rate can be used with read in orbit data --- src/distrot.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/distrot.c b/src/distrot.c index c263d979c..cd42c64cc 100644 --- a/src/distrot.c +++ b/src/distrot.c @@ -422,7 +422,7 @@ void VerifyOrbitData(BODY *body, CONTROL *control, OPTIONS *options, if (fgets(cLine, LINE, fileorb) == NULL) { fprintf(stderr,"ERROR: Unable to read line from orbit data file."); exit(EXIT_INPUT); - } + } GetWords(cLine, cFoo, &iNumColsFound, &bFoo); if (iNumCols != iNumColsFound) { if (control->Io.iVerbose >= VERBERR) { @@ -2110,13 +2110,19 @@ external model @return Derivative dx/dt */ double fndDistRotExtDxDt(BODY *body, SYSTEM *system, int *iaBody) { - double y; + double y, dprec; y = fabs(1.0 - (body[iaBody[0]].dXobl * body[iaBody[0]].dXobl) - (body[iaBody[0]].dYobl * body[iaBody[0]].dYobl)); + if (body[iaBody[0]].bForcePrecRate == 0) { + dprec = fndCentralTorqueR(body, iaBody[0]); + } else { + dprec = body[iaBody[0]].dPrecRate; + } + return fndObliquityAExt(body, system, iaBody) * sqrt(y) + body[iaBody[0]].dYobl * 2. * fndObliquityCExt(body, system, iaBody) - - body[iaBody[0]].dYobl * fndCentralTorqueR(body, iaBody[0]); + body[iaBody[0]].dYobl * dprec; } /** @@ -2128,13 +2134,19 @@ external model @return Derivative dy/dt */ double fndDistRotExtDyDt(BODY *body, SYSTEM *system, int *iaBody) { - double y; + double y, dprec; y = fabs(1.0 - (body[iaBody[0]].dXobl * body[iaBody[0]].dXobl) - (body[iaBody[0]].dYobl * body[iaBody[0]].dYobl)); + if (body[iaBody[0]].bForcePrecRate == 0) { + dprec = fndCentralTorqueR(body, iaBody[0]); + } else { + dprec = body[iaBody[0]].dPrecRate; + } + return -fndObliquityBExt(body, system, iaBody) * sqrt(y) - body[iaBody[0]].dXobl * 2. * fndObliquityCExt(body, system, iaBody) + - body[iaBody[0]].dXobl * fndCentralTorqueR(body, iaBody[0]); + body[iaBody[0]].dXobl * dprec; } /** From 7c4a07fff90b4b606c4951dfb168fa51dc85117e Mon Sep 17 00:00:00 2001 From: Russell Deitrick <rdeitrick@anahim.seos.uvic.ca> Date: Thu, 15 Feb 2024 14:22:58 -0800 Subject: [PATCH 3/5] fixed incorrect allocation of Zobl arrays in distrot for ReadOrbitData case --- src/distrot.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/distrot.c b/src/distrot.c index c263d979c..146fb942d 100644 --- a/src/distrot.c +++ b/src/distrot.c @@ -420,9 +420,9 @@ void VerifyOrbitData(BODY *body, CONTROL *control, OPTIONS *options, } // Check file has exactly 7 columns if (fgets(cLine, LINE, fileorb) == NULL) { - fprintf(stderr,"ERROR: Unable to read line from orbit data file."); + fprintf(stderr, "ERROR: Unable to read line from orbit data file."); exit(EXIT_INPUT); - } + } GetWords(cLine, cFoo, &iNumColsFound, &bFoo); if (iNumCols != iNumColsFound) { if (control->Io.iVerbose >= VERBERR) { @@ -459,10 +459,10 @@ void VerifyOrbitData(BODY *body, CONTROL *control, OPTIONS *options, iLine = 0; while (feof(fileorb) == 0) { - if (fscanf(fileorb, "%lf %lf %lf %lf %lf %lf %lf\n", &dttmp, &datmp, &detmp, - &ditmp, &daptmp, &dlatmp, &dmatmp) != 7) { - fprintf(stderr,"ERROR: Incorrect number of columns in orbit file."); - exit(EXIT_INPUT); + if (fscanf(fileorb, "%lf %lf %lf %lf %lf %lf %lf\n", &dttmp, &datmp, + &detmp, &ditmp, &daptmp, &dlatmp, &dmatmp) != 7) { + fprintf(stderr, "ERROR: Incorrect number of columns in orbit file."); + exit(EXIT_INPUT); } body[iBody].daTimeSeries[iLine] = dttmp * fdUnitsTime(control->Units[iBody + 1].iTime); @@ -907,12 +907,20 @@ void FinalizeUpdateZoblDistRot(BODY *body, UPDATE *update, int *iEqn, int iVar, int iBody, int iFoo) { int iPert; - update[iBody].padDZoblDtDistRot = - malloc((body[iBody].iGravPerts) * sizeof(double *)); - update[iBody].iaZoblDistRot = malloc((body[iBody].iGravPerts) * sizeof(int)); - for (iPert = 0; iPert < body[iBody].iGravPerts; iPert++) { + if (body[iBody].bReadOrbitData) { + update[iBody].padDZoblDtDistRot = malloc(1 * sizeof(double *)); + update[iBody].iaZoblDistRot = malloc(1 * sizeof(int)); update[iBody].iaModule[iVar][*iEqn] = DISTROT; - update[iBody].iaZoblDistRot[iPert] = (*iEqn)++; + update[iBody].iaZoblDistRot[0] = (*iEqn)++; + } else { + update[iBody].padDZoblDtDistRot = + malloc((body[iBody].iGravPerts) * sizeof(double *)); + update[iBody].iaZoblDistRot = + malloc((body[iBody].iGravPerts) * sizeof(int)); + for (iPert = 0; iPert < body[iBody].iGravPerts; iPert++) { + update[iBody].iaModule[iVar][*iEqn] = DISTROT; + update[iBody].iaZoblDistRot[iPert] = (*iEqn)++; + } } } From cb96a5761eb907d154460f734639a21548f003fb Mon Sep 17 00:00:00 2001 From: Russell Deitrick <russell.deitrick@gmail.com> Date: Fri, 1 Mar 2024 14:05:00 -0800 Subject: [PATCH 4/5] fixed conflict with vplanet fork in flare.c, (super annoying but I can't figure out a better way to do this) --- src/flare.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/flare.c b/src/flare.c index 136e05716..c16273ea3 100644 --- a/src/flare.c +++ b/src/flare.c @@ -572,8 +572,9 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { options[OPT_FLAREBANDPASS].bMultiFile = 1; fnRead[OPT_FLAREBANDPASS] = &ReadFlareBandPass; sprintf(options[OPT_FLAREBANDPASS].cLongDescr, - " If UV or GOES is selected, the code will convert \n" - /* " the input energy of flares from the UV band \n" + /* + "If UV or GOES is selected, the code will convert \n" + "the input energy of flares from the UV band \n" "(3000-4300 Å) or GOES band (1-8 Å) to kepler band \n" "(4000-9000 Å) to calculate the FFD and to the SXR \n" "band (1.24 - 1239.85 Å) to calculate the luminosity.\n" @@ -592,7 +593,10 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { "Gunther et al 2020 (https://doi.org/10.3847/1538-3881/ab5d3a). \n" "If the BOLOMETRIC its selected, the code will convert the input \n" "energy of flares using the convertion values are taken \n" - "from Osten and Wolk (2015) (doi:10.1088/0004-637X/809/1/79).\n"*/); + "from Osten and Wolk (2015) (doi:10.1088/0004-637X/809/1/79).\n" + */ + "Currently suppressed due to execution errors." + ); /* sprintf(options[OPT_FLARESLOPEUNITS].cName, "sFlareSlopeUnits"); sprintf(options[OPT_FLARESLOPEUNITS].cDescr, From 69e6ab5a9f2bd3258cec79968a7b97bc844de997 Mon Sep 17 00:00:00 2001 From: Russell Deitrick <russell.deitrick@gmail.com> Date: Fri, 1 Mar 2024 14:06:39 -0800 Subject: [PATCH 5/5] one more try --- src/flare.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/flare.c b/src/flare.c index c16273ea3..50bccbbbf 100644 --- a/src/flare.c +++ b/src/flare.c @@ -575,9 +575,9 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { /* "If UV or GOES is selected, the code will convert \n" "the input energy of flares from the UV band \n" - "(3000-4300 Å) or GOES band (1-8 Å) to kepler band \n" - "(4000-9000 Å) to calculate the FFD and to the SXR \n" - "band (1.24 - 1239.85 Å) to calculate the luminosity.\n" + "(3000-4300A) or GOES band (1-8A) to the Kepler band \n" + "(4000-9000A) to calculate the FFD and the SXR \n" + "band (1.24 - 1239.85A) to calculate the luminosity.\n" " If SXR is selected, the code will convert the \n" "input energy of flares from the SXR band to the Kepler\n" "band to calculate the FFD and will use the same \n" @@ -592,7 +592,7 @@ void InitializeOptionsFlare(OPTIONS *options, fnReadOption fnRead[]) { "to the band U (2000-2800A) to the TESS data from \n" "Gunther et al 2020 (https://doi.org/10.3847/1538-3881/ab5d3a). \n" "If the BOLOMETRIC its selected, the code will convert the input \n" - "energy of flares using the convertion values are taken \n" + "energy of flares using the conversion values are taken \n" "from Osten and Wolk (2015) (doi:10.1088/0004-637X/809/1/79).\n" */ "Currently suppressed due to execution errors."