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

Switch wind stress to use isotropic interpolation from cells to edge normals #98

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

xylar
Copy link
Collaborator

@xylar xylar commented May 10, 2024

This merge adds a namelist option that defaults to the current anisotropic approach to interpolating wind stresses in MPAS-Ocean but which can be set to use a new isotropic interpolation approach.

This merge also adds 2 new subroutines to the framework that interpolate a 1d field of 2d (zonal and meridional) vectors from cell centers to edges.

@xylar xylar force-pushed the mpas/isotropic-interp-normal-wind-stress branch 2 times, most recently from 9d221c7 to 24e8d1b Compare May 10, 2024 23:28
@xylar xylar force-pushed the mpas/isotropic-interp-normal-wind-stress branch from 24e8d1b to 6bfe4a6 Compare May 11, 2024 02:24
@xylar xylar force-pushed the mpas/isotropic-interp-normal-wind-stress branch from 6cfc7de to a51d877 Compare May 11, 2024 03:08
@xylar
Copy link
Collaborator Author

xylar commented May 11, 2024

This passes the SMS_D_Ld5.T62_oQU240wLI.GMPAS-IAF.chrysalis_intel test. The next thing to do would be to add a stealth test that uses the isotropic interpolation.

@proteanplanet
Copy link
Collaborator

I have started testing and will report back here on results from a G-case comparison.

@xylar
Copy link
Collaborator Author

xylar commented May 11, 2024

@proteanplanet, I haven't tested the isotropic interpolation at all yet so maybe hold off until I have a chance to run a similar test to the one above but with config_bulk_wind_stress_interp_isotropic = .true.. Right now, E3SM won't even know about that config option so even setting a user namelist option won't work, I don't think.

@xylar xylar force-pushed the mpas/isotropic-interp-normal-wind-stress branch from a51d877 to 4f9c3ed Compare May 11, 2024 16:32
@xylar xylar marked this pull request as ready for review May 11, 2024 16:33
@xylar
Copy link
Collaborator Author

xylar commented May 11, 2024

@proteanplanet, sorry for the confusion last night. I now have this tested in both "anisotropic" and "isotropic" modes with a simple smoke test:

SMS_D_Ld5.T62_oQU240wLI.GMPAS-IAF.chrysalis_intel.mpaso-isotropic_wind_stress
SMS_D_Ld5.T62_oQU240wLI.GMPAS-IAF.chrysalis_intel

I believe it is ready for you to try out. We should plot the resulting normal component of wind stress at edges as early in the simulation as possible to avoid wasting a lot of compute time if there are obvious bugs.

@proteanplanet
Copy link
Collaborator

Testing so far, using this branch merged with the current E3SM master in https://github.com/proteanplanet/E3SM/tree/proteanplanet/ocn/isowindstress:

This passes the e3sm_cryo_developer suite on Chrysalis:

     "SMS_D_Ld1.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF.mpaso-jra_1958",
     "ERS_Ld5.T62_oQU240wLI.GMPAS-DIB-IAF-PISMF",
     "PEM_Ln5.T62_oQU240wLI.GMPAS-DIB-IAF-PISMF",
     "PET_Ln5.T62_oQU240wLI.GMPAS-DIB-IAF-PISMF",
     "ERS_Ld5.T62_oQU240wLI.GMPAS-DIB-IAF-DISMF",
     "PEM_Ln5.T62_oQU240wLI.GMPAS-DIB-IAF-DISMF",
     "PET_Ln5.T62_oQU240wLI.GMPAS-DIB-IAF-DISMF",

This hangs on Chrysalis upon initialization, but runs on Anvil:

COMPSET[G]="GMPAS-JRA1p5"
RESOLUTION[G]="TL319_EC30to60E2r2"
PELAYOUT[G]="L"

Analysis of Anvil results will continue while the hanging problem on Chrysalis is investigated.

@jonbob
Copy link
Collaborator

jonbob commented May 14, 2024

I can verify that a G-case with the default layout hangs. The chrysalis default layout is threaded but has the ocean running on its own set of processors. As @proteanplanet reported, the run simply hangs and the resulting traceback doesn't offer much information. But it does not appear to be a threading issue, since both of these tests pass:
SMS_D_P480x1.TL319_EC30to60E2r2.GMPAS-JRA1p5
SMS_D_P480x2.TL319_EC30to60E2r2.GMPAS-JRA1p5

@proteanplanet
Copy link
Collaborator

proteanplanet commented May 14, 2024

Here are some early results from G-case testing with GMPAS-JRA1p5 and TL319_EC30to60E2r2:

