Conversation
gusto/equations.py
Outdated
| # TODO: add linearisation and label for this | ||
| residual += subject(prognostic( | ||
| inner(w, cross(2*Omega, u))*dx, "u"), self.X) | ||
|
|
There was a problem hiding this comment.
we better not lose the comment reminding us to add the linearisation here
gusto/diagnostics.py
Outdated
| def __init__(self, parameters, space=None, method='solve'): | ||
| u""" | ||
| Args: | ||
| space (:class:`FunctionSpace`, optional): the function space to |
There was a problem hiding this comment.
please update docstring to include parameters argument
There was a problem hiding this comment.
I think it's just CompressibleParameters - this should also work for the Boussinesq equations so you can remove any mention of Euler... in fact, it also works for incompressible...
gusto/diagnostics.py
Outdated
| n = FacetNormal(domain.mesh) | ||
| a = inner(vort, w) * dx | ||
| L = inner(u, curl(w)) * dx - jump(cross(w, u), n) * dS_h | ||
| if vorticity_type != 'relative': |
There was a problem hiding this comment.
why not if vorticity_type == 'absolute' as above?
gusto/diagnostics.py
Outdated
|
|
||
|
|
||
| class CompressibleVorticity(DiagnosticField): | ||
| u""" Base diagnostic Field for three dimensional Vorticity """ |
There was a problem hiding this comment.
does this (should this?) also work in a vertical slice?
There was a problem hiding this comment.
This is a good question, which im not sure on so will have a test around and decide if it does / should it, i think it should work but may require a bit of thinking
There was a problem hiding this comment.
Since you've put in effort to make this work in a vertical slice, you can change this comment!
|
I'm afraid that this now conflicts with changes that have just gone onto main -- could you fix these and then we can look at getting this on? |
… compressibleVorticity
tommbendall
left a comment
There was a problem hiding this comment.
Sorry it's taken me a long time to look at this. I'm just leaving a few thoughts which hopefully shouldn't be too complicated to deal with!
I've looked at the failing tests, and I think this is just because there are a couple of places (examples/shallow_water/thermal_williamson2.py and integration_tests/equations/test_sw_triangle.py) with existing vorticity diagnostics that need the parameters argument adding
You also have some lint failures to fix!
gusto/diagnostics.py
Outdated
| self.expression = curl(u) | ||
| elif vorticity_type == 'absolute': | ||
| Omega = as_vector((0, 0, self.parameters.Omega)) | ||
| self.expression = curl(u) + 2*Omega |
There was a problem hiding this comment.
Should this be self.expr?
gusto/diagnostics.py
Outdated
| u = state_fields('u') | ||
| if self.method != 'solve': | ||
| if vorticity_type == 'relative': | ||
| self.expression = curl(u) |
There was a problem hiding this comment.
Should this be self.expr?
gusto/diagnostics.py
Outdated
| be computed ('relative', 'absolute'). Defaults to | ||
| None. | ||
| """ | ||
| # TODO Do we eventually want a potential voriticy? |
There was a problem hiding this comment.
Yes I think we will -- you can remove this comment for now though
gusto/diagnostics.py
Outdated
|
|
||
|
|
||
| class CompressibleVorticity(DiagnosticField): | ||
| u""" Base diagnostic Field for three dimensional Vorticity """ |
There was a problem hiding this comment.
Since you've put in effort to make this work in a vertical slice, you can change this comment!
gusto/diagnostics.py
Outdated
| n = FacetNormal(domain.mesh) | ||
| a = inner(vort, gamma) * dx | ||
| L = ( inner(domain.perp(grad(gamma)), u))*dx - jump(inner(domain.perp(n), u)*gamma)*ds_h | ||
| # TODO implement absolute version, unsure atm how to get corioilis in vertical slice smartly |
There was a problem hiding this comment.
This isn't obvious to me, and it isn't obvious that we'll ever want the absolute vorticity in a vertical slice. I suggest that you put an if check here so that we fail with a NotImplementedError in this situation
gusto/equations.py
Outdated
| residual += coriolis(subject(prognostic( | ||
| if parameters.Omega is not None: | ||
| # TODO add linerisation and label for this | ||
| Omega = as_vector((0, 0, parameters.Omega)) |
There was a problem hiding this comment.
Maybe we should call this variable Omega_vec to avoid confusion
gusto/diagnostics.py
Outdated
|
|
||
|
|
||
| class AbsoluteVorticity(Vorticity): | ||
| u""" Diagnostic field for compressible euler absolute vorticity """ |
There was a problem hiding this comment.
As Jemma says, you could remove reference to compressible euler here?
…roject/gusto into compressibleVorticity
… compressibleVorticity
Added compressible vorticity diagnostics so that a vector vorticity can be calculated for the compressible euler equations for both the absolute and relative versions of vorticity