2 solvers with different parameters
Dear,
I am solving a heat advection-diffusion equation coupled to Stokes equations with a temperature dependent viscosity. Currently I am first solving Stokes, updating velocity and pressure, then the heat advection-diffusion equation. I continue iterating until I reach some tolerance. This works fine when I'm using a direct solver. I'm having some trouble with the iterative solvers though. For the Stokes system I am using command line petsc commands. For example, on the command line I use:
python testcase.py --petsc.ksp_type bcgs --petsc.pc_type hypre
(I know FEniCS has bicgstab and hypre_amg available, but this is just for example). In my testcase.py file I get these commands and make my Stokes solver and solve:
parameters.parse()
solver_Stokes = PETScKrylovSolver()
A, bb = assemble_system(a, L, bcs)
P, btmp = assemble_system(b, L, bcs)
solver_
solver_
This all works. My problem now is that I want a different solver for my heat advection-diffusion equation. What I do is:
solver_heat = PETScKrylovSolv
At, bt = assemble_system(at, Lt, bcst)
solver_
What happens is that the heat advection-diffusion equation is being solved by the --petsc.ksp_type bcgs --petsc.pc_type hypre commands instead of by gmres and ilu. I'm assuming this is because bcgs and hypre are now parameters also of solver_heat and that gmres and ilu did not overwrite this. Is there a way to fix this so that I can use command-line PETSc commands for the Stokes solver and a different set of Krylov solver/
Thanks!
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Sander Rhebergen for more information if necessary.