Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8d2860d
Create branch
JHopeCollins Aug 7, 2025
bc55637
New moist solver for 5 variables works
atb1995 Aug 7, 2025
f1d8126
Temprary save - working toward aP
atb1995 Aug 7, 2025
99ca85b
remove aP from ConvectiveSWESolver
JHopeCollins Aug 8, 2025
9cfe8b1
update linearisation map and default solver
tommbendall Aug 8, 2025
807c7c0
Saving progress before merge in of linearisation map
atb1995 Aug 8, 2025
5e51f2c
Merge remote-tracking branch 'origin/TBendall/SolverEqns' into auxili…
atb1995 Aug 8, 2025
e508449
PC for calculating a schur complement using slate
JHopeCollins Aug 8, 2025
593f7ba
remove MoistConvectiveSWSolver
JHopeCollins Aug 8, 2025
32ce053
Revert "Merge remote-tracking branch 'origin/TBendall/SolverEqns' int…
atb1995 Aug 8, 2025
6ae2e4b
Monolithic solver for hard coded linear thermal eqns added
atb1995 Aug 8, 2025
55f7cc0
added monolithic solver for thermal shallow water eqns
atb1995 Aug 8, 2025
1f636e4
Remove declaration..
atb1995 Aug 8, 2025
a326eda
refactor monolithic thermal swe linear solver
JHopeCollins Aug 14, 2025
f036239
Merge branch 'main' into auxiliary-equation-pc
JHopeCollins Sep 12, 2025
fd6c755
expunge shallow water linear solvers
JHopeCollins Sep 12, 2025
86da3dc
boussinesq schur complement?
JHopeCollins Sep 12, 2025
caf2b02
Merge to main
atb1995 Nov 19, 2025
bbcfe93
Solver set up for compressible euler - still requires testing
atb1995 Nov 20, 2025
177c06f
Minor changes
atb1995 Nov 21, 2025
44d0037
Solver changes
atb1995 Nov 25, 2025
6a2e8e8
Fixing of avg terms
atb1995 Nov 25, 2025
766cd25
First stab at custom PC for gusto solver, almost guaranteed to fail..
atb1995 Nov 25, 2025
1ef983a
Code runs! But the solver is unstable...
atb1995 Nov 25, 2025
017a875
New linear preconditioner appears to be working!
atb1995 Dec 1, 2025
adf3b3a
all still works - reference profile is properly updated + dy is only …
atb1995 Dec 2, 2025
07ce4e8
Large tidy up and connecting of solver options. Still to do: incompre…
atb1995 Dec 3, 2025
79d531f
Update gusto/solvers/preconditioners.py
atb1995 Dec 4, 2025
c858fa2
Update gusto/solvers/preconditioners.py
atb1995 Dec 4, 2025
02b9648
Update gusto/solvers/preconditioners.py
atb1995 Dec 4, 2025
e352c4a
Update gusto/solvers/preconditioners.py
atb1995 Dec 4, 2025
39be608
Update gusto/solvers/solver_presets.py
atb1995 Dec 4, 2025
665c0f6
Update gusto/solvers/preconditioners.py
atb1995 Dec 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions examples/boussinesq/skamarock_klemp_compressible.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from gusto import (
Domain, IO, OutputParameters, SemiImplicitQuasiNewton, SSPRK3, DGUpwind,
TrapeziumRule, SUPGOptions, Divergence, Perturbation, CourantNumber,
BoussinesqParameters, BoussinesqEquations, BoussinesqSolver,
BoussinesqParameters, BoussinesqEquations, BoussinesqSolver, LinearTimesteppingSolver,
boussinesq_hydrostatic_balance
)

Expand Down Expand Up @@ -91,7 +91,21 @@ def skamarock_klemp_compressible_bouss(
]

# Linear solver
linear_solver = BoussinesqSolver(eqns)
solver_parameters = HybridisedSolverParameters(eqns.name)
def trace_nullsp(T):
return VectorSpaceBasis(constant=True)


appctx = {
'auxform': eqns.schur_complement_form(alpha=0.5),
"trace_nullspace": trace_nullsp,
}

linear_solver = SIQNLinearSolver(
eqns, solver_prognostics=["u", "p", "b"], alpha=0.5, implicit_terms=[incompressible, sponge],
solver_parameters=solver_parameters,
appctx=appctx
)

# Time stepper
stepper = SemiImplicitQuasiNewton(
Expand Down
26 changes: 24 additions & 2 deletions examples/boussinesq/skamarock_klemp_incompressible.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
Domain, IO, OutputParameters, SemiImplicitQuasiNewton, SSPRK3, DGUpwind,
TrapeziumRule, SUPGOptions, Divergence, Perturbation, CourantNumber,
BoussinesqParameters, BoussinesqEquations, BoussinesqSolver,
boussinesq_hydrostatic_balance
boussinesq_hydrostatic_balance, incompressible, sponge, SIQNLinearSolver,
HybridisedSolverParameters, LinearTimesteppingSolver
)

