Skip to content

Commit

Permalink
Change solver options in notebooks
Browse files Browse the repository at this point in the history
Possible bug in PETSc line search is making this fail with the PETSc
trust region and line search solvers, fall back to our own own
hand-rolled solver in the ice stream XZ, checkpointing, and adaptivity
notebooks
  • Loading branch information
danshapero committed Apr 22, 2024
1 parent 91baf10 commit e2ad18a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
9 changes: 3 additions & 6 deletions notebooks/how-to/02-checkpointing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,9 @@
"opts = {\n",
" \"dirichlet_ids\": [1],\n",
" \"side_wall_ids\": [3, 4],\n",
" \"diagnostic_solver_type\": \"petsc\",\n",
" \"diagnostic_solver_type\": \"icepack\",\n",
" \"diagnostic_solver_parameters\": {\n",
" \"snes_type\": \"newtontr\",\n",
" \"ksp_type\": \"preonly\",\n",
" \"pc_type\": \"lu\",\n",
" \"pc_factor_mat_solver_type\": \"mumps\",\n",
" \"tolerance\": 1e-8,\n",
" },\n",
" \"prognostic_solver_parameters\": {\n",
" \"ksp_type\": \"gmres\",\n",
Expand Down Expand Up @@ -499,7 +496,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
22 changes: 5 additions & 17 deletions notebooks/how-to/03-adaptivity.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -648,14 +648,8 @@
"opts = {\n",
" \"dirichlet_ids\": [4],\n",
" \"side_wall_ids\": [1, 3],\n",
" \"diagnostic_solver_type\": \"petsc\",\n",
" \"diagnostic_solver_parameters\": {\n",
" \"snes_type\": \"newtontr\",\n",
" \"snes_max_it\": 100,\n",
" \"ksp_type\": \"preonly\",\n",
" \"pc_type\": \"lu\",\n",
" \"pc_factor_mat_solver_type\": \"mumps\",\n",
" },\n",
" \"diagnostic_solver_type\": \"icepack\",\n",
" \"diagnostic_solver_parameters\": {\"tolerance\": 1e-8},\n",
"}\n",
"solver = icepack.solvers.FlowSolver(model, **opts)\n",
"u_0 = solver.diagnostic_solve(\n",
Expand Down Expand Up @@ -710,14 +704,8 @@
"opts = {\n",
" \"dirichlet_ids\": [4],\n",
" \"side_wall_ids\": [1, 3],\n",
" \"diagnostic_solver_type\": \"petsc\",\n",
" \"diagnostic_solver_parameters\": {\n",
" \"snes_type\": \"newtontr\",\n",
" \"snes_max_it\": 100,\n",
" \"ksp_type\": \"preonly\",\n",
" \"pc_type\": \"lu\",\n",
" \"pc_factor_mat_solver_type\": \"mumps\",\n",
" },\n",
" \"diagnostic_solver_type\": \"icepack\",\n",
" \"diagnostic_solver_parameters\": {\"tolerance\": 1e-8},\n",
"}\n",
"solver = icepack.solvers.FlowSolver(model, **opts)\n",
"u_0 = solver.diagnostic_solve(\n",
Expand Down Expand Up @@ -847,7 +835,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
10 changes: 3 additions & 7 deletions notebooks/tutorials/06-hybrid-ice-stream-xz.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@
"outputs": [],
"source": [
"model = icepack.models.HybridModel(friction=friction)\n",
"opts = {\n",
" \"dirichlet_ids\": [1],\n",
" \"diagnostic_solver_type\": \"petsc\",\n",
" \"diagnostic_solver_parameters\": {\"snes_type\": \"newtontr\"},\n",
"}\n",
"opts = {\"dirichlet_ids\": [1], \"diagnostic_solver_type\": \"icepack\"}\n",
"solver = icepack.solvers.FlowSolver(model, **opts)\n",
"\n",
"u0 = solver.diagnostic_solve(\n",
Expand Down Expand Up @@ -607,9 +603,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit e2ad18a

Please sign in to comment.