windstress_difference_kineticEnergyCellSum

windstress_difference_kineticEnergyCellMin

windstress_difference_kineticEnergyCellMax

windstress_difference_normalVelocityMin

windstress_difference_normalVelocityMax

windstress_difference_relativeVorticityMin

windstress_difference_relativeVorticityMax

windstress_difference_normalizedAbsoluteVorticityAvg

@cbegeman
Copy link
Collaborator

cbegeman commented May 15, 2024

@proteanplanet Interesting. I would have expected new-old kineticEnergyCellSum to be positive if more momentum was being transferred into the ocean with the more accurate interpolation, but it looks negative in your plot. Maybe the flow is more oscillatory in the old case due to more interpolation error? The idealized tests we've planned seem useful for understanding this.

@jonbob
Copy link
Collaborator

jonbob commented May 15, 2024

An update on the strange testing hang. It appears to be a seaice partition file that's causing the problem, specifically:

/lcrc/group/e3sm/data/inputdata/ice/mpas-seaice/EC30to60E2r2/partitions/mpas-seaice.graph.info.230313.part.160

The layout that has illustrated the problem is the default one, with all components using 2 threads and atm, ice, cpl, lnd and rof on 160 pes and the ocn on its own 320 pes. Changing the atm/ice/cpl/lnd/rof count to 128 pes runs fine, as does 192. When I tested with 1 thread, everything worked until the ice ran on 160 pes as well. It also ran fine using the older partition file

mpas-seaice.graph.info.200908.part.160

I checked a semi-recent version of master and it behaved similarly, so it does not appear to be anything introduced in this PR.

@jonbob
Copy link
Collaborator

jonbob commented May 15, 2024

I checked and that graph file does send points to each processor. And it does have the correct number of points

@xylar
Copy link
Collaborator Author

xylar commented May 21, 2024

@proteanplanet, the main thing I'm finding in idealized testing is that the new wind-stress reconstruction results in about twice as much stress at edges at land boundaries than the previous version:

anisotropic:
aniso

isotropic:
iso

This is because the anisotropic method normalizes the stress at an edge by the total kite area even if there is only 1 adjacent cell, whereas the new, isotropic approach normalizes by the total area associated with cells that exist. I can't see any way to normalize the isotropic approach by the total area associated with both ocean and land cells because we have removed the land cells and their associated kite areas.

@xylar
Copy link
Collaborator Author

xylar commented May 21, 2024

By default, the windstress in the idealized test case I'm using (MPAS-Dev/compass#547) varies quite smoothly. If I increase the frequency by a factor of 128 (so it varies at close to the grid scale), I see:

zonal wind stress at cell centers (either approach):
zonal_256

anisotropic interpolation to edges:
aniso_256

isotropic interpolation to edges:
iso_256

It is interesting that the isotropic case produces stronger interpolated values for zonally-oriented edges in this case. I had expected smoother results but it wasn't clear that that would mean higher zonal values.

@xylar
Copy link
Collaborator Author

xylar commented May 21, 2024

I'm going to try a case that's a little less extreme.

@xylar
Copy link
Collaborator Author

xylar commented May 21, 2024

the main thing I'm finding in idealized testing is that the new wind-stress reconstruction results in about twice as much stress at edges at land boundaries than the previous version

I believe this is a moot point. The normal velocity at edges adjacent to land is constrained to be zero (no flow into or out of land) so whatever wind stress gets computed at these edges won't be applied anyway.

@xylar
Copy link
Collaborator Author

xylar commented May 21, 2024

Same as above but for a factor of 32 higher frequency than the usual wind stress (rather than 128):

The zonal component at cell centers:
zonal_64

The normal component with anisotropic interpolation:
aniso_64

The normal component with isotropic interpolation:
iso_64

Analytic solution coming soon...

@xylar
Copy link
Collaborator Author

xylar commented May 22, 2024

Here's the comparison between the respective interpolation methods and the analytic solution computed directly at edges for the same wind-stress field plotted in my previous message.

anisotropic - analytic:
aniso_minus_analytic

isotropic - analytic:
iso_minus_analytic

@xylar
Copy link
Collaborator Author

xylar commented May 22, 2024

Ignoring land-adjacent edges, where the surface stress will be ignored, the error is much smaller with the anisotropic method, presumably because of the extra smoothing introduced by the isotropic method. But it seems like the error is on the order of a few percent for the isotropic case so I don't have any concerns that it isn't implemented correctly.

@cbegeman
Copy link
Collaborator

@xylar This is fantastic! Thanks so much for doing that verification test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants