|
9 | 9 | split, LinearVariationalProblem, Constant, LinearVariationalSolver,
|
10 | 10 | TestFunctions, TrialFunctions, TestFunction, TrialFunction, lhs,
|
11 | 11 | rhs, FacetNormal, div, dx, jump, avg, dS, dS_v, dS_h, ds_v, ds_t, ds_b,
|
12 |
| - ds_tb, inner, action, dot, grad, Function, VectorSpaceBasis, |
13 |
| - BrokenElement, FunctionSpace, MixedFunctionSpace, DirichletBC |
| 12 | + ds_tb, inner, action, dot, grad, Function, VectorSpaceBasis, cross, |
| 13 | + BrokenElement, FunctionSpace, MixedFunctionSpace, DirichletBC, as_vector |
14 | 14 | )
|
15 | 15 | from firedrake.fml import Term, drop
|
16 | 16 | from firedrake.petsc import flatten_parameters
|
@@ -318,12 +318,15 @@ def L_tr(f):
|
318 | 318 | + dl('+')*jump(u, n=n)*(dS_vp + dS_hp)
|
319 | 319 | + dl*dot(u, n)*(ds_tbp + ds_vp)
|
320 | 320 | )
|
321 |
| - |
322 | 321 | # TODO: can we get this term using FML?
|
323 | 322 | # contribution of the sponge term
|
324 | 323 | if hasattr(self.equations, "mu"):
|
325 | 324 | eqn += dt*self.equations.mu*inner(w, k)*inner(u, k)*dx
|
326 | 325 |
|
| 326 | + if equations.parameters.Omega is not None: |
| 327 | + Omega = as_vector([0, 0, equations.parameters.Omega]) |
| 328 | + eqn += inner(w, cross(2*Omega, u))*dx |
| 329 | + |
327 | 330 | aeqn = lhs(eqn)
|
328 | 331 | Leqn = rhs(eqn)
|
329 | 332 |
|
@@ -506,6 +509,11 @@ def V(u):
|
506 | 509 |
|
507 | 510 | if hasattr(self.equations, "mu"):
|
508 | 511 | eqn += dt*self.equations.mu*inner(w, k)*inner(u, k)*dx
|
| 512 | + |
| 513 | + if equation.parameters.Omega is not None: |
| 514 | + Omega = as_vector((0, 0, equation.parameter.Omega)) |
| 515 | + eqn += inner(w, cross(2*Omega, u))*dx |
| 516 | + |
509 | 517 | aeqn = lhs(eqn)
|
510 | 518 | Leqn = rhs(eqn)
|
511 | 519 |
|
@@ -655,6 +663,10 @@ def _setup_solver(self):
|
655 | 663 | + beta_d * phi * Dbar * div(u) * dx
|
656 | 664 | )
|
657 | 665 |
|
| 666 | + if 'coriolis' in equation.prescribed_fields._field_names: |
| 667 | + f = equation.prescribed_fields('coriolis') |
| 668 | + eqn += beta_u_ * f * inner(w, equation.domain.perp(u)) * dx |
| 669 | + |
658 | 670 | aeqn = lhs(eqn)
|
659 | 671 | Leqn = rhs(eqn)
|
660 | 672 |
|
@@ -867,6 +879,10 @@ def _setup_solver(self):
|
867 | 879 | + beta_d * phi * Dbar * div(u) * dx
|
868 | 880 | )
|
869 | 881 |
|
| 882 | + if 'coriolis' in equation.prescribed_fields._field_names: |
| 883 | + f = equation.prescribed_fields('coriolis') |
| 884 | + eqn += beta_u_ * f * inner(w, equation.domain.perp(u)) * dx |
| 885 | + |
870 | 886 | aeqn = lhs(eqn)
|
871 | 887 | Leqn = rhs(eqn)
|
872 | 888 |
|
|
0 commit comments