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

Fixes surface buoyancy forcing calculation #690

Merged

Conversation

vanroekel
Copy link
Contributor

Currently the KPP buoyancy flux is assuming the seaIceFreshWaterFlux and iceBergFreshwaterFlux enter the ocean at 0C, but the surface_bulk_forcing code assumes it enters at the freezing temperature. This PR unifies the treatment.

current calculation does not appropriately account for seaIceFreshwater
and IcebergFreshwaterfluxes
@vanroekel
Copy link
Contributor Author

@vanroekel
Copy link
Contributor Author

I've started a G-case to test this and will report back when it's finished.

- fracAbsorbed * (rainFlux(iCell) + evaporationFlux(iCell)) * activeTracers(indexTempFlux,1,iCell)/rho_sw &
- fracAbsorbedRunoff * surfaceThicknessFluxRunoff(iCell)* min(activeTracers(indexTempFlux,1,iCell),0.0_RKIND)/rho_sw

if(config_cvmix_use_kpp_buoyancyForcing_fix) then
Copy link
Contributor

Choose a reason for hiding this comment

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

@philipwjones @mattdturner or @amametjanov:
We put this if flag here for backwards compatibility. It is within a cell loop.

Is this still a performance sin, or do the compilers handle this now for flags that never change during the run?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a sin my son and will require at least 3 Hail Marys. Particularly in this case, where the loop is complex enough that the compiler can't break it up, it's not optimal. I don't know that it'll be a huge performance hit on CPU architectures but will probably need to be broken out for the GPU version.

Copy link
Contributor

Choose a reason for hiding this comment

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

this will hopefully be a relatively short term hack. we just need to remember to remove it once we are satisfied with the new (correct) code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. Once we test this in WC and are happy with results, I'll make a PR to remove the if statement. I can't imagine this is in for more than a week.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect, thanks for the perspective. I made an issue to help us remember: #692

@@ -394,6 +394,10 @@
description="If true, use the Community Vertical MIXing routines to compute vertical diffusivity and viscosity"
possible_values="True or False"
/>
<nml_option name="config_cvmix_use_kpp_buoyancyForcing_fix" type="logical" default_value=".false." units="NA"
Copy link
Contributor

Choose a reason for hiding this comment

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

@vanroekel do you want this default true in E3SM? If so, I'll make it true here as well.

@mark-petersen mark-petersen removed the request for review from maltrud September 10, 2020 22:48
mark-petersen added a commit that referenced this pull request Sep 10, 2020
Fixes surface buoyancy forcing calculation #690

Currently the KPP buoyancy flux is assuming the seaIceFreshWaterFlux and
iceBergFreshwaterFlux enter the ocean at 0C, but the
surface_bulk_forcing code assumes it enters at the freezing temperature.
This PR unifies the treatment.
mark-petersen added a commit that referenced this pull request Sep 10, 2020
Fixes limiting on redi k33 #684
Fixes surface buoyancy forcing calculation #690
Revert GM buoyancy gradient calculation to v1 form #687
Copy link
Contributor

@mark-petersen mark-petersen left a comment

Choose a reason for hiding this comment

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

Reviewed code, passes stand-alone tests. Testing in E3SM now, but @vanroekel has tested as well.

@mark-petersen mark-petersen merged commit 786f558 into MPAS-Dev:ocean/develop Sep 11, 2020
mark-petersen added a commit that referenced this pull request Sep 11, 2020
Fixes limiting on redi k33 #684
Fixes surface buoyancy forcing calculation #690
Revert GM buoyancy gradient calculation to v1 form #687
jonbob added a commit to E3SM-Project/E3SM that referenced this pull request Sep 14, 2020
This PR brings in a new mpas-source submodule with changes only to the
ocean core, plus scripts updates corresponding to Registry changes in
the ocean. It includes three changes to improve ocean heat uptake:
* Fixes limiting on redi k33 (MPAS-Dev/MPAS-Model/pull/684);
* Fixes surface buoyancy forcing calculation
  (MPAS-Dev/MPAS-Model/pull/690); and
* Revert GM buoyancy gradient calculation to v1 form
  (MPAS-Dev/MPAS-Model/pull/687).

[NML]
[non-BFB]
jonbob added a commit to E3SM-Project/E3SM that referenced this pull request Sep 15, 2020
Update mpas-source: GM/Redi and surface buoyancy fixes

This PR brings in a new mpas-source submodule with changes only to the
ocean core, plus scripts updates corresponding to Registry changes in
the ocean. It includes three changes to improve ocean heat uptake:
* Fixes limiting on redi k33 (MPAS-Dev/MPAS-Model/pull/684);
* Fixes surface buoyancy forcing calculation
  (MPAS-Dev/MPAS-Model/pull/690); and
* Revert GM buoyancy gradient calculation to v1 form
  (MPAS-Dev/MPAS-Model/pull/687).

[NML]
[non-BFB]
mark-petersen added a commit to mark-petersen/MPAS-Model that referenced this pull request Jan 11, 2021
…/develop

Fixes surface buoyancy forcing calculation MPAS-Dev#690

Currently the KPP buoyancy flux is assuming the seaIceFreshWaterFlux and
iceBergFreshwaterFlux enter the ocean at 0C, but the
surface_bulk_forcing code assumes it enters at the freezing temperature.
This PR unifies the treatment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants