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

Routing Outlets in Boundary Conditions #827

Merged
merged 74 commits into from
Jul 10, 2024

Conversation

biljanaorescanin
Copy link
Contributor

@biljanaorescanin biljanaorescanin commented Sep 26, 2023

Boundary conditions produce river routing file with coupled grid runs. ( *.TRN)
Current problem: This file right from the package on develop now would have to be manually adjusted if we wanted to use it with GCM coupled runs. All routing outlets should end up in oceans but that is not the case with develop version.

This PR brings preprocessing tools used to create new “Outlet” file used during boundary conditions package runs to produce more correct river outlet information for coupled runs. Everyting will now end up in the ocean.

Once we conform this information we will add code changes to point and use “v2” of this Outlet file.

This PR is zero diff for AGCM but not zero diff for boundary conditions package.

This PR is related to issue: #681

@gmao-rreichle @sanAkel

@biljanaorescanin biljanaorescanin added 0 diff The changes in this pull request have verified to be zero-diff with the target branch. Non 0-diff The changes in this pull request are non-zero-diff labels Sep 26, 2023
@zyj8881357
Copy link

Boundary conditions produce river routing file with coupled grid runs. ( *.TRN) Current problem: This file right from the package on develop now would have to be manually adjusted if we wanted to use it with GCM coupled runs. All routing outlets should end up in oceans but that is not the case with develop version.

This PR brings preprocessing tools used to create new “Outlet” file used during boundary conditions package runs to produce more correct river outlet information for coupled runs. Everyting will now end up in the ocean.

Once we conform this information we will add code changes to point and use “v2” of this Outlet file.

This PR is zero diff for AGCM but not zero diff for boundary conditions package.

This PR is related to issue: #681

@gmao-rreichle @sanAkel

This version is only for 5 degree ocean grid.

@gmao-rreichle
Copy link
Contributor

@zyj8881357, @biljanaorescanin, thanks for putting this together. Here are a couple of initial thoughts after a very quick glance:

  1. We'll need a README file or some other form of documentation. With a couple of exceptions, all f90 files are programs, and the only documentation is in the file names, with no comments or instructions at all inside the files. This isn't sufficient for someone else to understand how to use the package to generate the outlet files.
  2. Re. your comment that this only works for the 5-deg ocean grid: I might not understand this correctly, but if the package is specific to a given ocean model grid and resolution, and presumably a very coarse resolution that is for testing purposes only, there aren't yet outlet files that would work with S2Sv3 or what's in development. Is this correct?
  3. Re. the previous item: My understanding is that the package first obtains the definition of the catchments on the raster grid and then determines the connection from each catchment to the ocean. This step should be independent of the ocean model resolution. The second step would then be to determine lat/lon values for the outlets that work with a particular ocean model grid and resolution. I suspect the existing f90 programs and ncl tools can be easily assigned to one of these two steps, and this separation is just a matter of documentation. If the package doesn't separate easily into sub-packages for the (ocean) resolution-independent step and the resolution-dependent steps, it should be modified so the package becomes modular in this way.
  4. Do we really want to produce (ocean) resolution-specific outlet files here, or would it be easier to stick with the current approach and have this package only produce a single outlet file with outlet lat/lon values that match the catchment raster file. The moving of the outlet lat/lon points into suitable ocean grid points (ie, the resolution-dependent step) could then be coded within the make_bcs package, where the *.TRN file is produced. The latter approach has the advantage of having the ocean model resolution information at hand as part of make_bcs processing. If the ocean model resolution is addressed within the present preproc package, it'd be harder to maintain consistency between the preproc package and make_bcs.

Not sure if this really makes sense, but it's a start for discussing how to move the PR forward.

@zyj8881357
Copy link

@zyj8881357, @biljanaorescanin, thanks for putting this together. Here are a couple of initial thoughts after a very quick glance:

1. We'll need a README file or some other form of documentation.  With a couple of exceptions, all f90 files are programs, and the only documentation is in the file names, with no comments or instructions at all inside the files.  This isn't sufficient for someone else to understand how to use the package to generate the outlet files.

2. Re. your comment that this only works for the 5-deg ocean grid:  I might not understand this correctly, but if the package is specific to a given ocean model grid and resolution, and presumably a very coarse resolution that is for testing purposes only, there aren't yet outlet files that would work with S2Sv3 or what's in development.  Is this correct?

3. Re. the previous item: My understanding is that the package first obtains the definition of the catchments on the raster grid and then determines the connection from each catchment to the ocean.  This step should be independent of the ocean model resolution.  The second step would then be to determine lat/lon values for the outlets that work with a particular ocean model grid and resolution.  I suspect the existing f90 programs and ncl tools can be easily assigned to one of these two steps, and this separation is just a matter of documentation.  If the package doesn't separate easily into sub-packages for the (ocean) resolution-independent step and the resolution-dependent steps, it should be modified so the package becomes modular in this way.

4. Do we really want to produce (ocean) resolution-specific outlet files here, or would it be easier to stick with the current approach and have this package only produce a single outlet file with outlet lat/lon values that match the catchment raster file.  The moving of the outlet lat/lon points into suitable ocean grid points (ie, the resolution-dependent step) could then be coded within the make_bcs package, where the *.TRN file is produced.  The latter approach has the advantage of having the ocean model resolution information at hand as part of make_bcs processing.  If the ocean model resolution is addressed within the present preproc package, it'd be harder to maintain consistency between the preproc package and make_bcs.

Not sure if this really makes sense, but it's a start for discussing how to move the PR forward.

