11/*------------ -------------- -------- --- ----- --- -- - -
22 * feenox's transient solver using PETSc routines
33 *
4- * Copyright (C) 2021 Jeremy Theler
4+ * Copyright (C) 2021-2025 Jeremy Theler
55 *
66 * This file is part of FeenoX <https://www.seamplex.com/feenox>.
77 *
2424int feenox_problem_solve_petsc_transient (void ) {
2525
2626#ifdef HAVE_PETSC
27-
2827 if (feenox_var_value (feenox_special_var (in_static ))) {
2928 // if we are in the static step and no initial condition was given, we solve a steady state
3029 if (feenox .pde .initial_condition == NULL ) {
@@ -56,7 +55,7 @@ int feenox_problem_solve_petsc_transient(void) {
5655 } else {
5756 feenox_function_to_phi (feenox .pde .initial_condition , feenox .pde .phi );
5857 }
59-
58+
6059 if (feenox .pde .ts == NULL ) {
6160 petsc_call (TSCreate (PETSC_COMM_WORLD , & feenox .pde .ts ));
6261 petsc_call (TSSetIFunction (feenox .pde .ts , NULL , feenox_ts_residual , NULL ));
@@ -92,16 +91,17 @@ int feenox_problem_solve_petsc_transient(void) {
9291
9392 }
9493
94+ if (feenox .pde .do_not_solve == 0 ) {
95+ PetscInt ts_step = 0 ;
96+ petsc_call (TSGetStepNumber (feenox .pde .ts , & ts_step ));
97+ petsc_call (TSSetMaxSteps (feenox .pde .ts , ts_step + 1 ));
9598
96- PetscInt ts_step = 0 ;
97- petsc_call (TSGetStepNumber (feenox .pde .ts , & ts_step ));
98- petsc_call (TSSetMaxSteps (feenox .pde .ts , ts_step + 1 ));
99-
100- petsc_call (TSSetMaxTime (feenox .pde .ts , feenox_special_var_value (end_time )));
101- petsc_call (TSSetTimeStep (feenox .pde .ts , feenox_special_var_value (dt )));
102- petsc_call (TSSolve (feenox .pde .ts , feenox .pde .phi ));
103- petsc_call (TSGetTime (feenox .pde .ts , feenox_value_ptr (feenox_special_var (t ))));
104- petsc_call (TSGetTimeStep (feenox .pde .ts , feenox_value_ptr (feenox_special_var (dt ))));
99+ petsc_call (TSSetMaxTime (feenox .pde .ts , feenox_special_var_value (end_time )));
100+ petsc_call (TSSetTimeStep (feenox .pde .ts , feenox_special_var_value (dt )));
101+ petsc_call (TSSolve (feenox .pde .ts , feenox .pde .phi ));
102+ petsc_call (TSGetTime (feenox .pde .ts , feenox_value_ptr (feenox_special_var (t ))));
103+ petsc_call (TSGetTimeStep (feenox .pde .ts , feenox_value_ptr (feenox_special_var (dt ))));
104+ }
105105
106106#endif
107107
@@ -117,9 +117,9 @@ int feenox_problem_setup_ts(TS ts) {
117117
118118 if (feenox .pde .ts_type != NULL ) {
119119 petsc_call (TSSetType (ts , feenox .pde .ts_type ));
120- } else if (feenox .pde .transient_type == transient_type_quasistatic ) {
121- // TODO: the default depends on the physics type
122- petsc_call (TSSetType (ts , TSBEULER ));
120+ // } else if (feenox.pde.transient_type == transient_type_quasistatic) {
121+ // // TODO: the default depends on the physics type
122+ // petsc_call(TSSetType(ts, TSBEULER));
123123 } else {
124124 // TODO: the default depends on the physics type
125125 petsc_call (TSSetType (ts , TSBDF ));
0 commit comments