Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coriolis linear solver #539

Merged
merged 6 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
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
22 changes: 19 additions & 3 deletions gusto/solvers/linear_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
split, LinearVariationalProblem, Constant, LinearVariationalSolver,
TestFunctions, TrialFunctions, TestFunction, TrialFunction, lhs,
rhs, FacetNormal, div, dx, jump, avg, dS, dS_v, dS_h, ds_v, ds_t, ds_b,
ds_tb, inner, action, dot, grad, Function, VectorSpaceBasis,
BrokenElement, FunctionSpace, MixedFunctionSpace, DirichletBC
ds_tb, inner, action, dot, grad, Function, VectorSpaceBasis, cross,
BrokenElement, FunctionSpace, MixedFunctionSpace, DirichletBC, as_vector
)
from firedrake.fml import Term, drop
from firedrake.petsc import flatten_parameters
Expand Down Expand Up @@ -318,12 +318,15 @@ def L_tr(f):
+ dl('+')*jump(u, n=n)*(dS_vp + dS_hp)
+ dl*dot(u, n)*(ds_tbp + ds_vp)
)

# TODO: can we get this term using FML?
# contribution of the sponge term
if hasattr(self.equations, "mu"):
eqn += dt*self.equations.mu*inner(w, k)*inner(u, k)*dx

if equations.parameters.Omega is not None:
Omega = as_vector([0, 0, equations.parameters.Omega])
eqn += inner(w, cross(2*Omega, u))*dx

aeqn = lhs(eqn)
Leqn = rhs(eqn)

Expand Down Expand Up @@ -506,6 +509,11 @@ def V(u):

if hasattr(self.equations, "mu"):
eqn += dt*self.equations.mu*inner(w, k)*inner(u, k)*dx

if equation.parameters.Omega is not None:
Omega = as_vector((0, 0, equation.parameter.Omega))
eqn += inner(w, cross(2*Omega, u))*dx

aeqn = lhs(eqn)
Leqn = rhs(eqn)

Expand Down Expand Up @@ -655,6 +663,10 @@ def _setup_solver(self):
+ beta_d * phi * Dbar * div(u) * dx
)

if 'coriolis' in equation.prescribed_fields._field_names:
f = equation.prescribed_fields('coriolis')
eqn += beta_u_ * f * inner(w, equation.domain.perp(u)) * dx

aeqn = lhs(eqn)
Leqn = rhs(eqn)

Expand Down Expand Up @@ -867,6 +879,10 @@ def _setup_solver(self):
+ beta_d * phi * Dbar * div(u) * dx
)

if 'coriolis' in equation.prescribed_fields._field_names:
f = equation.prescribed_fields('coriolis')
eqn += beta_u_ * f * inner(w, equation.domain.perp(u)) * dx

aeqn = lhs(eqn)
Leqn = rhs(eqn)

Expand Down
Loading