@gmao-rreichle @biljanaorescanin @sanAkel
All the comments from Rolf have been addressed.

  1. A readme.txt has been added.
  2. Now the pre-processing package (GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/routing) only contains code to create the outlet locations in land. The moving from land to ocean is done by the mk_runofftbl.f90 in the mk_bcs package. The new mk_runofftbl.f90 (GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/mk_runofftbl.f90) is also included in this branch.
  3. The ocean resolution is not fixed or hard coded in the script. The new mk_runofftbl.f90 reads the ocean resolution that inputs to mk_bcs. It should work for any ocean resolution.

But the outlet locations have not been checked by Biljana or Santha. It should be tested before merging to the develop branch.

@gmao-rreichle
Copy link
Contributor

@zyj8881357, @biljanaorescanin: The software infrastructure of this package needs fixing up as follows:

  1. Use Cmake build instead of "build" bash script.
  2. Can we avoid adding the custom netcdf modules (rwncMod.F90, ncdioMod.F90) and use whatever is available in the GEOS environment?
  3. The "run.sh" script for Discover should be converted to python.

The above list is just a start, and I may be wrong on some or all of it. I'll defer to the SI team on what needs changing and how.
The SI team should be able to assist with these fixes.

@rdkoster @tclune @weiyuan-jiang

@sanAkel
Copy link
Contributor

sanAkel commented Nov 16, 2023

@zyj8881357, @biljanaorescanin: The software infrastructure of this package needs fixing up as follows:

  1. Use Cmake build instead of "build" bash script.

  2. Can we avoid adding the custom netcdf modules (rwncMod.F90, ncdioMod.F90) and use whatever is available in the GEOS environment?

  3. The "run.sh" script for Discover should be converted to python.

The above list is just a start, and I may be wrong on some or all of it. I'll defer to the SI team on what needs changing and how.

The SI team should be able to assist with these fixes.

@rdkoster @tclune @weiyuan-jiang

If you guys are stuck, let me know. Above seem straightforward to me.

… version arg in make_bcs_latlon.py and make_bcs_cube.py
@zyj8881357
Copy link

zyj8881357 commented Jun 21, 2024

@biljanaorescanin @gmao-rreichle I have added the version information in mk_runofftble.f90

I slightly changed the version links as follows:

bcs version --> Outlet lat/lon file version
v12 --> (new) v2 (produced with Yujin's pre-processing routines)
v11 --> (old) v1 (produced with Randy's old file)
otherwise --> n/a (produced with Randy's old file, but do not move outlet locations to ocean)

@biljanaorescanin
Copy link
Contributor Author

I've added v12; MOM6 created with v2 Outlet file to centralized location.
As expected only trn/TRN files differ to previous files.
For now I will host links until Santha confirms all works for him.
@sanAkel this should work for you directly from gcm_setup since we added v12 to it.
/discover/nobackup/projects/gmao/bcs_shared/fvInput/ExtData/esm/tiles/v12/geometry

Should I run MOM5 options as well? Do we have users who need v12 MOM5?

@gmao-rreichle
Copy link
Contributor

@zyj8881357:

otherwise --> n/a (produced with Randy's old file, but do not move outlet locations to ocean)

We should not produce routing files for any bcs other than v11 and v12. Some of the existing older bcs have custom-made routing files (manual intervention) that we cannot and do not want to replicate in make_bcs. Routing files generated with make_bcs will be in conflict with the existing custom-made routing files. That is, they should not be generated by make_bcs in the first place.

@zyj8881357
Copy link

zyj8881357 commented Jul 2, 2024 via email

@zyj8881357
Copy link

@gmao-rreichle I have fixed the problem. The program should work now.

@gmao-rreichle
Copy link
Contributor

@zyj8881357 , @biljanaorescanin :
The code now looks like it should work. The documentation needed cleaning up. Please double-check my latest commit.

@biljanaorescanin, please generate select v12 bcs to see if the results match those in the bcs_shared dir. If that works out, I think the PR is ready for Scott.

@biljanaorescanin: The [..]/bcs_shared/make_bcs_inputs/land/route/ directory may still need some cleanup. I don't understand why the there are "v1" files in the [..]/bcs_shared/make_bcs_inputs/land/route/ directory and then links to these files in the ./v1 subdirectory. Ideally, the files should all be inside the v1 subdirectory only. In this case, I don't think backward compatibility with older make_bcs versions matters. The older make_bcs versions don't produce sensible routing TRN files anyway.

@zyj8881357
Copy link

.

@gmao-rreichle The edit looks fine in your latest commit. Thank you!

@biljanaorescanin
Copy link
Contributor Author

biljanaorescanin commented Jul 5, 2024

@biljanaorescanin, please generate select v12 bcs to see if the results match those in the bcs_shared dir. If that works out, I think the PR is ready for Scott.

I've tested both v11 and v12 for MOM6 C90, C12 and C180 all are zero diff to what we had before.
PR is trivially zero diff for GCM, since all changes are boundary conditions and BVS preprocessing related no further testing is needed.

@sdrabenh this is ready for you . @zhaobin74 has tested for v12 MOM6 C90 coupled run.

@biljanaorescanin biljanaorescanin marked this pull request as ready for review July 5, 2024 13:40
@biljanaorescanin biljanaorescanin requested review from a team as code owners July 5, 2024 13:40
@biljanaorescanin biljanaorescanin added Not 0-diff for BCS and removed Non 0-diff The changes in this pull request are non-zero-diff labels Jul 5, 2024
@zhaobin74
Copy link
Contributor

Testing of coupled MOM6 at C180 with V12 BCS(and new outlets) also works.

@sdrabenh sdrabenh merged commit 8bfa81a into develop Jul 10, 2024
13 checks passed
@sdrabenh sdrabenh deleted the feature/yujinz/Routing_outlets_inBCS branch July 10, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 diff The changes in this pull request have verified to be zero-diff with the target branch. Not 0-diff for BCS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants