Skip to content

Commit

Permalink
Merge pull request OpenFAST#26 from jrood-nrel/jrood/fix-fpe
Browse files Browse the repository at this point in the history
Check if restart frequency is > 0 to avoid dividing by 0
  • Loading branch information
gantech authored Sep 20, 2023
2 parents 984b0e8 + 66c3d16 commit c2aea80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion glue-codes/openfast-cpp/src/OpenFAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ void fast::OpenFAST::advance_to_next_driver_time_step(bool writeFiles) {
if (writeFiles) {
for (int iTurb=0; iTurb < nTurbinesProc; iTurb++) {
int tStepRatio = dtDriver/dtFAST;
if ( (((nt_global - ntStart) % (restartFreq_*tStepRatio)) == 0 ) && (nt_global != ntStart) ) {
if ( (restartFreq_*tStepRatio > 0) && (((nt_global - ntStart) % (restartFreq_*tStepRatio)) == 0 ) && (nt_global != ntStart) ) {
turbineData[iTurb].FASTRestartFileName = " "; // if blank, it will use FAST convention <RootName>.nt_global
FAST_CreateCheckpoint(&iTurb, turbineData[iTurb].FASTRestartFileName.data(), &ErrStat, ErrMsg);
checkError(ErrStat, ErrMsg);
Expand Down

0 comments on commit c2aea80

Please sign in to comment.