Add surface tracer restoring#355
Conversation
|
Thanks @katsmith133 ! Were you thinking of adding extra documentation to this? I see that you have updated the existing doc with a mention of these terms. It might be worthwhile adding a description paragraph to document the assumptions we've made on the current version of surface restoring? I don't know what our agreed-upon documentation level is though, since the other terms are not necessarily described either.... |
There was a problem hiding this comment.
@katsmith133 this looks good to me!
I concur that all tests pass on pm-gpu.
my main questions/requests are whether we want to document the current surface restoring configuration a little more (e.g. velocity and maxDiff need to be positive, current restoring everywhere, expected T,S variables are the state variables CT, SA).
Do we have a plan to test the minLayerCell different from zero at this point or are we waiting for a later testing configuration?
|
@katsmith133 Let me know if this can/should be tested with a single-column polaris test with surface restoring |
@alicebarthel Thanks for reviewing this! I will add more details to the documentation to cover the things you suggest. Great ideas! Also, as far as I can tell, the way MPAS-O does this is to apply it to the minLevelCell, not to the zeroth level: |
|
After a discussion with @alicebarthel, we've noted that this PR does not include the following features:
|
|
I'm personally fine with saving (2) and (3) for later. In particular, we'd want to add sea ice forcing fields before (3). |
|
Ok, I've added a way to specify which tracers or tracer groups you want to have restored. So you can either specify individual tracers by name in
Only one option needs to be used, but if both are used any overlapping tracers (in this case Temp and Salt as they are in the Base tracer group) will just be counted once along with any non-overlapping tracers in both categories. Perhaps this is an overkill way to do this? Would we prefer to just have the Along with this change I have added a bit of extra testing to Will next work on adding more documentation now, just need to figure out where best to add additional information on the surface restoring in the Docs... One last thought... are we assuming that the restoring files are in the units of SA and CT? Or should we assume they will be in T,S like they are for MPAS-O? I think that might be the better assumption? In that case, some code to convert would be good. I could add a flag that toggles that conversion if we don't want to assume one way or another? Or another option would be to have it decide based upon units in the restoring file? The infrastructure is not there yet to read that file, so this would be a later dev. |
|
I've updated the tracer selection to be more simple, added new docs for summarizing the forcing (with @alicebarthel planning to add thermodynamics forcing to this when that is PR'd), and addressed all current reviewer comments. @vanroekel and @mwarusz do you two want to take a look at this? Or should I remove you/ask others. |
|
I won't be able to review this till early next week. If okay to wait that long I will review monday. If you are ready to go sooner, just remove me. |
mwarusz
left a comment
There was a problem hiding this comment.
Thanks for your work on this @katsmith133 It looks mostly good, I have a couple of small comments and two bigger comments regarding performance. If this feature is needed soon, the performance comments can be addressed in a later PR.
Performance comments:
- I currently don't see why we need to create an aux array for
SurfTracerRestoringDiffsCell. Can't these differences be computed inside the surface restoring tendency term ? - The approach of selecting tracers to restore using a mask seems sub-optimal to me. The way I would have done it is:
- On the host, determine the indices of tracers to restore and the total number of tracers to restore
- Allocate and fill a device array
Array1DI4 TracerIdsToRestore("TracerIdsToRestore", NTracersToRestore); - Compute the tendency term as follows:
parallelFor( {NTracersToRestore, Mesh->NCellsAll}, KOKKOS_LAMBDA(int R, int ICell) { const int KMin = MinLayerCell(ICell); const int L = TracerIdsToRestore(R); LocSurfaceTracerRestoring(LocTracerTend, L, ICell, KMin, SurfTracerRestoringDiffsCell); });
In addition to the suggestions below, if you decide to keep the SurfTracerRestoringDiffsCell aux array, could you add the following piece of code in the auxiliary state test to check that this variable is computed:
Real SurfTracerRestoringDiffsCSum = 0;
for (I4 LTracer = 0; LTracer < NTracers; ++LTracer) {
auto TracerDiffsCell = Kokkos::subview(
DefAuxState->SurfTracerRestAux.SurfTracerRestoringDiffsCell, LTracer,
Kokkos::ALL);
SurfTracerRestoringDiffsCSum += sum(TracerDiffsCell, OnCell);
}
if (!Kokkos::isfinite(SurfTracerRestoringDiffsCSum)) {
Err++;
LOG_ERROR("AuxStateTest: SurfTracerRestoringDiffsCell FAIL");
}
You can add it after a similar check here:
Omega/components/omega/test/ocn/AuxiliaryStateTest.cpp
Lines 302 to 308 in c409e9d
e8bb606 to
625e627
Compare
|
@mwarusz Thanks for the review! I think I touched on everything you suggested. Please let me know if my changes addressed your concerns or not. |
vanroekel
left a comment
There was a problem hiding this comment.
Overall looks good @katsmith133 but I had two bigger questions. I'd also be interested in what @alicebarthel thinks about the maxDiff comment. I've never understood why we included maxDiff = 100 in MPAS-Ocean, it seems so big as to not be useful.
|
I think it would be pretty approachable to add a surface restoring variant of the single column test E3SM-Project/polaris#435. Let me know if you need help. |
Sure, I think that is a good idea, @cbegeman. I can get started on that later today. @alicebarthel any thoughts on Luke's MaxDiff comment? |
|
Removed As per the conversation this morning, we will save calling in the timestepper and testing in polaris for a different PR once appropriate code is merged. @alicebarthel, @vanroekel, and @mwarusz, please let me know if you are happy with the current code and we can merge. Thanks! |
d016b5b to
8fa3a02
Compare
mwarusz
left a comment
There was a problem hiding this comment.
I have one small suggestion, but otherwise this looks good to me. Passes CTests on frontier-gpu. Thanks for addressing my previous comments @katsmith133
|
Thanks @mwarusz for the review and great suggestions! |
|
Thanks for the quick turn-around @katsmith133! |
vanroekel
left a comment
There was a problem hiding this comment.
Looks great from a visual pass. Thanks @katsmith133 for the great work.
|
Merged into |
This PR adds surface restoring for tracers and updates the tests and docs to reflect these changes.
Passes all CTests on PM-CPU and PM-GPU.
Checklist
Testingwith the following:have been run on and indicate that are all passing.
Testing
CTest unit tests
Tests added/modified/impacted:
testSurfaceTracerRestoringOnCell, and in AuxiliaryVarsTest added test:testSurfTracerRestAuxVarsDocumentation
Documentation has be built locally here and charges are as expected: https://portal.nersc.gov/project/e3sm/katsmith/omega_docs_surfforce/html/index.html