Repository navigation
Demo Helmholtz CSLP - #5769
Demo Helmholtz CSLP#5769KarsKnook wants to merge 5 commits into
Conversation
|
|
||
| eps = 1 | ||
|
|
||
| class CSLP(AuxiliaryOperatorPC): |
There was a problem hiding this comment.
Why not aP = a - (1j*eps) * inner(u, v)*dx?
There was a problem hiding this comment.
/scratch/knook/release_complex/venv-firedrake/lib/python3.12/site-packages/petsctools/init.py:70: UserWarning: The PETSc version (3.25.5) does not match the petsc4py version (3.25.0), this may cause unexpected behaviour
warnings.warn(
Traceback (most recent call last):
File "petsc4py/PETSc/petscksp.pxi", line 311, in petsc4py.PETSc.KSP_ComputeOps
File "/scratch/knook/release_complex/venv-firedrake/lib/python3.12/site-packages/firedrake/solving_utils.py", line 547, in compute_operators
assert P.handle == ctx._pjac.petscmat.handle
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/knook/Documents/firedrake_demos/test.py", line 95, in <module>
LVS.solve()
File "petsc4py/PETSc/Log.pyx", line 250, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "petsc4py/PETSc/Log.pyx", line 251, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
File "/scratch/knook/release_complex/venv-firedrake/lib/python3.12/site-packages/firedrake/adjoint_utils/variational_solver.py", line 108, in wrapper
out = solve(self, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/scratch/knook/release_complex/venv-firedrake/lib/python3.12/site-packages/firedrake/variational_solver.py", line 398, in solve
self.snes.solve(None, work)
File "petsc4py/PETSc/SNES.pyx", line 1740, in petsc4py.PETSc.SNES.solve
petsc4py.PETSc.Error: error code 101
[0] SNESSolve() at /scratch/knook/release_complex/petsc/src/snes/interface/snes.c:4951
[0] SNESSolve_KSPONLY() at /scratch/knook/release_complex/petsc/src/snes/impls/ksponly/ksponly.c:49
[0] KSPSolve() at /scratch/knook/release_complex/petsc/src/ksp/ksp/interface/itfunc.c:1094
[0] KSPSolve_Private() at /scratch/knook/release_complex/petsc/src/ksp/ksp/interface/itfunc.c:841
[0] KSPSetUp() at /scratch/knook/release_complex/petsc/src/ksp/ksp/interface/itfunc.c:428
[0] PCSetUp() at /scratch/knook/release_complex/petsc/src/ksp/pc/interface/precon.c:1120
[0] PCSetUp_MG() at /scratch/knook/release_complex/petsc/src/ksp/pc/impls/mg/mg.c:1167
[0] KSPSetUp() at /scratch/knook/release_complex/petsc/src/ksp/ksp/interface/itfunc.c:378
There was a problem hiding this comment.
Oh, weird. I thought we fixed this. Is this the latest release?
There was a problem hiding this comment.
No, I think the firedrake install is from 2-3 months back. I will install a new complex developer release Firedrake and try again
I have pushed an untested commit that does this. I am hoping you can continue development but if you encounter issues let me know. |
| "pc_type": "python", | ||
| "pc_python_type": f"{__name__}.CSLP", | ||
| "aux_pc_type": "mg", | ||
| "aux_mg_coarse": sp_smoother, |
There was a problem hiding this comment.
Why not use a direct solver here?
There was a problem hiding this comment.
Could be done, but it's not what's done in the paper we cite or the paper Colin, Josh and I wrote
There was a problem hiding this comment.
In that case we can delete this option and explain that mg_levels also sets mg_coarse
| .. image:: helmholtz_cslp.png | ||
| :width: 50% | ||
|
|
||
| The solver converges in 26 preconditioned FGMRES iterations. The benefit of the complex-shifted Laplacian preconditioner |
There was a problem hiding this comment.
Should we add a table with the iteration counts for different values of k or eps to illustrate the point you are trying to make?
There was a problem hiding this comment.
I think the problems get big relatively quickly due to mesh refinements agains the pollution effect
There was a problem hiding this comment.
But you may keep k fixed and choose a few values of eps
There was a problem hiding this comment.
You will not necessarily see the nonrobustness because CSLP becomes worse but GMG better
| @@ -0,0 +1,126 @@ | |||
| Complex-shifted Laplacian preconditioning for the Helmholtz equation | |||
There was a problem hiding this comment.
Could the file be renamed to complex_shifted_helmoltz.py?
|
|
||
| eps = k | ||
|
|
||
| class CSLP(AuxiliaryOperatorPC): |
There was a problem hiding this comment.
Could this have a name like ShiftedOperatorPC?
Demo Helmholtz CSLP
Demo for complex-shifted Laplacian preconditioning for the Helmholtz equation. I believe this is the first demo for complex Firedrake.
@connorjward how do we set it as a test for complex firedrake and not the normal test suite?
Disclaimer
GPT-6.1 Terra was used to create this demo