Clean up some diagnostics and ensure that diagnostics return AbstractOperations#94
Clean up some diagnostics and ensure that diagnostics return AbstractOperations#94navidcy wants to merge 19 commits into
Conversation
| function net_ocean_freshwater_flux(esm::EarthSystemModel; reference_salinity = 35) | ||
| ρᵒᶜ = esm.interfaces.ocean_properties.reference_density | ||
| S₀ = convert(typeof(ρᵒᶜ), reference_salinity) | ||
| net_ocean_frashwater_flux = - ρᵒᶜ / S₀ * net_ocean_salinity_flux(esm) | ||
| return Field(net_ocean_frashwater_flux) | ||
| return - ρᵒᶜ / S₀ * net_ocean_salinity_flux(esm) |
There was a problem hiding this comment.
this is wrong right? we are actually given the freshwater flux. using a reference salinity will introduce an error that will prevent us from closing a water budget?
There was a problem hiding this comment.
also is the sign - because salt flux is negative freshwater flux?
There was a problem hiding this comment.
The negative sign is exactly because of that.
There was a problem hiding this comment.
We don't use salt/salinity anymore to infer the freshwater fluxes but rather we read the freshwater fluxes from the coupler.
glwagner
left a comment
There was a problem hiding this comment.
good improvement, but I'm worried that providing temperature fluxes is not sustainable. I also worry about the approximatudes of a reference_salinity. Why don't we actually save the freshwater flux? This is hard to recover afterwards, eg if it comes from the atmosphere model's precipitation or land runoff
To be honest, regarding temp-heat dings: the important diagnostics are the heat fluxes! I'm very happy to drop the temperature fluxes; nobody ever uses/analyses/plots those! |
|
ok yeah i def think we should drop temperature fluxes! |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
| Return the sea ice-ocean salinity flux (g/kg m s⁻¹) at the sea ice-ocean interface | ||
| in a coupled `esm`. | ||
| """ | ||
| function sea_ice_ocean_salinity_flux(esm::EarthSystemModel) |
There was a problem hiding this comment.
It is worth noting that this flux actually has units g / kg * m / s. "salinity" is properly unitless, (or just 1/1000). there is another quantity, the "salt flux", which we think would probably have kg * m/s (eg a mass flux)
There was a problem hiding this comment.
That's exactly what's mentioned in the docstring, right?
There was a problem hiding this comment.
it doesnt say anything about the salt flux but you're right that it mentions the units
There was a problem hiding this comment.
Perhaps when writing the docstrings I've used "salt flux" and "salinity flux" interchangeably.
Is there a difference between the two I should be aware of?
There was a problem hiding this comment.
Your message suggests they are different. Salt flux is the mass of the salt, salinity is the "relative saltiness".
There was a problem hiding this comment.
perhaps my head is spinning now and I'm not communicating clearly? I banged it the other day and today it decided to hurt...
There was a problem hiding this comment.
but isn't that an approximation, and not the true salinity flux which uses the surface salinity (prognostic, depends on xy)
There was a problem hiding this comment.
There was a problem hiding this comment.
I see... so essentially J^S is the freshwater fluxes after multiplied by the surface salinity. So we should recover the freshwater fluxes by dividing by the actual surface salinity, not any reference salinity value, right?
That's what you are saying?
|
Yep agree to drop salt and temperature fluxes! |
done |
* Modified freshwater flux definitions to match volume fluxes from interfaces * Update freshwater diagnostics docs and calls * Align freshwater diagnostics to mass flux units * Remove redundant sea-ice freshwater write in net ocean assembly * Apply suggestions from code review --------- Co-authored-by: Navid C. Constantinou <navidcy@users.noreply.github.com>
|
@glwagner you approved but lots has changed; could you have another look? |
| function atmosphere_ocean_freshwater_flux(esm::EarthSystemModel) | ||
| ρᵒᶜ = esm.interfaces.ocean_properties.reference_density | ||
| return ρᵒᶜ * esm.interfaces.atmosphere_ocean_interface.fluxes.freshwater_flux | ||
| end |
There was a problem hiding this comment.
I guess there is a conflict here in terminology. probably the property should be changed to freshwater_volume_flux and we can define freshwater_flux as a mass flux.
There was a problem hiding this comment.
Or we can rename all freshwater flux diagnostics to freshwater_mass_flux?
There was a problem hiding this comment.
and you propose defining freshwater_flux as a volume flux?
There was a problem hiding this comment.
esm.interfaces.atmosphere_ocean_interface.fluxes.freshwater_fluxis a volume flux, right?
We leave that as is, and the freshwater_flux diagnostics (which are mass fluxes) we add the _mass_ make it explicit that they differ from the
esm.interfaces.atmosphere_ocean_interface.fluxes.freshwater_flux?
There was a problem hiding this comment.
This is one option.
I am proposing a different path: define freshwater_flux as a mass flux, and rename the internal variable to make specific that it is a volume flux.
The reason to do this is that we really want to work with mass fluxes and a volume flux is not something user facing.
There was a problem hiding this comment.
That's a big change, right? I mean, there are a lot of places where in the internals of the coupler there is freshwater_flux and all need to change to freshwater_volume_flux?
The same should happen in the ocean-sea ice coupler?
There was a problem hiding this comment.
isn't it just a search and replace?
There was a problem hiding this comment.
Sure, the workload is not my concern.
I just wanna confirm I understood correctly what I need to search and replace for.
There was a problem hiding this comment.
Could you do it, perhaps?
I'm getting confused which variables are already in mass flux and which in volume flux....
| return Field(sea_ice_ocean_freshwater_flux) | ||
| end | ||
| sea_ice_ocean_freshwater_flux(esm::EarthSystemModel) = | ||
| esm.interfaces.sea_ice_ocean_interface.fluxes.freshwater_flux |
There was a problem hiding this comment.
I don't think this exists. It's a salt flux, so we need to convert it to freshwater.
There was a problem hiding this comment.
ah scratch it. I didn't see it is part of this PR to add it
|
Too many merge conflicts; closing in favour of #281 |
Continuing #71
#71 (comment)
Also includes #99