From f7105ca77b0318e7256458419cd2917a39c9cf82 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 28 Oct 2020 14:59:06 -0600 Subject: [PATCH 1/3] changed some code files to doxygen comments --- sorc/vcoord_gen.fd/driver.f90 | 1 + sorc/vcoord_gen.fd/matrix_utils.f90 | 102 ++++----- sorc/vcoord_gen.fd/vcoord_gen.f90 | 309 ++++++++++++++-------------- 3 files changed, 195 insertions(+), 217 deletions(-) diff --git a/sorc/vcoord_gen.fd/driver.f90 b/sorc/vcoord_gen.fd/driver.f90 index 39e9c0703..2e6969b36 100644 --- a/sorc/vcoord_gen.fd/driver.f90 +++ b/sorc/vcoord_gen.fd/driver.f90 @@ -1,3 +1,4 @@ +!> @file program driver implicit none integer levs,lupp,k diff --git a/sorc/vcoord_gen.fd/matrix_utils.f90 b/sorc/vcoord_gen.fd/matrix_utils.f90 index 003c9bbbf..e63c605e8 100644 --- a/sorc/vcoord_gen.fd/matrix_utils.f90 +++ b/sorc/vcoord_gen.fd/matrix_utils.f90 @@ -1,35 +1,25 @@ -!------------------------------------------------------------------------------- -!$$$ Subprogram documentation block +!> @file +!! Lower and upper triangular decomposition +!! @author Iredell @date 2008-08-01 ! -! Subprogram: ludcmp lower and upper triangular decomposition -! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01 -! -! Abstract: This subprogram decomposes a matrix into a product of -! lower and upper triangular matrices. -! -! Program history log: -! 2008-08-01 Mark Iredell -! -! Usage: call ludcmp(a,n,np,indx,d) -! Input argument list: -! a real(np,np) matrix (will be overwritten) -! n integer order of matrix -! np integer dimension of matrix -! -! Output argument list: -! a real(np,np) LU-decomposed matrix -! (U is upper part of A, including diagonal; -! L is lower part of A, with 1 as diagonal; -! L*U equals original A after permuting) -! indx integer(n) pivot indices -! (original A rows are permuted in order i with indx(i)) -! d real determinant permutation (1 or -1, or 0 if singular) -! (determinant is output diagonal product times d) -! -! Attributes: -! Language: Fortran 90 -! -!$$$ +!> This subprogram decomposes a matrix into a product of +!! lower and upper triangular matrices. +!! +!! Program history log: +!! - 2008-08-01 Mark Iredell +!! +!! @param[inout] - input: a real(np,np) matrix (will be overwritten) output: +!! - output real(np,np) LU-decomposed matrix +!! (U is upper part of A, including diagonal; +!! L is lower part of A, with 1 as diagonal; +!! L*U equals original A after permuting) +!! @param[in] n integer order of matrix +!! @param[in] np integer dimension of matrix +!! @param[out] indx integer(n) pivot indices +!! (original A rows are permuted in order i with indx(i)) +!! @param[out] d real determinant permutation (1 or -1, or 0 if singular) +!! (determinant is output diagonal product times d) +!! subroutine ludcmp(a,n,np,indx,d) implicit none integer,intent(in):: n,np @@ -95,36 +85,26 @@ subroutine ludcmp(a,n,np,indx,d) endif enddo end subroutine -!------------------------------------------------------------------------------- -!$$$ Subprogram documentation block -! -! Subprogram: lubksb lower and upper triangular back substitution -! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01 -! -! Abstract: This subprogram back substitutes to solve decomposed -! lower and upper triangular matrices as outputted by ludcmp. -! -! Program history log: -! 2008-08-01 Mark Iredell -! -! Usage: call lubksb(a,n,np,indx,b) -! Input argument list: -! a real(np,np) LU-decomposed matrix -! (from ludcmp) -! n integer order of matrix -! np integer dimension of matrix -! indx integer(n) pivot indices -! (from ludcmp) -! b real(n) rhs vector of linear problem (will be overwritten) -! -! Output argument list: -! b real(n) solution of linear problem -! (original A times output B equals original B) -! -! Attributes: -! Language: Fortran 90 -! -!$$$ + +!> Lower and upper triangular back substitution +!! @author Iredell @date 2008-08-01 +!! +!! This subprogram back substitutes to solve decomposed +!! lower and upper triangular matrices as outputted by ludcmp. +!! +!! Program history log: +!! - 2008-08-01 Mark Iredell +!! +!! Input argument list: +!! @param[in] a real(np,np) LU-decomposed matrix +!! (from ludcmp) +!! @param[in] n integer order of matrix +!! @param[in] np integer dimension of matrix +!! @param[in] indx integer(n) pivot indices (from ludcmp) +!! @param[inout] b - input real(n) rhs vector of linear problem (will be overwritten) +!! - output real(n) solution of linear problem +!! (original A times output B equals original B) +!! subroutine lubksb(a,n,np,indx,b) implicit none integer,intent(in):: n,np diff --git a/sorc/vcoord_gen.fd/vcoord_gen.f90 b/sorc/vcoord_gen.fd/vcoord_gen.f90 index 0a2aa2471..4a4f45c2d 100644 --- a/sorc/vcoord_gen.fd/vcoord_gen.f90 +++ b/sorc/vcoord_gen.fd/vcoord_gen.f90 @@ -1,160 +1,157 @@ -!$$$ Subprogram documentation block +!> @file +!! +!! vcoord_gen Generates hybrid coordinate interface profiles +!! @author Iredell @date 2008-08-01 ! -! Subprogram: vcoord_gen Generates hybrid coordinate interface profiles -! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01 -! -! Abstract: This subprogram generates hybrid coordinate interface profiles -! from a few given parameters. The hybrid coordinate is intended to start -! out at the bottom in pure sigma and end up at the top in pure pressure, -! with a smooth transition in between. The pressure thickness is close to -! quadratic in pressure, with maximum thicknesses in the middle of the domain. -! The coordinate pressure will have continuous second derivatives in level. -! -! The hybrid coordinate is returned in terms of vectors AK and BK, where -! the interface pressure is defined as A+B*ps where ps is surface pressure -! Thus A=0 in regions of pure sigma and B=0 in regions of pure sigma. -! At the bottom, A(0)=0 and B(0)=1 so that surface pressure is the bottom -! boundary condition, while at the top, A(levs)=ptop and B(levs)=0 so that -! the constant top pressure (which can be zero) is the top boundary condition. -! -! The procedure for the calculation is described in the remarks section below. -! -! Program history log: -! 2008-08-01 Mark Iredell -! -! Usage: call vcoord_gen(levs,lupp,pbot,psig,ppre,pupp,ptop,& -! dpbot,dpsig,dppre,dpupp,dptop,pmin,ak,bk) -! Input argument list: -! levs integer number of levels -! lupp integer number of levels below pupp -! pbot real nominal surface pressure (Pa) -! psig real nominal pressure where coordinate changes -! from pure sigma (Pa) -! ppre real nominal pressure where coordinate changes -! to pure pressure (Pa) -! pupp real nominal pressure where coordinate changes -! to upper atmospheric profile (Pa) -! ptop real pressure at top (Pa) -! dpbot real coordinate thickness at bottom (Pa) -! dpsig real thickness of zone within which coordinate changes -! to pure sigma (Pa) -! dppre real thickness of zone within which coordinate changes -! to pure pressure (Pa) -! dpupp real coordinate thickness at pupp (Pa) -! dptop real coordinate thickness at top (Pa) -! Output argument list: -! pmin real minimum surface pressure (Pa) -! ak real(0:levs) a coordinate values, bottom to top (Pa) -! bk real(0:levs) b coordinate values, bottom to top () -! -! Subprograms called: -! ludcmp lower and upper triangular decomposition -! lubksb lower and upper triangular back substitution -! -! Attributes: -! Language: Fortran 90 -! -! Remarks: -! Example: Create the operational GFS 64-level hybrid coordinate. -! real(8) pmin,ak(0:64),bk(0:64) -! call vcoord_gen(64,64,100000.,99400.,7000.,0.,0.,500.,1200.,18000.,60.,60.,& -! pmin,ak,bk) -! print '(2i6)',2,64 -! print '(f12.3,f12.8)',(ak(k),bk(k),k=0,64) -! end -! -! Graphical description of parameters and zones: -! ptop --- ----- ---------------------- -! ... dptop -! --- zone U (upper atmos) -! ... -! pupp --- ----- ---------------------- -! ... dpupp -! --- ----- -! ... zone P (pure pressure) -! --- -! ... -! ppre --- ----- ---------------------- -! ... -! --- dppre zone T1 (transition 1) -! ... -! --- ----- ---------------------- -! ... -! --- -! ... zone T2 (transition 2) -! --- -! ... -! --- ----- ---------------------- -! ... -! --- dpsig zone T3 (transition 3) -! ... -! psig --- ----- ---------------------- -! ... -! --- ----- zone S (pure sigma) -! ... dpbot -! pbot --- ----- ---------------------- -! -! Detailed procedure description: -! STEP 1. -! The pressure profile is computed with respect to the given reference -! surface pressure pbot. For this surface pressure, the 'sigma' thicknesses -! dsig are assumed to be proportional to a quadratic polynomial in sigma sig -! with zero intercepts sig1 and sig2 somewhere below and above the model -! domain, respectively. That is, -! dsig ~ (sig2-sig)*(sig-sig1)*dk -! Integrating this differential equation gives -! sig = (sig1*exp(c1*k+c2)+sig2)/(exp(c1*k+c2)+1) -! The required boundary conditions sig(0)=1 and sig(levs)=0 -! fix the proportionality and integration constants c1 and c2. -! The two crossing parameters (sig1 and sig2) are determined -! by two input sigma thickness conditions dsig/dk at the bottom and top -! which are respectively given as dpbot/(pbot-pupp) and dpupp/(pbot-pupp). -! The crossing parameters are computed using Newton-Raphson iteration. -! This procedure fixes the pressure profile for surface pressure pbot. -! STEP 2. -! The pressure profile is computed with respect to a minimum surface pressure. -! This minimum surface pressure pmin is yet to be determined. -! Divide the profile into zones: -! zone U (pure pressure) from pupp to ptop -! zone P (pure pressure) from pupp to ppre -! zone T1 (transition 1) from ppre to ppre+dppre -! zone T2 (transition 2) from ppre+dppre to psig-dpsig -! zone T3 (transition 3) from psig-dpsig to psig -! zone S (pure "sigma") from psig to pmin -! (here sigma=p/ps so that d(ln(p))/dk is horizontally uniform) -! The pressure profile in the pure pressure zone P is set from step 1. -! The pressure thicknesses in zone T1 is set to be quadratic in level k. -! The pressure thicknesses in zone T2 is set to be linear in level k. -! The pressure thicknesses in zone T3 is set to be quadratic in level k. -! The pressure profile in the pure sigma zone S is also set from step 1. -! Thus there are nine unknowns: -! the 3 polynomial coefficients in zone T1 -! the 2 polynomial coefficients in zone T2 -! the 3 polynomial coefficients in zone T3 -! and the 1 minimum surface pressure. -! The nine conditions to determine these unknowns are: -! the thickness and its derivative match at zone P and T1 boundary -! the thickness and its derivative match at zone T1 and T2 boundary -! the thickness and its derivative match at zone T2 and T3 boundary -! the thickness and its derivative match at zone T3 and S boundary -! the sum of the thicknesses of zones T1, T2, T3, and S is pmin-ppre -! The unknowns are computed using standard linear decomposition. -! This procedure fixes the pressure profile for surface pressure pmin. -! STEP 3. -! (Step 3 skipped if lupp=levs, in which case pupp=ptop and dpupp=dptop.) -! The pressure in zone U is assumed to be the exponential of a cubic -! polynomial in level k. The function must match the pressure at pupp, -! as well as the thickness and its derivative there, and the pressure -! at ptop+dptop at the second to top level. The latter 3 conditions -! are determined by using standard linear decomposition. -! STEP 4. -! For an arbitrary surface pressure, the pressure profile is an linear -! combination of the pressure profiles for surface pressures pbot and pmin -! p(psfc)=p(pbot)*(psfc-pmin)/(pbot-pmin)+p(pmin)*(pbot-psfc)/(pbot-pmin) -! from which the hybrid coordinate profiles ak and bk are found such that -! p(psfc)=ak+bk*psfc -! -!$$$ +!! This subprogram generates hybrid coordinate interface profiles +!! from a few given parameters. The hybrid coordinate is intended to start +!! out at the bottom in pure sigma and end up at the top in pure pressure, +!! with a smooth transition in between. The pressure thickness is close to +!! quadratic in pressure, with maximum thicknesses in the middle of the domain. +!! The coordinate pressure will have continuous second derivatives in level. +!! +!! The hybrid coordinate is returned in terms of vectors AK and BK, where +!! the interface pressure is defined as A+B*ps where ps is surface pressure +!! Thus A=0 in regions of pure sigma and B=0 in regions of pure sigma. +!! At the bottom, A(0)=0 and B(0)=1 so that surface pressure is the bottom +!! boundary condition, while at the top, A(levs)=ptop and B(levs)=0 so that +!! the constant top pressure (which can be zero) is the top boundary condition. +!! +!! The procedure for the calculation is described in the remarks section below. +!! +!! Program history log: +!! - 2008-08-01 Mark Iredell +!! +!! @param[in] levs integer number of levels +!! @param[in] lupp integer number of levels below pupp +!! @param[in] pbot real nominal surface pressure (Pa) +!! @param[in] psig real nominal pressure where coordinate changes +!! from pure sigma (Pa) +!! @param[in] ppre real nominal pressure where coordinate changes +!! to pure pressure (Pa) +!! @param[in] pupp real nominal pressure where coordinate changes +!! to upper atmospheric profile (Pa) +!! @param[in] ptop real pressure at top (Pa) +!! @param[in] dpbot real coordinate thickness at bottom (Pa) +!! @param[in] dpsig real thickness of zone within which coordinate changes +!! to pure sigma (Pa) +!! @param[in] dppre real thickness of zone within which coordinate changes +!! to pure pressure (Pa) +!! @param[in] dpupp real coordinate thickness at pupp (Pa) +!! @param[in] dptop real coordinate thickness at top (Pa) +!! @param[out] pmin real minimum surface pressure (Pa) +!! @param[out] ak real(0:levs) a coordinate values, bottom to top (Pa) +!! @param[out] bk real(0:levs) b coordinate values, bottom to top () +!! +!! Subprograms called: +!! - ludcmp lower and upper triangular decomposition +!! - lubksb lower and upper triangular back substitution +!! +!!
+!!   Example: Create the operational GFS 64-level hybrid coordinate.
+!!     real(8) pmin,ak(0:64),bk(0:64)
+!!     call vcoord_gen(64,64,100000.,99400.,7000.,0.,0.,500.,1200.,18000.,60.,60.,&
+!!                  pmin,ak,bk)
+!!     print '(2i6)',2,64
+!!     print '(f12.3,f12.8)',(ak(k),bk(k),k=0,64)
+!!     end
+!!
+!!   Graphical description of parameters and zones:
+!!     ptop  ---  -----  ----------------------
+!!           ...  dptop
+!!           ---         zone U (upper atmos)
+!!           ...
+!!     pupp  ---  -----  ----------------------
+!!           ...  dpupp
+!!           ---  -----
+!!           ...         zone P (pure pressure)
+!!           ---
+!!           ...
+!!     ppre  ---  -----  ----------------------
+!!           ...
+!!           ---  dppre  zone T1 (transition 1)
+!!           ...
+!!           ---  -----  ----------------------
+!!           ...
+!!           ---
+!!           ...         zone T2 (transition 2)
+!!           ---
+!!           ...
+!!           ---  -----  ----------------------
+!!           ...
+!!           ---  dpsig  zone T3 (transition 3)
+!!           ...
+!!     psig  ---  -----  ----------------------
+!!           ...
+!!           ---  -----  zone S (pure sigma)
+!!           ...  dpbot
+!!     pbot  ---  -----  ----------------------
+!! 
+!! +!! Detailed procedure description: +!! 1 STEP 1. +!! The pressure profile is computed with respect to the given reference +!! surface pressure pbot. For this surface pressure, the 'sigma' thicknesses +!! dsig are assumed to be proportional to a quadratic polynomial in sigma sig +!! with zero intercepts sig1 and sig2 somewhere below and above the model +!! domain, respectively. That is, +!! dsig ~ (sig2-sig)*(sig-sig1)*dk +!! Integrating this differential equation gives +!! sig = (sig1*exp(c1*k+c2)+sig2)/(exp(c1*k+c2)+1) +!! The required boundary conditions sig(0)=1 and sig(levs)=0 +!! fix the proportionality and integration constants c1 and c2. +!! The two crossing parameters (sig1 and sig2) are determined +!! by two input sigma thickness conditions dsig/dk at the bottom and top +!! which are respectively given as dpbot/(pbot-pupp) and dpupp/(pbot-pupp). +!! The crossing parameters are computed using Newton-Raphson iteration. +!! This procedure fixes the pressure profile for surface pressure pbot. +!! 2 STEP 2. +!! The pressure profile is computed with respect to a minimum surface pressure. +!! This minimum surface pressure pmin is yet to be determined. +!! Divide the profile into zones: +!! zone U (pure pressure) from pupp to ptop +!! zone P (pure pressure) from pupp to ppre +!! zone T1 (transition 1) from ppre to ppre+dppre +!! zone T2 (transition 2) from ppre+dppre to psig-dpsig +!! zone T3 (transition 3) from psig-dpsig to psig +!! zone S (pure "sigma") from psig to pmin +!! (here sigma=p/ps so that d(ln(p))/dk is horizontally uniform) +!! The pressure profile in the pure pressure zone P is set from step 1. +!! The pressure thicknesses in zone T1 is set to be quadratic in level k. +!! The pressure thicknesses in zone T2 is set to be linear in level k. +!! The pressure thicknesses in zone T3 is set to be quadratic in level k. +!! The pressure profile in the pure sigma zone S is also set from step 1. +!! Thus there are nine unknowns: +!! the 3 polynomial coefficients in zone T1 +!! the 2 polynomial coefficients in zone T2 +!! the 3 polynomial coefficients in zone T3 +!! and the 1 minimum surface pressure. +!! The nine conditions to determine these unknowns are: +!! the thickness and its derivative match at zone P and T1 boundary +!! the thickness and its derivative match at zone T1 and T2 boundary +!! the thickness and its derivative match at zone T2 and T3 boundary +!! the thickness and its derivative match at zone T3 and S boundary +!! the sum of the thicknesses of zones T1, T2, T3, and S is pmin-ppre +!! The unknowns are computed using standard linear decomposition. +!! This procedure fixes the pressure profile for surface pressure pmin. +!! 3 STEP 3. +!! (Step 3 skipped if lupp=levs, in which case pupp=ptop and dpupp=dptop.) +!! The pressure in zone U is assumed to be the exponential of a cubic +!! polynomial in level k. The function must match the pressure at pupp, +!! as well as the thickness and its derivative there, and the pressure +!! at ptop+dptop at the second to top level. The latter 3 conditions +!! are determined by using standard linear decomposition. +!! 4 STEP 4. +!! For an arbitrary surface pressure, the pressure profile is an linear +!! combination of the pressure profiles for surface pressures pbot and pmin +!!
+!!     p(psfc)=p(pbot)*(psfc-pmin)/(pbot-pmin)+p(pmin)*(pbot-psfc)/(pbot-pmin)
+!! 
+!! from which the hybrid coordinate profiles ak and bk are found such that +!!
+!!     p(psfc)=ak+bk*psfc
+!! 
+!! subroutine vcoord_gen(levs,lupp,pbot,psig,ppre,pupp,ptop,& dpbot,dpsig,dppre,dpupp,dptop,pmin,ak,bk) implicit none From c04850ee3ed2ebd0dc1f36d8054fca4c6bcf0340 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 28 Oct 2020 15:26:15 -0600 Subject: [PATCH 2/3] doxygen work --- sorc/sfc_climo_gen.fd/driver.F90 | 40 +++---- sorc/sfc_climo_gen.fd/interp.F90 | 28 ++--- sorc/sfc_climo_gen.fd/model_grid.F90 | 147 +++++++++--------------- sorc/sfc_climo_gen.fd/output.f90 | 43 +++---- sorc/sfc_climo_gen.fd/program_setup.f90 | 133 ++++++++++----------- sorc/sfc_climo_gen.fd/search.f90 | 47 +++----- sorc/sfc_climo_gen.fd/source_grid.F90 | 116 ++++++++----------- sorc/sfc_climo_gen.fd/utils.f90 | 3 +- sorc/vcoord_gen.fd/matrix_utils.f90 | 10 +- 9 files changed, 239 insertions(+), 328 deletions(-) diff --git a/sorc/sfc_climo_gen.fd/driver.F90 b/sorc/sfc_climo_gen.fd/driver.F90 index 5e5207190..8d06f1138 100644 --- a/sorc/sfc_climo_gen.fd/driver.F90 +++ b/sorc/sfc_climo_gen.fd/driver.F90 @@ -1,24 +1,22 @@ - program driver - -!------------------------------------------------------------------------- -! program documentation block -! -! Abstract: Reads static surface data on a global lat/lon grid, -! interpolates the data to the fv3 model grid, and outputs the -! result in netcdf format. -! -! Program execution is controlled by variables defined in the -! program configuration namelist (see module program_setup for -! details). -! -! Requires the following input files: -! 1) Model mosaic file (netcdf) -! 2) Model orography files (netcdf) -! 3) Model grid files (netcdf) -! 4) Source data file on global lat/lon grid (netcdf) -! -! Outputs surface data on the model tiles in netcdf format. -!------------------------------------------------------------------------- +!> @file +!! +!! Reads static surface data on a global lat/lon grid, +!! interpolates the data to the fv3 model grid, and outputs the +!! result in netcdf format. +!! +!! Program execution is controlled by variables defined in the +!! program configuration namelist (see module program_setup for +!! details). +!! +!! Requires the following input files: +!! 1) Model mosaic file (netcdf) +!! 2) Model orography files (netcdf) +!! 3) Model grid files (netcdf) +!! 4) Source data file on global lat/lon grid (netcdf) +!! +!! Outputs surface data on the model tiles in netcdf format. +!! + program driver use model_grid use source_grid diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index 41b59f916..f1822f03b 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -1,23 +1,15 @@ +!> @file +!! @author gayno @date 2018 +!! +!! Read the input source data and interpolate it to the +!! model grid. +!! +!! @param[in] input_flle filename of input source data. +!! @param[in] localpet this mpi task +!! @param[in] method interpolation method.defined where mask=1 +!! subroutine interp(localpet, method, input_file) -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: interp -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Read the input source data and interpolate it to the -! model grid. -! -! Usage: call interp(localpet, method, input_file) -! -! input argument list: -! input_flle filename of input source data. -! localpet this mpi task -! method interpolation method.defined where mask=1 -! -!----------------------------------------------------------------------- - use esmf use netcdf use model_grid diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index d86241556..fbd611772 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -1,46 +1,36 @@ +!> @file +!! Defines the model grid. +!! @author gayno @date 2018 +!! +!! ### Public Subroutines: +!! - define_model_grid Defines esmf grid object for the +!! model grid. +!! - model_grid_cleanup Free up memory used in this module. +!! +!! ### Public variables: +!! +!! Variables named with 'mdl' refer to the model grid. +!! +!! - data_field_mdl ESMF field object that holds the +!! data interpolated to model grid. +!! - grid_mdl ESMF grid object for the model grid. +!! - grid_tiles Array of model grid tile names. +!! - i/j_mdl i/j dimensions of model tile. +!! - latitude_field_mdl ESMF field object that holds the +!! model grid latitude +!! - longitude_field_mdl ESMF field object that holds the +!! model grid longitude +!! - mdl_field_mdl ESMF field object that holds the +!! model land mask. +!! - missing Value assigned to undefined points +!! (i.e., ocean points for a land +!! field). +!! - num_tiles Total number of model grid tiles. +!! - vegt_field_mdl ESMF field object that holds the +!! vegetation type on the model grid. +!! module model_grid -!-------------------------------------------------------------------------- -! module documentation block -! -! Module: model grid -! pgrmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Defines the model grid. -! -! Usage: use model_grid -! -! Public Subroutines: -! ------------------- -! define_model_grid Defines esmf grid object for the -! model grid. -! model_grid_cleanup Free up memory used in this module. -! -! Public variables: -! ----------------- -! -! Variables named with 'mdl' refer to the model grid. -! -! data_field_mdl ESMF field object that holds the -! data interpolated to model grid. -! grid_mdl ESMF grid object for the model grid. -! grid_tiles Array of model grid tile names. -! i/j_mdl i/j dimensions of model tile. -! latitude_field_mdl ESMF field object that holds the -! model grid latitude -! longitude_field_mdl ESMF field object that holds the -! model grid longitude -! mdl_field_mdl ESMF field object that holds the -! model land mask. -! missing Value assigned to undefined points -! (i.e., ocean points for a land -! field). -! num_tiles Total number of model grid tiles. -! vegt_field_mdl ESMF field object that holds the -! vegetation type on the model grid. -! -!----------------------------------------------------------------------- - use esmf implicit none @@ -63,24 +53,17 @@ module model_grid contains +!> define model grid +!! @author gayno @date 2018 +!! +!! Define the model grid from the mosaic and orography +!! files. Create the ESMF grid object for the model grid. +!! +!! @param[in] localpet this mpi task +!! @param[in] npets total number of mpi tasks +!! subroutine define_model_grid(localpet, npets) -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: define model grid -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Define the model grid from the mosaic and orography -! files. Create the ESMF grid object for the model grid. -! -! Usage: define_model_grid(localpet, npets) -! -! input argument list: -! localpet this mpi task -! npets total number of mpi tasks -!----------------------------------------------------------------------- - use esmf use netcdf use program_setup @@ -298,29 +281,20 @@ subroutine define_model_grid(localpet, npets) end subroutine define_model_grid +!> Get model information +!! @author gayno @date 2018 +!! +!! Read model land/sea mask and lat/lon from the orography file. +!! +!! @param[in] orog_file the orography file +!! @param[out] mask land/sea mask +!! @param[out] lat2d latitude +!! @param[out] lon2d longitude +!! @param[in] idim i dimension of the model tile +!! @param[in] jdim j dimension of the model tile +!! subroutine get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: get model information -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Read model land/sea mask and lat/lon from the orography file. -! -! Usage: call get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) -! -! input argument list: -! orog_file the orography file -! i/jdim i/j dimension of the model tile -! -! output argument list: -! mask land/sea mask -! lat2d latitude -! lon2d longitude -! -!----------------------------------------------------------------------- - use esmf use netcdf use utils @@ -418,20 +392,13 @@ subroutine get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) end subroutine get_model_info +!> model grid cleanup +!! @author gayno @date 2018 +!! +!! Free up memory associated with this module. +!! subroutine model_grid_cleanup -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: model grid cleanup -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Free up memory associated with this module. -! -! Usage: call model_grid_cleanup -! -!----------------------------------------------------------------------- - implicit none integer :: rc diff --git a/sorc/sfc_climo_gen.fd/output.f90 b/sorc/sfc_climo_gen.fd/output.f90 index 6055404d5..bd1e49fd8 100644 --- a/sorc/sfc_climo_gen.fd/output.f90 +++ b/sorc/sfc_climo_gen.fd/output.f90 @@ -1,31 +1,24 @@ +!> @file + +!> output +!! @author gayno @date 2018 +!! +!! Output model data for a single tile and a single +!! record in netcdf format. +!! +!! @param[in] data_one_tile Data to be output (single tile). +!! @param[in] lat_one_tile Latitude of tile. +!! @param[in] lon_one_tile Longitude of tile. +!! @param[in] field_idx Index of field within field name array. +!! @param[in] i_mdl i dimensions of tile. +!! @param[in] j_mdl j dimensions of tile. +!! @param[in] record Record number to be output. +!! @param[in] tile Tile number. +!! @param[in] time Time period to be output. +!! subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & tile, record, time, field_idx) -!-------------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: output -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Output model data for a single tile and a single -! record in netcdf format. -! -! Usage: call output(data_one_tile, lat_one_tile, lon_one_tile, & -! i_mdl, j_mdl, tile, record, & -! time, field_idx) -! -! input argument list: -! data_one_tile Data to be output (single tile). -! lat_one_tile Latitude of tile. -! lon_one_tile Longitude of tile. -! field_idx Index of field within field name -! array. -! i/j_mdl i/j dimensions of tile. -! record Record number to be output. -! tile Tile number. -! time Time period to be output. -!-------------------------------------------------------------------------- - use mpi use esmf use netcdf diff --git a/sorc/sfc_climo_gen.fd/program_setup.f90 b/sorc/sfc_climo_gen.fd/program_setup.f90 index 1cb59e6eb..a54e83059 100644 --- a/sorc/sfc_climo_gen.fd/program_setup.f90 +++ b/sorc/sfc_climo_gen.fd/program_setup.f90 @@ -1,63 +1,59 @@ +!> @file + +!> program setup +!! @author gayno @date 2018 +!! +!! Set up program execution +!! +!! Public Subroutines: +!! ------------------- +!! - read_setup_namelist Reads configuration namelist +!! +!! Public variables: +!! ----------------- +!! +!! Here 'input' indicates variables associated with the input source data +!! and 'mdl' indicates variables associated with the fv3 model grid. +!! +!! To not process a surface field, set its 'input_file' variable to NULL. +!! However, vegetation type must always be processed as it defines +!! landice points. +!! +!! - halo Number of row/cols defining the lateral +!! boundary halo. Used for regionanl +!! nests. +!! - input_facsf_file File containing input fractional +!! coverage data for strong zenith angle +!! dependent albedo. +!! - input_vegetation_greenness_ File containing input vegetation +!! - file greenness data. +!! - input_leaf_area_index_file File containing input leaf area index +!! data. +!! - input_maximum_snow_albedo_file File containing input maximum snow +!! albedo data. +!! - input_snowfree_albedo_file File containing input snow-free +!! albedo data. +!! - input_soil_type_file File containing input soil type data. +!! - input_slope_type_file File containing input slope type data. +!! - input_substrate_temperature_file File containing input soil substrate +!! temperature data. +!! - input_vegetation_type_file File containing input vegetation type data. +!! - leaf_area_index_method Interpolation method for leaf area index. +!! Conservative or bilinear (default). +!! - maximum snow albedo_method Interpolation method for max snow albedo. +!! Conservative or bilinear (default). +!! - mosaic_file_mdl Model grid mosaic file +!! - orog_dir_mdl Directory containing the model grid +!! orography files. +!! - orog_files_mdl Model grid orography filenames. +!! - snowfree_albedo_method Interpolation method for snowfree albedo. +!! Conservative or bilinear (default). +!! - vegetation_greenness_ Interpolation method for vegetation +!! - method greenness. Conservative or bilinear. +!! Default is bilinear. +!! module program_setup -!-------------------------------------------------------------------------- -! module documentation block -! -! Module: program setup -! pgrmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Set up program execution -! -! Usage: use program_setup -! -! Public Subroutines: -! ------------------- -! read_setup_namelist Reads configuration namelist -! -! Public variables: -! ----------------- -! -! Here 'input' indicates variables associated with the input source data -! and 'mdl' indicates variables associated with the fv3 model grid. -! -! To not process a surface field, set its 'input_file' variable to NULL. -! However, vegetation type must always be processed as it defines -! landice points. -! -! halo Number of row/cols defining the lateral -! boundary halo. Used for regionanl -! nests. -! input_facsf_file File containing input fractional -! coverage data for strong zenith angle -! dependent albedo. -! input_vegetation_greenness_ File containing input vegetation -! file greenness data. -! input_leaf_area_index_file File containing input leaf area index -! data. -! input_maximum_snow_albedo_ File containing input maximum snow -! file albedo data. -! input_snowfree_albedo_file File containing input snow-free -! albedo data. -! input_soil_type_file File containing input soil type data. -! input_slope_type_file File containing input slope type data. -! input_substrate_temperature_ File containing input soil substrate -! file temperature data. -! input_vegetation_type_file File containing input vegetation type data. -! leaf_area_index_method Interpolation method for leaf area index. -! Conservative or bilinear (default). -! maximum snow albedo_method Interpolation method for max snow albedo. -! Conservative or bilinear (default). -! mosaic_file_mdl Model grid mosaic file -! orog_dir_mdl Directory containing the model grid -! orography files. -! orog_files_mdl Model grid orography filenames. -! snowfree_albedo_method Interpolation method for snowfree albedo. -! Conservative or bilinear (default). -! vegetation_greenness_ Interpolation method for vegetation -! method greenness. Conservative or bilinear. -! Default is bilinear. -!-------------------------------------------------------------------------- - implicit none private @@ -86,22 +82,15 @@ module program_setup contains +!> read setup namelist +!! @author gayno @date 2018 +!! +!! Read program setup namelist +!! +!! @param[in] localpet mpi task number +!! subroutine read_setup_namelist(localpet) -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: read setup namelist -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Read program setup namelist -! -! Usage: call read_setup_namelist (localpet) -! -! input argument list: -! localpet mpi task number -!----------------------------------------------------------------------- - use mpi implicit none diff --git a/sorc/sfc_climo_gen.fd/search.f90 b/sorc/sfc_climo_gen.fd/search.f90 index f62cecc17..6813ab761 100644 --- a/sorc/sfc_climo_gen.fd/search.f90 +++ b/sorc/sfc_climo_gen.fd/search.f90 @@ -1,32 +1,23 @@ - subroutine search (field, mask, idim, jdim, tile, field_name) - -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: search -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Replace undefined values on the model grid with a valid -! value at a nearby neighbor. Undefined values are typically -! associated with isolated islands where there is no source data. -! Routine searches a neighborhood with a radius of 100 grid points. -! If no valid value is found, a default value is used. This -! routine works for one tile of a cubed sphere grid. It does -! not consider valid values at adjacent faces. That is a future -! upgrade. +!> @file +!! @author gayno @date 2018 ! -! Usage: call search (field, mask, idim, jdim, tile, field_name) -! -! input argument list: -! idim/jdim i/j dimensions of tile -! tile tile number -! mask field bitmap. field defined where mask=1 -! field_name field name -! field field before missing values are replaced -! -! output argment list: -! field field after missing values are replaced -!----------------------------------------------------------------------- +!> Replace undefined values on the model grid with a valid +!! value at a nearby neighbor. Undefined values are typically +!! associated with isolated islands where there is no source data. +!! Routine searches a neighborhood with a radius of 100 grid points. +!! If no valid value is found, a default value is used. This +!! routine works for one tile of a cubed sphere grid. It does +!! not consider valid values at adjacent faces. That is a future +!! upgrade. +!! +!! @param[in] idim/jdim i/j dimensions of tile +!! @param[in] tile tile number +!! @param[in] mask field bitmap. field defined where mask=1 +!! @param[in] field_name field name +!! @param[inout] field - input: field before missing values are replaced +!! - output: field after missing values are replaced +!! + subroutine search (field, mask, idim, jdim, tile, field_name) use mpi use esmf diff --git a/sorc/sfc_climo_gen.fd/source_grid.F90 b/sorc/sfc_climo_gen.fd/source_grid.F90 index ccca00b10..7058aa551 100644 --- a/sorc/sfc_climo_gen.fd/source_grid.F90 +++ b/sorc/sfc_climo_gen.fd/source_grid.F90 @@ -1,41 +1,35 @@ - module source_grid - -!-------------------------------------------------------------------------- -! module documentation block -! -! Module: source_grid -! pgrmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Read grid specs, date information and land/sea mask for -! the source data that will be interpolated to the model grid. -! Also, sets up the ESMF grid object for the source grid. -! Source grid is assumed to be global lat/lon. -! -! Usage: use source_grid -! -! Public Subroutines: -! ------------------- -! define_source_grid Defines esmf grid object for source -! grid. Retrieves date and field -! information from source file. -! source_grid_cleanup Free up memory used in this module. -! -! Public variables: -! ----------------- -! -! day_of_rec Day of each time record with -! respect to Jan 1. -! field_names Names of fields to be processed. -! grid_src ESMF grid object for the source grid. -! i/j_src i/j dimensions of the source grid. -! num_fields Number of fields in the file. Some -! files have more than one (ex: -! the 4-component albedo). -! num_records Number of fields times time records. -! num_time_recs Number of time records. -! source Original source of the data. -! -!------------------------------------------------------------------ +!> @file +!! @author gayno @date 2018 +!! +!! Read grid specs, date information and land/sea mask for +!! the source data that will be interpolated to the model grid. +!! Also, sets up the ESMF grid object for the source grid. +!! Source grid is assumed to be global lat/lon. +!! +!! Public Subroutines: +!! ------------------- +!! - define_source_grid() Defines esmf grid object for source +!! grid. Retrieves date and field +!! information from source file. +!! - source_grid_cleanup() Free up memory used in this module. +!! +!! Public variables: +!! ----------------- +!! +!! - day_of_rec Day of each time record with +!! respect to Jan 1. +!! - field_names Names of fields to be processed. +!! - grid_src ESMF grid object for the source grid. +!! - i_src i/j dimensions of the source grid. +!! - j_src i/j dimensions of the source grid. +!! - num_fields Number of fields in the file. Some +!! files have more than one (ex: +!! the 4-component albedo). +!! - num_records Number of fields times time records. +!! - num_time_recs Number of time records. +!! - source Original source of the data. +!! +module source_grid use esmf use utils @@ -59,26 +53,18 @@ module source_grid contains +!> define source grid +!! @author gayno @date 2018 +!! +!! Read date information from input source data file. +!! Create esmf grid object for the source grid. +!! +!! @param[in] localpet mpi task number +!! @param[in] npets total number mpi tasks +!! @param[in] input_file file containing the source grid data. +!! subroutine define_source_grid(localpet, npets, input_file) -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: define source grid -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Read date information from input source data file. -! Create esmf grid object for the source grid. -! -! Usage: call define_source_grid(localpet, npets, input_file) -! -! input argument list: -! localpet mpi task number -! npets total number mpi tasks -! input_file file containing the source grid data. -! -!----------------------------------------------------------------------- - use mpi use netcdf @@ -404,20 +390,14 @@ subroutine define_source_grid(localpet, npets, input_file) end subroutine define_source_grid +!> +!! source grid cleanup +!! @author gayno @date 2018 +!! +!! Free up memory associated with this module. +!! subroutine source_grid_cleanup -!----------------------------------------------------------------------- -! subroutine documentation block -! -! Subroutine: source grid cleanup -! prgmmr: gayno org: w/np2 date: 2018 -! -! Abstract: Free up memory associated with this module. -! -! Usage: call source_grid_cleanup -! -!----------------------------------------------------------------------- - implicit none integer :: rc diff --git a/sorc/sfc_climo_gen.fd/utils.f90 b/sorc/sfc_climo_gen.fd/utils.f90 index fe18a17dc..4c3e8ee7e 100644 --- a/sorc/sfc_climo_gen.fd/utils.f90 +++ b/sorc/sfc_climo_gen.fd/utils.f90 @@ -1,4 +1,5 @@ - module utils +!> @file +module utils private diff --git a/sorc/vcoord_gen.fd/matrix_utils.f90 b/sorc/vcoord_gen.fd/matrix_utils.f90 index e63c605e8..365cbdc89 100644 --- a/sorc/vcoord_gen.fd/matrix_utils.f90 +++ b/sorc/vcoord_gen.fd/matrix_utils.f90 @@ -8,11 +8,11 @@ !! Program history log: !! - 2008-08-01 Mark Iredell !! -!! @param[inout] - input: a real(np,np) matrix (will be overwritten) output: -!! - output real(np,np) LU-decomposed matrix -!! (U is upper part of A, including diagonal; -!! L is lower part of A, with 1 as diagonal; -!! L*U equals original A after permuting) +!! @param[inout] a - input: a real(np,np) matrix (will be overwritten) output: +!! - output real(np,np) LU-decomposed matrix +!! (U is upper part of A, including diagonal; +!! L is lower part of A, with 1 as diagonal; +!! L*U equals original A after permuting) !! @param[in] n integer order of matrix !! @param[in] np integer dimension of matrix !! @param[out] indx integer(n) pivot indices From 486df9f627d98a6c4673227aa5361c2a1e26fdfa Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 30 Oct 2020 10:33:53 -0400 Subject: [PATCH 3/3] Add build of ufs_utils on Gaea Updates to compile ufs_utils on Gaea using the HPC-stack. Issue #152 --- build_all.sh | 16 +++++------ modulefiles/build.gaea.intel | 22 +++++++++++++++ modulefiles/module-setup.sh.inc | 11 +++----- sorc/machine-setup.sh | 47 +++++++++++++++++++++++++-------- 4 files changed, 69 insertions(+), 27 deletions(-) create mode 100644 modulefiles/build.gaea.intel diff --git a/build_all.sh b/build_all.sh index 8b8ffade1..69666a831 100755 --- a/build_all.sh +++ b/build_all.sh @@ -9,7 +9,7 @@ export MOD_PATH if [[ "$target" == "linux.*" || "$target" == "macosx.*" ]]; then unset -f module set +x - source ./modulefiles/build.$target > /dev/null 2>&1 + source ./modulefiles/build.$target > /dev/null 2>&1 set -x else set +x @@ -20,21 +20,19 @@ else set -x fi -# --- Build all programs. -# - -rm -fr ./build -mkdir ./build -cd ./build - CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON" if [[ "$compiler" == "intel" ]]; then - if [[ "$target" != "wcoss_cray" && "$target" != "odin" ]]; then + if [[ "$target" != "wcoss_cray" && \ + "$target" != "gaea" && \ + "$target" != "odin" ]]; then CMAKE_FLAGS+=" -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc" fi fi +rm -fr ./build +mkdir ./build && cd ./build + cmake .. ${CMAKE_FLAGS} make -j 8 VERBOSE=1 diff --git a/modulefiles/build.gaea.intel b/modulefiles/build.gaea.intel new file mode 100644 index 000000000..04e177241 --- /dev/null +++ b/modulefiles/build.gaea.intel @@ -0,0 +1,22 @@ +#%Module##################################################### +## Build module for Gaea +############################################################# + +module switch intel/18.0.6.288 + +module load git/2.26.0 +module load cmake/3.17.0 + +# hpc-stack installed as a flat install at: +# /ncrc/home2/Rahul.Mahajan/dev/opt + +setenv ESMFMKFILE /ncrc/home2/Rahul.Mahajan/dev/opt/lib/esmf.mk + +prepend-path PATH /ncrc/home2/Rahul.Mahajan/dev/opt/bin +prepend-path CMAKE_PREFIX_PATH /ncrc/home2/Rahul.Mahajan/dev/opt +prepend-path LD_LIBRARY_PATH /ncrc/home2/Rahul.Mahajan/dev/opt/lib +prepend-path LD_LIBRARY_PATH /ncrc/home2/Rahul.Mahajan/dev/opt/lib64 + +setenv CMAKE_C_COMPIELR cc +setenv CMAKE_CXX_COMPIELR CC +setenv CMAKE_Fortran_COMPIELR ftn diff --git a/modulefiles/module-setup.sh.inc b/modulefiles/module-setup.sh.inc index 551381537..983f92898 100644 --- a/modulefiles/module-setup.sh.inc +++ b/modulefiles/module-setup.sh.inc @@ -48,7 +48,7 @@ elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then elif [[ -L /usrx && "$( readlink /usrx 2> /dev/null )" =~ dell ]] ; then # We are on NOAA Mars or Venus if ( ! eval module help > /dev/null 2>&1 ) ; then - source /usrx/local/prod/lmod/lmod/init/$__ms_shell + source /usrx/local/prod/lmod/lmod/init/$__ms_shell fi module purge elif [[ -d /glade ]] ; then @@ -58,7 +58,7 @@ elif [[ -d /glade ]] ; then fi module purge elif [[ -d /lustre && -d /ncrc ]] ; then - # We are on GAEA. + # We are on GAEA. if ( ! eval module help > /dev/null 2>&1 ) ; then # We cannot simply load the module command. The GAEA # /etc/profile modifies a number of module-related variables @@ -70,8 +70,9 @@ elif [[ -d /lustre && -d /ncrc ]] ; then else __ms_source_etc_profile=no fi + module purge > /dev/null 2>&1 module purge -# clean up after purge + # clean up after purge unset _LMFILES_ unset _LMFILES_000 unset _LMFILES_001 @@ -89,10 +90,6 @@ elif [[ -d /lustre && -d /ncrc ]] ; then if [[ -s /etc/opt/cray/pe/admin-pe/site-config ]] ; then source /etc/opt/cray/pe/admin-pe/site-config fi - export NCEPLIBS=/lustre/f1/pdata/ncep_shared/NCEPLIBS/lib - if [[ -d "$NCEPLIBS" ]] ; then - module use $NCEPLIBS/modulefiles - fi if [[ "$__ms_source_etc_profile" == yes ]] ; then source /etc/profile unset __ms_source_etc_profile diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index 6664446fe..81e2bf05f 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -22,7 +22,7 @@ USERNAME=`echo $LOGNAME | awk '{ print tolower($0)'}` if [[ -d /lfs3 ]] ; then # We are on NOAA Jet if ( ! eval module help > /dev/null 2>&1 ) ; then - echo load the module command 1>&2 + echo load the module command 1>&2 source /apps/lmod/lmod/init/$__ms_shell fi target=jet @@ -30,7 +30,7 @@ if [[ -d /lfs3 ]] ; then elif [[ -d /scratch1 ]] ; then # We are on NOAA Hera if ( ! eval module help > /dev/null 2>&1 ) ; then - echo load the module command 1>&2 + echo load the module command 1>&2 source /apps/lmod/lmod/init/$__ms_shell fi target=hera @@ -38,8 +38,8 @@ elif [[ -d /scratch1 ]] ; then elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then # We are on NOAA Luna or Surge if ( ! eval module help > /dev/null 2>&1 ) ; then - echo load the module command 1>&2 - source /opt/modules/default/init/$__ms_shell + echo load the module command 1>&2 + source /opt/modules/default/init/$__ms_shell fi target=wcoss_cray @@ -72,32 +72,57 @@ elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then elif [[ -L /usrx && "$( readlink /usrx 2> /dev/null )" =~ dell ]] ; then # We are on NOAA Venus or Mars if ( ! eval module help > /dev/null 2>&1 ) ; then - echo load the module command 1>&2 - source /usrx/local/prod/lmod/lmod/init/$__ms_shell + echo load the module command 1>&2 + source /usrx/local/prod/lmod/lmod/init/$__ms_shell fi target=wcoss_dell_p3 - module purge + module purge elif [[ -d /glade ]] ; then # We are on NCAR Cheyenne if ( ! eval module help > /dev/null 2>&1 ) ; then - echo load the module command 1>&2 + echo load the module command 1>&2 . /glade/u/apps/ch/opt/lmod/8.1.7/lmod/8.1.7/init/sh fi target=cheyenne module purge elif [[ -d /lustre && -d /ncrc ]] ; then - # We are on GAEA. + # We are on GAEA. if ( ! eval module help > /dev/null 2>&1 ) ; then # We cannot simply load the module command. The GAEA # /etc/profile modifies a number of module-related variables # before loading the module command. Without those variables, # the module command fails. Hence we actually have to source # /etc/profile here. - echo load the module command 1>&2 source /etc/profile + __ms_source_etc_profile=yes + else + __ms_source_etc_profile=no fi - target=gaea + module purge > /dev/null 2>&1 module purge +# clean up after purge + unset _LMFILES_ + unset _LMFILES_000 + unset _LMFILES_001 + unset LOADEDMODULES + module load modules + if [[ -d /opt/cray/ari/modulefiles ]] ; then + module use -a /opt/cray/ari/modulefiles + fi + if [[ -d /opt/cray/pe/ari/modulefiles ]] ; then + module use -a /opt/cray/pe/ari/modulefiles + fi + if [[ -d /opt/cray/pe/craype/default/modulefiles ]] ; then + module use -a /opt/cray/pe/craype/default/modulefiles + fi + if [[ -s /etc/opt/cray/pe/admin-pe/site-config ]] ; then + source /etc/opt/cray/pe/admin-pe/site-config + fi + if [[ "$__ms_source_etc_profile" == yes ]] ; then + source /etc/profile + unset __ms_source_etc_profile + fi + target=gaea elif [[ "$(hostname)" =~ "Orion" ]]; then target="orion" module purge