Skip to content

Commit

Permalink
Merge pull request #139 from eslickj/main
Browse files Browse the repository at this point in the history
Fix TS solver status reporting
  • Loading branch information
John Eslick authored Jan 15, 2022
2 parents 2868788 + d20b9a2 commit e57b07d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions petsc/fg_dae.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ int get_ts_sol_message(char *msg, TSConvergedReason term_reason, ASL *asl){
strcpy(msg, "TS_CONVERGED_ITS");
solve_result_num = 400;}
else if(term_reason==TS_CONVERGED_ITERATING){ //means it's still running
strcpy(msg, "TS_CONVERGED_ITERATING");
solve_result_num = 400;}
strcpy(msg, "TS_CONVERGED_ITERATING");
solve_result_num = 400;}
else if(term_reason==TS_DIVERGED_NONLINEAR_SOLVE){
strcpy(msg, "TS_DIVERGED_NONLINEAR_SOLVE");
solve_result_num = 300;}
Expand Down
3 changes: 1 addition & 2 deletions petsc/petsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ int main(int argc, char **argv){
// Solve
ierr = TSSolve(ts, x);
ierr = TSGetTime(ts, &t);
ierr = SNESGetConvergedReason(snes, &cr); CHKERRQ(ierr);
ierr = TSGetConvergedReason(ts, &tscr); CHKERRQ(ierr);
/* Get the results */
x_asl = (real*)malloc((n_var)*sizeof(real));
Expand All @@ -267,7 +266,7 @@ int main(int argc, char **argv){
ierr = VecRestoreArray(x,&xx);CHKERRQ(ierr);
if(sol_ctx.explicit_time) x_asl[sol_ctx.dae_map_t] = t;
/* write the AMPL solution file */
get_ts_sol_message(msg, cr, sol_ctx.asl);
get_ts_sol_message(msg, tscr, sol_ctx.asl);
PetscPrintf(PETSC_COMM_SELF, "TSConvergedReason = %s\n", msg);
write_sol(msg, x_asl, NULL, NULL); // write ASL sol file
ierr = TSDestroy(&ts);
Expand Down

0 comments on commit e57b07d

Please sign in to comment.