Skip to content

Conversation

@JHopeCollins
Copy link
Member

No description provided.

@tommbendall tommbendall added enhancement Involves adding a new capability design discussion Issues relating to some code design. May be better as a discussion tidying Involves tidying up code and removed design discussion Issues relating to some code design. May be better as a discussion labels Aug 8, 2025
Copy link
Contributor

@tommbendall tommbendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main thoughts:

  • we need comments in solver_presets.py to explain what the dictionaries are doing
  • I would ideally prefer the if statements in the HybridisedSolverParameters to not depend on the type of equation_set. I think we want to group them into (a) two variables, (b) equations with tracers in which we ignore some variables, (c) equations with elimination of thermodynamic variable (either with 3D transport or vertical transport). Maybe this is better done as a follow-up task?

atb1995 and others added 4 commits December 18, 2025 09:51
self.W = equations.function_space
self.W_hyb = MixedFunctionSpace((self.Vu_broken, self.Vrho, self.Vtrace))

# Define
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need more detail here? define what?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

def update(self, pc):
PETSc.Sys.Print("[PC.update] Updating hybridized PC")

if hasattr(self, "rho_avg_solver"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would it not have a rho_avg_solver?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the current hack - update is called before init the first time, so we need to make sure the solvers have been set up


self.alpha = appctx.get('alpha')
tau_values = appctx.get('tau_values')
self.tau_values = tau_values if tau_values is not None else {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the right default for the tau values? how does this interact with alpha?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - above the dttau is selected based on whether tau is defined, if not it takes dtalpha

"""
This module provides PETSc dictionaries for nonlinear and linear problems.
The solvers provided here are used for solving linear problems on mixed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I"m a little bit confused by these two sentences - the first mentions nonlinear and linear problems but the second just says this is for linear problems...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was future proofing for nonlinear solvers in the future, but have left as linear for now

# BCs, Forcing and Linear Solver ---------------------------------------
self.bcs = equation_set.bcs
self.forcing = Forcing(equation_set, self.implicit_terms, self.alpha)
if linear_solver is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to keep this argument

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

passed in. Defaults to False.
reference_dependent: this indicates that the solver Jacobian should
be rebuilt if the reference profiles have been updated.
appctx: appctx for the underlying :class:`LinearVariationalSolver`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more doc changes required above to remove obsolete arguments and put docs in same order as args

self.equation.update_reference_profiles()
self.solver.invalidate_jacobian()

# TODO: Issue X is to address this reference profile update bug (pythonPC update not called)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have an issue number?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#686, added!

for field_name in field_names:

if field_name not in prognostic_names:
logger.debug(f'Semi-Implicit Quasi Newton: Zeroing xrhs for {field_name}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this debug or info?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to info

atb1995 and others added 6 commits December 19, 2025 14:54
Co-authored-by: Dr Jemma Shipton <j.shipton@exeter.ac.uk>
Co-authored-by: Dr Jemma Shipton <j.shipton@exeter.ac.uk>
Co-authored-by: Dr Jemma Shipton <j.shipton@exeter.ac.uk>
Co-authored-by: Dr Jemma Shipton <j.shipton@exeter.ac.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Involves adding a new capability tidying Involves tidying up code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants