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

Implemented the Noah-MP Land Surface Model #1161

Merged
merged 27 commits into from
Jun 13, 2024

Conversation

ldfowler58
Copy link
Contributor

This PR adds the implementation of the Noah-MP land surface model (LSM):

  • The sourcecode of the Noah-MP LSM was downloaded from the Noah-MP github repository and corresponds to the release-v5.0.1. It is located in the directory ./src/core_atmosphere/physics/physics_noahmp.

  • ./src/core_atmosphere/physics/Registry_noahmp.xml contains all the run options and variables needed to link the Noah-MP sourcecode to the MPAS physics framework.

  • ./src/core_atmosphere/physics/mpas_atmphys_lsm_noahmpinit.F includes the initialization of the Noah-MP LSM.

  • ./src/core_atmosphere/physics/mpas_atmphys_driver_lsm_noahmp.F is the main driver for the Noah-MP LSM.

@mgduda mgduda changed the base branch from master to develop April 16, 2024 02:43
@mgduda mgduda self-requested a review April 16, 2024 02:43
@ldfowler58 ldfowler58 force-pushed the NSF-MPAS/lsm_noahmp branch from 8d901a3 to ee904d2 Compare April 17, 2024 22:34
@mgduda mgduda changed the base branch from develop to master May 30, 2024 21:24
@mgduda mgduda changed the base branch from master to develop May 30, 2024 21:24
@mgduda
Copy link
Contributor

mgduda commented May 30, 2024

I think we may have discussed what to do about this before (apologies for my poor memory!), but we get a compilation error with recent GNU compilers:

RunoffSurfaceDynamicVicMod.F90:205:4:

  151 |                           goto 1003
      |                                   2
......
  205 | 1003                if ( DepthYTmp <= 0.0 ) DepthYTmp = 0.0
      |    1
Error: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)
RunoffSurfaceDynamicVicMod.F90:205:4:

  175 |                              goto 1003
      |                                      2
......
  205 | 1003                if ( DepthYTmp <= 0.0 ) DepthYTmp = 0.0
      |    1
Error: Legacy Extension: Label at (1) is not in the same block as the GOTO statement at (2)

Should we try to fix this locally (since we have a copy of the Noah-MP code) and separately feed a fix upstream to the Noah-MP repository?

ldfowler58 added 12 commits May 30, 2024 15:58
  The Noah-MP LSM sourcecode is copied from the Noah-MP github repository and corresponds
  to release-v5.0.1 (at hash 12a0b51aa52f6f5189525009ff249dfcbc95d29a), i.e.:

  commit 12a0b51aa52f6f5189525009ff249dfcbc95d29a
  Merge: 9fd80cb 843a742
  Author: Cenlin_He <cenlinhe@ucar.edu>
  Date:   Thu Jan 4 20:21:19 2024 -0700

    Merge pull request MPAS-Dev#108 from NCAR/develop
…physics_noahmp,

  modified sourcecode to compile the original Noah-MP sourcecode inside the MPAS
  framework:

  -> in ./physics_noahmp/utility, modified Machine.F90 to become dependent to
     mpas_kind_types.F.

  -> in ./physics_noahmp/utility, ./physics_noahmp/src, and ./physics_noahmp/drivers/hrldas,
     modified Makefile to compile Noah-MP inside the MPAS framework.

  -> in src/core_atmosphere/physics/physics_noahmp/drivers/hrldas/NoahmpDriverMainMod.F90,
     removed the WRF modules module_ra_gfdleta and module_data_gocart_dust.

  -> modified Makefile to compile all physics_noahmp subdirectories.
…p/parameters/NoahmpTable.TBL

  as we do for all the files in ./physics/physics_wrf. NoahmpTable.TBL is need to run the Noah-MP
  land surface scheme.
  -> in /physics_noahmp/drivers, renamed the directory hrldas to mpas.
  -> in Makefile, changed all instance of hrldas to mpas.
…ed all instances of the J dimension

  and all references to WRF-related dimensions.
… NoahmpIOVarFinalizeMod.F90

  to deallocate all arrays first allocated in NoahmpIOVarInitMod.F90. Modified Makefile accordingly.
…ic variables

  soilcomp, soilcl1, soilcl2, soilcl3, and soilcl4 needed to run the Noah-MP land
  surface scheme.
…he Noah-MP

  land surface scheme:

  -> added the Noah-MP Registry file ./physics/Registry_noahmp.xml to Registry.xml.
     That file includes all the extra arrays to run Noah-MP.

  -> in ./physics/mpas_atmphys_control.F, added the option sf_noahmp as an alternate
     to sf_noah.

  -> in ./physics/mpas_atmphys_manager.F, added the outputs month and day as outputs
     to mpas_get_time. month and day are needed in ./physics_noahmp.

  -> in ./physics/mpas_atmphys_packages, added the package sf_noahmp_in.
…DriverMainMod.F90,

  added print statements for NoahmpIO%itimestep and NoahmpIO%xice_threshold.
…InitMainMod.F90,

  remove the initialization of NoahmpIO%areaxy.
…IOVarFinalizeMod.F90,

  removed the sourcecode that initializes NoahmpIO variables since NoahmpIOVarFinalizeMod.F90
  is only called to deallocate variables at the end of forecasts.
  -> in Registry.xml, added Noahmp variables to the input and restart streams to run
     the Noah-MP land surface scheme.

  -> added ./physics/Registry_noahmp.xml which contains all the Noah-MP variables
     needed to run the Noah-MP land surface scheme.
@ldfowler58 ldfowler58 force-pushed the NSF-MPAS/lsm_noahmp branch from ee904d2 to 5a1154f Compare June 4, 2024 22:16
@ldfowler58
Copy link
Contributor Author