skamarock_klemp_incompressible_bouss_defaults = {
Expand Down Expand Up @@ -88,7 +89,28 @@ def skamarock_klemp_incompressible_bouss(
]

# Linear solver
linear_solver = BoussinesqSolver(eqns)
solver_parameters = HybridisedSolverParameters(eqns.name)
def trace_nullsp(T):
return VectorSpaceBasis(constant=True)


appctx = {
'auxform': eqns.schur_complement_form(alpha=0.5),
"trace_nullspace": trace_nullsp,
}

linear_solver = SIQNLinearSolver(
eqns, solver_prognostics=["u", "p", "b"], alpha=0.5, implicit_terms=[incompressible, sponge],
solver_parameters=solver_parameters,
appctx=appctx
)
linear_solver = LinearTimesteppingSolver(eqns, alpha=0.5, options_prefix="boussinesq",
solver_parameters=solver_parameters,
appctx=appctx
)

#linear_solver = BoussinesqSolver(eqns)


# Time stepper
stepper = SemiImplicitQuasiNewton(
Expand Down
27 changes: 21 additions & 6 deletions examples/compressible_euler/dcmip_3_1_gravity_wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
from gusto import (
Domain, IO, OutputParameters, SemiImplicitQuasiNewton, SSPRK3, DGUpwind,
TrapeziumRule, SUPGOptions, lonlatr_from_xyz, CompressibleParameters,
CompressibleEulerEquations, CompressibleSolver, ZonalComponent,
CompressibleEulerEquations, ZonalComponent,
compressible_hydrostatic_balance, Perturbation, GeneralCubedSphereMesh,
SubcyclingOptions
SubcyclingOptions, HybridisedSolverParameters, SIQNLinearSolver, incompressible, sponge
)

dcmip_3_1_gravity_wave_defaults = {
Expand Down Expand Up @@ -105,13 +105,28 @@ def dcmip_3_1_gravity_wave(
DGUpwind(eqns, field) for field in ["u", "rho", "theta"]
]

# Linear solver
linear_solver = CompressibleSolver(eqns)
# # Linear solver
# solver_parameters = HybridisedSolverParameters(eqns.name)

# def trace_nullsp(T):
# return VectorSpaceBasis(constant=True)


# appctx = {
# 'equations': eqns,
# 'alpha': 0.5,
# 'trace_nullspace': trace_nullsp
# }

# linear_solver = SIQNLinearSolver(
# eqns, solver_prognostics=["u", "rho", "theta"], alpha=0.5, implicit_terms=[incompressible, sponge],
# solver_parameters=solver_parameters,
# appctx=appctx, enforce_pc_on_rhs=True
# )

# Time stepper
stepper = SemiImplicitQuasiNewton(
eqns, io, transported_fields, transport_methods,
linear_solver=linear_solver
eqns, io, transported_fields, transport_methods
)

# ------------------------------------------------------------------------ #
Expand Down
11 changes: 4 additions & 7 deletions examples/compressible_euler/dry_bryan_fritsch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from gusto import (
Domain, IO, OutputParameters, SemiImplicitQuasiNewton, SSPRK3, DGUpwind,
RecoverySpaces, BoundaryMethod, Perturbation, CompressibleParameters,
CompressibleEulerEquations, CompressibleSolver,
compressible_hydrostatic_balance
CompressibleEulerEquations,
compressible_hydrostatic_balance, HybridisedSolverParameters, SIQNLinearSolver,
incompressible, sponge
)

dry_bryan_fritsch_defaults = {
Expand Down Expand Up @@ -102,13 +103,9 @@ def dry_bryan_fritsch(
DGUpwind(eqns, field) for field in ["u", "rho", "theta"]
]

# Linear solver
linear_solver = CompressibleSolver(eqns)

# Time stepper
stepper = SemiImplicitQuasiNewton(
eqns, io, transported_fields, transport_methods,
linear_solver=linear_solver
eqns, io, transported_fields, transport_methods
)

# ------------------------------------------------------------------------ #
Expand Down
13 changes: 5 additions & 8 deletions examples/compressible_euler/schaer_mountain.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
OutputParameters, IO, SSPRK3, DGUpwind, SemiImplicitQuasiNewton,
compressible_hydrostatic_balance, SpongeLayerParameters, Exner, ZComponent,
Perturbation, SUPGOptions, TrapeziumRule, MaxKernel, MinKernel,
CompressibleEulerEquations, SubcyclingOptions, RungeKuttaFormulation
CompressibleEulerEquations, SubcyclingOptions, RungeKuttaFormulation,
HybridisedSolverParameters, SIQNLinearSolver, incompressible, sponge
)

schaer_mountain_defaults = {
Expand Down Expand Up @@ -97,11 +98,11 @@ def schaer_mountain(

# Equation
parameters = CompressibleParameters(mesh, g=g, cp=cp)
sponge = SpongeLayerParameters(
sponge_params = SpongeLayerParameters(
mesh, H=domain_height, z_level=domain_height-sponge_depth, mubar=mu_dt/dt
)
eqns = CompressibleEulerEquations(
domain, parameters, sponge_options=sponge, u_transport_option=u_eqn_type
domain, parameters, sponge_options=sponge_params, u_transport_option=u_eqn_type
)

# I/O
Expand Down Expand Up @@ -134,14 +135,10 @@ def schaer_mountain(
DGUpwind(eqns, "theta", ibp=theta_opts.ibp)
]

# Linear solver
tau_values = {'rho': 1.0, 'theta': 1.0}
linear_solver = CompressibleSolver(eqns, alpha, tau_values=tau_values)

# Time stepper
stepper = SemiImplicitQuasiNewton(
eqns, io, transported_fields, transport_methods,
linear_solver=linear_solver, alpha=alpha, spinup_steps=spinup_steps
alpha=alpha, spinup_steps=spinup_steps
)

# ------------------------------------------------------------------------ #
Expand Down
46 changes: 25 additions & 21 deletions examples/compressible_euler/skamarock_klemp_nonhydrostatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
"""
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter

from petsc4py import PETSc
PETSc.Sys.popErrorHandler()
import itertools
from firedrake import (
as_vector, SpatialCoordinate, PeriodicIntervalMesh, ExtrudedMesh, exp, sin,
Function, pi, COMM_WORLD, sqrt
PETSc, Function, pi, COMM_WORLD, sqrt
)
import numpy as np
from gusto import (
Domain, IO, OutputParameters, TRBDF2QuasiNewton, SemiImplicitQuasiNewton, SSPRK3,
DGUpwind, logger, SUPGOptions, Perturbation, CompressibleParameters,
CompressibleEulerEquations, HydrostaticCompressibleEulerEquations,
compressible_hydrostatic_balance, RungeKuttaFormulation, CompressibleSolver,
hydrostatic_parameters, SubcyclingOptions,
compressible_hydrostatic_balance, RungeKuttaFormulation,
SubcyclingOptions, incompressible, sponge, SIQNLinearSolver,
HybridisedSolverParameters
)
PETSc.Sys.popErrorHandler()

skamarock_klemp_nonhydrostatic_defaults = {
'ncolumns': 150,
Expand Down Expand Up @@ -138,24 +138,29 @@ def skamarock_klemp_nonhydrostatic(
DGUpwind(eqns, "theta", ibp=theta_opts.ibp)
]

# Linear solver
if hydrostatic:
if timestepper == 'TR-BDF2':
# Time stepper and linear solver
if timestepper == 'TR-BDF2':
if hydrostatic:
raise ValueError('Hydrostatic equations not implmented for TR-BDF2')
gamma = (1-sqrt(2)/2)
gamma2 = (1 - 2*float(gamma))/(2 - 2*float(gamma))


linear_solver = CompressibleSolver(
eqns, solver_parameters=hydrostatic_parameters,
overwrite_solver_parameters=True
# Linear solver
solver_parameters_tr, appctx_tr = HybridisedSolverParameters(eqns, alpha=gamma)
solver_parameters_bdf, appctx_bdf = HybridisedSolverParameters(eqns, alpha=gamma2)

tr_solver = SIQNLinearSolver(
eqns, solver_prognostics=["u", "rho", "theta"], alpha=gamma, implicit_terms=[incompressible, sponge],
solver_parameters=solver_parameters_tr,
appctx=appctx_tr, enforce_pc_on_rhs=True
)
bdf_solver = SIQNLinearSolver(
eqns, solver_prognostics=["u", "rho", "theta"], alpha=gamma2, implicit_terms=[incompressible, sponge],
solver_parameters=solver_parameters_bdf,
appctx=appctx_bdf, enforce_pc_on_rhs=True
)
else:
linear_solver = CompressibleSolver(eqns)

# Time stepper
if timestepper == 'TR-BDF2':
gamma = (1-sqrt(2)/2)
gamma2 = (1 - 2*float(gamma))/(2 - 2*float(gamma))
tr_solver = CompressibleSolver(eqns, alpha=gamma)
bdf_solver = CompressibleSolver(eqns, alpha=gamma2)
stepper = TRBDF2QuasiNewton(
eqns, io, transported_fields, transport_methods,
gamma=gamma,
Expand All @@ -165,8 +170,7 @@ def skamarock_klemp_nonhydrostatic(

elif timestepper == 'SIQN':
stepper = SemiImplicitQuasiNewton(
eqns, io, transported_fields, transport_methods,
linear_solver=linear_solver
eqns, io, transported_fields, transport_methods
)
# ------------------------------------------------------------------------ #
# Initial conditions
Expand Down
Loading