@@ -53,8 +53,8 @@ int feenox_problem_solve_petsc_transient(void) {
5353 }
5454
5555 // THINK! whats is going on here?
56- // feenox_check_alloc(feenox.pde.J_ts = feenox_problem_create_matrix("J_ts"));
57- petsc_call (MatDuplicate (feenox .pde .has_jacobian_K ? feenox .pde .JK : feenox .pde .K , MAT_COPY_VALUES , & feenox .pde .J_ts ));
56+ feenox_check_alloc (feenox .pde .J_ts = feenox_problem_create_matrix ("J_ts" ));
57+ // petsc_call(MatDuplicate(feenox.pde.has_jacobian_K ? feenox.pde.JK : feenox.pde.K, MAT_COPY_VALUES, &feenox.pde.J_ts));
5858 petsc_call (TSSetIJacobian (feenox .pde .ts , feenox .pde .J_ts , feenox .pde .J_ts , feenox_ts_jacobian , NULL ));
5959
6060 petsc_call (TSSetProblemType (feenox .pde .ts , (feenox .pde .math_type == math_type_linear ) ? TS_LINEAR : TS_NONLINEAR ));
@@ -122,6 +122,13 @@ int feenox_problem_setup_ts(TS ts) {
122122// petsc_call(TSSetMaxStepRejections(feenox.pde.ts, 10000));
123123// petsc_call(TSSetMaxSNESFailures(feenox.pde.ts, 1000));
124124
125+ // PETSc 3.19 is buggy and needs this guys here
126+ // the problem is that calling TSSetFromOptions here sets the line search to bt
127+ // and we want to default to basic
128+ if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR == 19 ) {
129+ petsc_call (TSSetFromOptions (ts ));
130+ }
131+
125132 SNES snes ;
126133 petsc_call (TSGetSNES (ts , & snes ));
127134 if (snes != NULL ) {
@@ -193,6 +200,7 @@ PetscErrorCode feenox_ts_residual(TS ts, PetscReal t, Vec phi, Vec phi_dot, Vec
193200 // set dirichlet bcs on the residual
194201 feenox_call (feenox_problem_dirichlet_set_r (r , phi ));
195202
203+
196204 return FEENOX_OK ;
197205}
198206
0 commit comments