-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add manufactured solution tendency terms to Omega #170
Add manufactured solution tendency terms to Omega #170
Conversation
Manufactured solution tendency terms required for a manufactured solution test case from Bishnu et al. (2024) are added to Omega. This feature can be tested in conjunction with the Polaris package, which includes a convergence study leveraging this capability.
@hyungyukang // these are empty by default
CustomTendencyType CustomThickTend;
CustomTendencyType CustomVelTend;
if (UseCustomTendency) {
// get manufactured tendencies etc
CustomThickTend = ManufacturedSol.ManufacturedThickTend;
CustomVelTend = ManufacturedSol.ManufacturedVelTend;
}
// one unconditional call to create
Tendencies::DefaultTendencies = create("Default", DefHorzMesh, NVertLevels, NTracers, &TendConfig, CustomThickTend, CustomVelTend); |
@mwarusz , thank you very much for the suggestion. I agree with you. I just tried it and it's working perfectly! I'm going to commit the code soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments/questions about error checking. These are not just for @hyungyukang but for Omega developers more broadly. Maybe @philipwjones has some thoughts?
Modify the tendency initialization process to avoid clearing and recreating the default Tendencies with custom tendencies
Sure. |
To enable this feature, Polaris needs to make some changes from Diff. between `omega.yml` and `config/Default.yml`@@ -1,13 +1,13 @@
Omega:
TimeIntegration:
CalendarType: No Leap
- TimeStepper: Forward-Backward
+ TimeStepper: RungeKutta4
TimeStep: 0000_00:10:00
StartTime: 0001-01-01_00:00:00
- StopTime: 0001-01-01_02:00:00
+ StopTime: 0001-01-01_10:00:00
RunDuration: none
Dimension:
- NVertLevels: 60
+ NVertLevels: 1
Decomp:
HaloWidth: 3
DecompMethod: MetisKWay
@@ -21,17 +21,17 @@ Omega:
PVTendencyEnable: true
KETendencyEnable: true
SSHTendencyEnable: true
- VelDiffTendencyEnable: true
+ VelDiffTendencyEnable: false
ViscDel2: 1.0e3
- VelHyperDiffTendencyEnable: true
+ VelHyperDiffTendencyEnable: false
ViscDel4: 1.2e11
TracerHorzAdvTendencyEnable: true
TracerDiffTendencyEnable: true
EddyDiff2: 10.0
TracerHyperDiffTendencyEnable: true
EddyDiff4: 0.0
- UseCustomTendency: false
- ManufacturedSolutionTendency: false
+ UseCustomTendency: true
+ ManufacturedSolutionTendency: true
Tracers:
Base: [Temperature, Salinity]
Debug: [Debug1, Debug2, Debug3]
@@ -49,7 +49,6 @@ Omega:
UseStartEnd: false
Contents:
- State
- - Base
# Restarts are used to initialize for all job submissions after the very
# first startup job. We use UseStartEnd with a start time just after the
# simulation start time so that omega does not attempt to use a restart
@@ -84,8 +83,8 @@ Omega:
Mode: write
IfExists: replace
Precision: double
- Freq: 1
- FreqUnits: months
+ Freq: 10
+ FreqUnits: hours
UseStartEnd: false
Contents:
- Tracers |
@xylar and all. As I mentioned in the Error design, most of these errors should indeed be critical and abort, but we don't have a way of doing that easily until I get the new Error capability implemented (LOG_CRITICAL currently does not abort automatically). As part of that implementation, I'll be doing a pass through the code and replacing many of these error calls and error returns with critical errors and aborts when needed. But if we want to at least upgrade these to critical error messages, that will be a good hint about where we want this to happen. |
And while I'm commenting on this PR...do we need to start thinking about multiple YAML configs now that we're starting to get conflicts. In particular, the streams unit test with this change will be writing output every 10 hours for a full year so probably not what we want. |
@philipwjones, thanks for the update. I didn't realize that we weren't there yet with LOG_CRITICAL, sorry about that. |
I don't think @hyungyukang is proposing any changes to the YAML file (other than adding a few config options). These are the changes that Polaris will be making to the YAML file it uses (made manually for now). |
Ah yes, I misread the comment on the Default.yml changes. |
We need a Polaris PR to make the changes to the manufactured solution tests such that the correct yaml config options are set. This shouldn't be hard but there are a lot of moving pieces in Polaris and Omega right now so I haven't got to it yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few C++ coding suggestions and one general question about constants.
R8 Grav = 9.80665_Real; // Gravity acceleration | ||
R8 Pii = 3.141592653589793_Real; // Pi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is outside the scope of this PR, but should we start thinking about creating a shared constants file ? @mark-petersen @xylar Thoughts ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need (!!!) to come from:
https://github.com/E3SM-Project/E3SM/blob/09b9b7e21e3d381eafa962e178a5951580e2fc74/share/util/shr_const_mod.F90
How is Scream handling this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Common constants need to come from a unified file, and preferably the centralized one that @xylar pointed to above. We struggled with multiple constants files in MPAS within E3SM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hyungyukang, this is working great for me in Polaris. On Chrysalis, I did a test merge of this branch with develop
. Then, ran the CTest utility in Polaris, which is also a convenient way to automatically build the Omega code. Then, I ran the manufactured solution test using this branch:
E3SM-Project/polaris#249
The results look great!
For everyone's reference, a typical omega.yml
that Polaris produces for this is:
Omega:
TimeIntegration:
CalendarType: No Leap
TimeStepper: RungeKutta4
TimeStep: 0000_00:10:00.000
StartTime: 0001-01-01_00:00:00
StopTime: none
RunDuration: 0000_10:00:00.000
Dimension:
NVertLevels: 1
Decomp:
HaloWidth: 3
DecompMethod: MetisKWay
State:
NTimeLevels: 2
Advection:
FluxThicknessType: Center
FluxTracerType: Center
Tendencies:
ThicknessFluxTendencyEnable: true
PVTendencyEnable: true
KETendencyEnable: true
SSHTendencyEnable: true
VelDiffTendencyEnable: false
ViscDel2: 1.0e3
VelHyperDiffTendencyEnable: false
ViscDel4: 1.2e11
TracerHorzAdvTendencyEnable: true
TracerDiffTendencyEnable: true
EddyDiff2: 10.0
TracerHyperDiffTendencyEnable: true
EddyDiff4: 0.0
UseCustomTendency: true
ManufacturedSolutionTendency: true
Tracers:
Base: [Temperature, Salinity]
Debug: [Debug1, Debug2, Debug3]
ManufacturedSolution:
WavelengthX: 5.0e6
WavelengthY: 4.33013e6
Amplitude: 1.0
IOStreams:
# InitialState should only be used when starting from scratch
# After the simulations initial start, the frequency should be
# changed to never so that the initial state file is not read.
InitialState:
UsePointerFile: false
Filename: init.nc
Mode: read
Precision: double
Freq: 1
FreqUnits: OnStartup
UseStartEnd: false
Contents:
- NormalVelocity
- LayerThickness
RestartRead:
UsePointerFile: true
PointerFilename: ocn.pointer
Mode: read
Precision: double
Freq: 1
FreqUnits: OnStartup
UseStartEnd: true
StartTime: 0001-01-01_00:00:01
EndTime: 99999-12-31_00:00:00
Contents:
- Restart
History:
UsePointerFile: false
Filename: output.nc
Mode: write
IfExists: replace
Precision: double
Freq: 36000
FreqUnits: Seconds
UseStartEnd: false
Contents:
- NormalVelocity
- LayerThickness
- SshCellDefault
@xylar , this is great! Thank you so much for testing this PR with Polaris! Results look beautiful. Were you able to run Del2/Del4 test as well? |
@hyungyukang, I think some work will be needed by @cbegeman to rebase E3SM-Project/polaris#234 before we can run del2/del4 in Polaris. She's busy with AGU right now and I haven't had time to familiarize myself with that branch yet. So I didn't try that so far. Maybe we should treat that as a separate review? |
@xylar , Aha, got it. Probably we can wait for it? I'm currently busy with AGU as well and will need some time to address the code suggestions from @mwarusz . While I don't want to hold this PR for longer time, it will not affect subsequent Omega developments. So it would be good to merge it once all tests (default, del2, del4) have been confirmed to work properly. |
We have a bit of a logjam at the moment. Manufactured solution default is the only test case that supports Omega at the moment so it would be really nice to have it working with both Omega If E3SM-Project/polaris#234 can be rebased and updated to work with the convergence in space and time only that we recently added, we should be able to test with it. But I don't feel comfortable taking over that work so that will need to wait for @cbegeman to have some time. My preference would be to merge this branch assuming that the del2 and del4 terms are okay based on your testing, and to follow up with another PR if we later discover that bug fixes are needed. In other words, while leaving this PR unmerged is not holding up Omega development, it is holding up Polaris development. |
I am testing this PR on Perlmutter. CPU compiles. GPU with
This is my compile sequence:
|
Also with
|
Passes perlmutter cpu tests using |
@xylar , all make sense to me. Thanks a lot! Let's merge this branch first, after which we can proceed with working on the del2/del4 source terms. If any issues arise with the code subsequently, I can address them by opening an additional pull request for the bug fix. I will address suggestions and issues soon. |
@mark-petersen , thanks for testing. I actually haven't ran it on pm-gpu because sometimes compilation on it is very slow... I will address the issue soon. |
- Address code suggestions - Resolve an issue with pm-gpu
@mark-petersen , I have resolved the issue with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this compiles on pm gpu with nvidia now. Approving based on the reported tests above. Thanks!
Checked with @cbegeman, who is busy at AGU this week. |
This PR adds custom tendency terms required for the manufactured solution test case to Omega. This feature can be tested in conjunction with the Polaris package, which has included a convergence study leveraging this capability. The details of this test case can be found in Section 2.10 and Figures 13 and 19 in Bishnu et al. 2024 and the manufactured solution test in Polaris.
The error norms for this test case are expected to demonstrate second-order convergence. The test results will be posted in this PR following integration with Polaris for this test case.
This PR does not modify the unit tests but passed them on Frontier using both CPU and GPU.
Checklist