I modified RunoffSurfaceDynamicVicMod.F90 so that the file can be compiled with gcc/12.2.0. I am not entirely sure if the modified file breaks the logic of the sourcecode or not.

@mgduda mgduda self-requested a review June 5, 2024 21:34
Copy link
Contributor

@mgduda mgduda left a comment

Choose a reason for hiding this comment

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

Right now, we get quite a lot of output from Noah-MP-related code in every timestep:

 --- enter subroutine driver_lsm_noahmp:
 --- enter subroutine lsm_noahmp_fromMPAS: itimestep = 46
 --- enter subroutine lsm_noahmp_sounding_fromMPAS: 1
 --- end subroutine lsm_noahmp_sounding_fromMPAS:
 --- end subroutine lsm_noahmp_fromMPAS.
 
 --- enter subroutine NoahmpDriverMain:
 
 --- enter subroutine noahmpdrivermain:
 --- NoahmpIO%itimestep         = 46
 --- NoahmpIO%soiltstep         = 0.00000
 --- NoahmpIO%dtbl              = 360.000
 --- NoahmpIO%soil_update_steps = 1
 --- NoahmpIO%calculate_soil    = T
 
 --- NoahmpIO%isurban_table     = 13
 --- NoahmpIO%urbtype_beg       = 50
 --- NoahmpIO%sf_urban_physics  = 0
 --- NoahmpIO%iri_urban         = 0
 
 --- NoahmpIO%yearlen           = 365
 --- NoahmpIO%yr                = 2010
 --- NoahmpIO%month             = 10
 --- NoahmpIO%day               = 23
 --- NoahmpIO%julian            = 295.188
 --- NoahmpIO%xice_threshold    = 0.200000E-01
 
 --- enter subroutine lsm_noahmp_toMPAS:
 --- end subroutine lsm_noahmp_toMPAS:
 --- end subroutine driver_lsm_noahmp:

Most of this looks like it might have been used during development but could be removed now; what do you think?

@ldfowler58
Copy link
Contributor Author

modified sourcecode accordingly.

@ldfowler58 ldfowler58 force-pushed the NSF-MPAS/lsm_noahmp branch from a2ec120 to d38d793 Compare June 6, 2024 22:41
@ldfowler58
Copy link
Contributor Author

I rewinded the sourcecode to get back to the original sourcecode for RunoffSurfaceDynamicVicMod.F90. Also removed print statements that are printed to the logfiles during the initialization of Noah-MP. As we talked about, Michael will modify the flags used to compile Noah-MP so that we can run MPAS-Model with the latest versions of the gnu compiler with optimization.

Copy link
Contributor

@mgduda mgduda left a comment

Choose a reason for hiding this comment

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

I've just left a couple of additional small requests.

Otherwise, I'm working on some changes to deal with compilation failures with the GNU compilers.

  -> added mpas_atmphys_lsm_noahmpinit.F to initialize Noah-MP variables within
     the MPAS framework.

  -> added mpas_atmphys_driver_lsm_noahmp.F to run the Noah-MP land surface scheme
     within the MPAS framework.
  -> in mpas_atmphys_vars.F, added the structure mpas_noahmp of type NoahmIO_type
     that contains all the Noah-MP variables and arrays needed for Noah-MP to
     communicate with the MPAS physics.
  -> in mpas_atmphys_init.F, added call to init_lsm_noahmp to initialize Noah-MP.
  -> in mpas_atmphys_driver.F, added call to driver_lsm_noahmp to run Noah-MP.
  -> Modified Makefile accordingly.

  -> in ./../mpas_atm_core.F, modified call to physics_init to include the pools
     diag_physics_noahmp and output_noahmp.
…ument missing_value

  to the definition of Noah-MP variables. missing_value is set to -9999 for integer and
  -9999.0 to real variables, as defined in Machine.F90 used in Noah-MP.
…oved variables needed in

  the crop model. The crop model is currently not available and related variables are not
  used.
…removed variables needed

  in the ground water parameterization.The ground water model is currently not available and
  related variables are not used.
  -> in NoahmpInitMod.F90, removed the initialization of xland, xice, and
     xice_threshold, and move all three variables to ./physics.

  -> in NoahmpDriverMainMod.F90, rearranged print statements.
…added the

  initialization of xland to subroutine lsm_noahmp_fromMPAS.
  -> moved the variables soilcomp, soilcl1, soilcl2, and soilcl3 from the input stream
     to the invariant stream.
  -> added the variable soilcl4 to the input stream.
  -> in ./physics_noahmp/drivers/mpas/NoahmpDriverMainMod.F90, commented extra
     print statements.
  -> in mpas_atmphys_driver_lsm_noahmp.F, commented extra print statements.
…ed to run Noah-MP

  from the restart stream since they are available in the "invariant" stream and the
  invariant stream is included in the "restart" stream.
…mented extra

  print statements originally written during the initialization of Noah-MP.
…oved extra

  print statements before and after call to subroutine NoahmpInitMain.
@mgduda mgduda force-pushed the NSF-MPAS/lsm_noahmp branch from 5e3412e to 1b4a479 Compare June 13, 2024 19:10
@mgduda mgduda self-requested a review June 13, 2024 19:10
Copy link
Contributor

@mgduda mgduda left a comment

Choose a reason for hiding this comment

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

Although the model won't compile with the gnu build target at present, this can be addressed by a future PR.

@mgduda mgduda merged commit 8ecc35d into MPAS-Dev:develop Jun 13, 2024
@ldfowler58
Copy link
Contributor Author

Thanks for your help.

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.

2 participants