From 6df2ea7b57426725ea6ff8e57e5bed2769442f2f Mon Sep 17 00:00:00 2001 From: Rolf Reichle <54944691+gmao-rreichle@users.noreply.github.com> Date: Tue, 14 Sep 2021 12:59:57 -0400 Subject: [PATCH] Merge BRIDGE into main in prep for release v17.9.5 (#448) - Zero-diff vs. v17.9.3 for model-only simulations without perturbations using a build with standard optimization. - Not zero-diff for simulations with perturbations (including data assimilation) or any simulation using a build with aggressive optimization. - Science changes: - Added S2S/AODAS and S2S/Forecast surface met forcing reader. - Infrastructure: - Parallel FFT on each node using shared memory (non-zero-diff change for perturbations and data assimilation). - Refined assignment of tiles to processors (non-zero-diff change with aggressive optimization). - By default, limit MKL's freedom to choose algorithms during runtime (MKL_CBWR=AVX2), to ensure 0-diff across architectures. - Updated ESMA_env (v3.3.0) --> Baselibs (6.2.4), ESMA_cmake (v3.5.0). - Updated GMAO_Shared (v1.4.4). - Updated GEOSgcm_GridComp (v1.12.3). - Documentation: - Clarified help text for RESTART option in ldas_setup. - Bug fixes and other minor changes: - Minor fixes to support debugging and non-Intel compilers (GNU). --- .circleci/config.yml | 42 ++- CMakeLists.txt | 5 +- LICENSE.md | 248 +++++++++++++++++- components.yaml | 8 +- doc/CHANGELOG.md | 22 ++ src/Applications/LDAS_App/ldas_setup | 2 +- src/Applications/LDAS_App/lenkf.j.template | 2 + .../GEOSmetforce_GridComp/LDAS_Forcing.F90 | 97 +++---- 8 files changed, 357 insertions(+), 69 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a47714c7..e19d41ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,9 @@ version: 2.1 executors: - gcc-build-env: + gfortran-large: docker: - - image: gmao/ubuntu20-geos-env-mkl:v6.2.4-openmpi_4.0.5-gcc_10.3.0 + - image: gmao/ubuntu20-geos-env-mkl:v6.2.7-openmpi_4.0.6-gcc_11.2.0 auth: username: $DOCKERHUB_USER password: $DOCKERHUB_AUTH_TOKEN @@ -14,24 +14,39 @@ executors: resource_class: large #MEDIUM# resource_class: medium + ifort-large: + docker: + - image: gmao/ubuntu20-geos-env:v6.2.7-intelmpi_2021.2.0-intel_2021.2.0 + auth: + username: $DOCKERHUB_USER + password: $DOCKERHUB_AUTH_TOKEN + resource_class: large + #MEDIUM# resource_class: medium + workflows: - version: 2.1 build-test: jobs: - build-GEOSldas: + name: build-GEOSldas-on-<< matrix.compiler >> + matrix: + parameters: + compiler: [gfortran, ifort] context: - docker-hub-creds jobs: build-GEOSldas: - executor: gcc-build-env + parameters: + compiler: + type: string + executor: << parameters.compiler >>-large working_directory: /root/project steps: - checkout: path: GEOSldas - run: name: "Versions etc" - command: mpirun --version && gfortran --version && echo $BASEDIR && pwd && ls + command: mpirun --version && << parameters.compiler>> --version && echo $BASEDIR && pwd && ls - run: name: "Mepo clone external repos" command: | @@ -51,13 +66,16 @@ jobs: - run: name: "CMake" command: | + mkdir -p /logfiles cd ${CIRCLE_WORKING_DIRECTORY}/GEOSldas - mkdir build - cd build - cmake .. -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF + mkdir -p ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSldas + cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSldas + cmake ${CIRCLE_WORKING_DIRECTORY}/GEOSldas -DBASEDIR=$BASEDIR/Linux -DCMAKE_Fortran_COMPILER=<< parameters.compiler >> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CIRCLE_WORKING_DIRECTORY}/workspace/install-GEOSldas -DUSE_F2PY=OFF |& tee /logfiles/cmake.log - run: - name: "Build" + name: "Build and install" command: | - cd ${CIRCLE_WORKING_DIRECTORY}/GEOSldas/build - make -j"$(nproc)" install - #MEDIUM# make -j4 install + cd ${CIRCLE_WORKING_DIRECTORY}/workspace/build-GEOSldas + make -j"$(nproc)" install |& tee /logfiles/make.log + #MEDIUM# make -j4 install |& tee /logfiles/make.log + - store_artifacts: + path: /logfiles diff --git a/CMakeLists.txt b/CMakeLists.txt index ef8cb709..527ae025 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + "Debug" "Release" "Aggressive") endif () set (DOING_GEOS5 YES) @@ -53,4 +53,5 @@ install( DESTINATION ${CMAKE_INSTALL_PREFIX} ) - +# Adds abiilty to tar source +include (esma_cpack) diff --git a/LICENSE.md b/LICENSE.md index 80be6d7f..b0277a69 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,9 @@ ``` -Copyright (c) 2003-2018 United States Government as represented by -the Admistrator of the National Aeronautics and Space Administration. -All Rights Reserved. + + NASA OPEN SOURCE SOFTWARE AGREEMENT + + +NASA OPEN SOURCE AGREEMENT VERSION 1.3 THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN @@ -19,5 +21,243 @@ Government Agency Original Software Designation: GSC-15354-1 Government Agency Original Software Title: GEOS-5 GCM Modeling Software User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov Government Agency Point of Contact for Original Software: - Dale Hithon, SRA Assistant, (301) 286-2691 + Dale Hithon, SRA Assistant, (301) 286-2691 + +1. DEFINITIONS + +A. "Contributor" means Government Agency, as the developer of the +Original Software, and any entity that makes a Modification. + +B. "Covered Patents" mean patent claims licensable by a Contributor +that are necessarily infringed by the use or sale of its Modification +alone or when combined with the Subject Software. + +C. "Display" means the showing of a copy of the Subject Software, +either directly or by means of an image, or any other device. + +D. "Distribution" means conveyance or transfer of the Subject Software, +regardless of means, to another. + +E. "Larger Work" means computer software that combines Subject +Software, or portions thereof, with software separate from the Subject +Software that is not governed by the terms of this Agreement. + +F. "Modification" means any alteration of, including addition to +or deletion from, the substance or structure of either the Original +Software or Subject Software, and includes derivative works, as that +term is defined in the Copyright Statute, 17 USC 101. However, the act +of including Subject Software as part of a Larger Work does not in and +of itself constitute a Modification. + +G. "Original Software" means the computer software first released under +this Agreement by Government Agency with Government Agency designation +GSC-15354-1 and entitled GEOS-5 GCM Modeling Software, including source +code, object code and accompanying documentation, if any. + +H. "Recipient" means anyone who acquires the Subject Software under +this Agreement, including all Contributors. + +I. "Redistribution" means Distribution of the Subject Software after a +Modification has been made. + +J. "Reproduction" means the making of a counterpart, image or copy of +the Subject Software. + +K. "Sale" means the exchange of the Subject Software for money or +equivalent value. + +L. "Subject Software" means the Original Software, Modifications, or +any respective parts thereof. + +M. "Use" means the application or employment of the Subject Software +for any purpose. + + + +2. GRANT OF RIGHTS + +A. Under Non-Patent Rights: Subject to the terms and conditions of this +Agreement, each Contributor, with respect to its own contribution to +the Subject Software, hereby grants to each Recipient a non-exclusive, +world-wide, royalty-free license to engage in the following activities +pertaining to the Subject Software: + +1. Use +2. Distribution +3. Reproduction +4. Modification +5. Redistribution +6. Display + +B. Under Patent Rights: Subject to the terms and conditions of this +Agreement, each Contributor, with respect to its own contribution to +the Subject Software, hereby grants to each Recipient under Covered +Patents a non-exclusive, world-wide, royalty-free license to engage in +the following activities pertaining to the Subject Software: + +1. Use +2. Distribution +3. Reproduction +4. Sale +5. Offer for Sale + +C. The rights granted under Paragraph B. also apply to the combination +of a Contributor's Modification and the Subject Software if, at the +time the Modification is added by the Contributor, the addition of +such Modification causes the combination to be covered by the Covered +Patents. It does not apply to any other combinations that include a +Modification. + +D. The rights granted in Paragraphs A. and B. allow the Recipient to +sublicense those same rights. Such sublicense must be under the same +terms and conditions of this Agreement. + + +3. OBLIGATIONS OF RECIPIENT + +A. Distribution or Redistribution of the Subject Software must be made +under this Agreement except for additions covered under paragraph 3H. + +1. Whenever a Recipient distributes or redistributes the Subject +Software, a copy of this Agreement must be included with each copy of +the Subject Software; and + +2. If Recipient distributes or redistributes the Subject Software in +any form other than source code, Recipient must also make the source +code freely available, and must provide with each copy of the Subject +Software information on how to obtain the source code in a reasonable +manner on or through a medium customarily used for software exchange. + +B. Each Recipient must ensure that the following copyright notice +appears prominently in the Subject Software: + +Copyright © 2003-2018 United States Government as represented by the +Administrator of the National Aeronautics and Space Administration. All +Rights Reserved. + +C. Each Contributor must characterize its alteration of the Subject +Software as a Modification and must identify itself as the originator +of its Modification in a manner that reasonably allows subsequent +Recipients to identify the originator of the Modification. In +fulfillment of these requirements, Contributor must include a file +(e.g., a change log file) that describes the alterations made and +the date of the alterations, identifies Contributor as originator of +the alterations, and consents to characterization of the alterations +as a Modification, for example, by including a statement that the +Modification is derived, directly or indirectly, from Original Software +provided by Government Agency. Once consent is granted, it may not +thereafter be revoked. + +D. A Contributor may add its own copyright notice to the Subject +Software. Once a copyright notice has been added to the Subject +Software, a Recipient may not remove it without the express permission +of the Contributor who added the notice. + +E. A Recipient may not make any representation in the Subject Software +or in any promotional, advertising or other material that may be +construed as an endorsement by Government Agency or by any prior +Recipient of any product or service provided by Recipient, or that may +seek to obtain commercial advantage by the fact of Government Agency's +or a prior Recipient's participation in this Agreement. + +F. In an effort to track usage and maintain accurate records of +the Subject Software, each Recipient, upon receipt of the Subject +Software, is requested to register with Government Agency by visiting +the following website: http://opensource.gsfc.nasa.gov. Recipient's +name and personal information shall be used for statistical purposes +only. Once a Recipient makes a Modification available, it is requested +that the Recipient inform Government Agency at the web site provided +above how to access the Modification. + +G. Each Contributor represents that its Modification is believed to +be Contributor's original creation and does not violate any existing +agreements, regulations, statutes or rules, and further that Contributor +has sufficient rights to grant the rights conveyed by this Agreement. + +H. A Recipient may choose to offer, and to charge a fee for, warranty, +support, indemnity and/or liability obligations to one or more other +Recipients of the Subject Software. A Recipient may do so, however, +only on its own behalf and not on behalf of Government Agency or any +other Recipient. Such a Recipient must make it absolutely clear that +any such warranty, support, indemnity and/or liability obligation is +offered by that Recipient alone. Further, such Recipient agrees to +indemnify Government Agency and every other Recipient for any liability +incurred by them as a result of warranty, support, indemnity and/or +liability offered by such Recipient. + +I. A Recipient may create a Larger Work by combining Subject Software +with separate software not governed by the terms of this agreement +and distribute the Larger Work as a single product. In such case, the +Recipient must make sure Subject Software, or portions thereof, included +in the Larger Work is subject to this Agreement. + +J. Notwithstanding any provisions contained herein, Recipient is hereby +put on notice that export of any goods or technical data from the United +States may require some form of export license from the U.S. Government. +Failure to obtain necessary export licenses may result in criminal +liability under U.S. laws. Government Agency neither represents that a +license shall not be required nor that, if required, it shall be issued. +Nothing granted herein provides any such export license. + +4. DISCLAIMER OF WARRANTIES AND LIABILITIES; WAIVER AND INDEMNIFICATION + +A. No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT +ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, +INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SUBJECT +SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM +INFRINGEMENT, ANY WARRANTY THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, +OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED, WILL CONFORM TO THE +SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN +ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, +RESULTING DESIGNS, HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS +RESULTING FROM USE OF THE SUBJECT SOFTWARE. FURTHER, GOVERNMENT AGENCY +DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING THIRD-PARTY SOFTWARE, +IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS." + +B. Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL +CLAIMS AGAINST THE UNITED STATES GOVERNMENT, ITS CONTRACTORS AND +SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF RECIPIENT'S USE +OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, +EXPENSES OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM +PRODUCTS BASED ON, OR RESULTING FROM, RECIPIENT'S USE OF THE SUBJECT +SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE UNITED STATES +GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR +RECIPIENT, TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR +ANY SUCH MATTER SHALL BE THE IMMEDIATE, UNILATERAL TERMINATION OF THIS +AGREEMENT. + +5. GENERAL TERMS + +A. Termination: This Agreement and the rights granted hereunder will +terminate automatically if a Recipient fails to comply with these terms +and conditions, and fails to cure such noncompliance within thirty +(30) days of becoming aware of such noncompliance. Upon termination, +a Recipient agrees to immediately cease use and distribution of the +Subject Software. All sublicenses to the Subject Software properly +granted by the breaching Recipient shall survive any such termination of +this Agreement. + +B. Severability: If any provision of this Agreement is invalid or +unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement. + +C. Applicable Law: This Agreement shall be subject to United States +federal law only for all purposes, including, but not limited to, +determining the validity of this Agreement, the meaning of its +provisions and the rights, obligations and remedies of the parties. + +D. Entire Understanding: This Agreement constitutes the entire +understanding and agreement of the parties relating to release of the +Subject Software and may not be superseded, modified or amended except +by further written agreement duly executed by the parties. + +E. Binding Authority: By accepting and using the Subject Software under +this Agreement, a Recipient affirms its authority to bind the Recipient +to all terms and conditions of this Agreement and that that Recipient +hereby agrees to all terms and conditions herein. + +F. Point of Contact: Any Recipient contact with Government Agency is to +be directed to the designated representative as follows: Dale Hithon, +SRA Assistant, (301) 286-2691. ``` diff --git a/components.yaml b/components.yaml index fa460442..dad0962b 100644 --- a/components.yaml +++ b/components.yaml @@ -9,7 +9,7 @@ env: cmake: local: ./@cmake remote: ../ESMA_cmake.git - tag: v3.5.0 + tag: v3.5.5 ecbuild: local: ./@cmake/@ecbuild @@ -20,15 +20,15 @@ GMAO_Shared: local: ./src/Shared/@GMAO_Shared remote: ../GMAO_Shared.git sparse: ./config/GMAO_Shared.sparse - tag: v1.4.4 + tag: v1.4.6 MAPL: local: ./src/Shared/@MAPL remote: ../MAPL.git - tag: v2.7.0 + tag: v2.8.6 GEOSgcm_GridComp: local: ./src/Components/GEOSldas_GridComp/@GEOSgcm_GridComp remote: ../GEOSgcm_GridComp.git sparse: ./config/GEOSgcm_GridComp_ldas.sparse - tag: v1.12.3 + tag: v1.12.4 diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 646c2b7d..b6915fee 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -32,6 +32,28 @@ This README file contains the history of stable GEOSldas versions ("tags") in Gi Overview of Git Releases: ============================ +[v17.9.5](https://github.com/GEOS-ESM/GEOSldas/releases/tag/v17.9.5) - 2021-09-14 +------------------------------ + +- Zero-diff vs. v17.9.4. + +- Science changes: + - For GEOS-FP and MERRA-2 forcing, corrected precipitation can be on a different grid than rest of forcing data. + +- Infrastructure: + - Updated MAPL (v2.8.6, support for bit shaving of binary HISTORY output). + - Updated ESMA_cmake (v3.5.5). + - Updated GMAO_Shared (v1.4.6). + - Updated GEOSgcm_GridComp (v1.12.4, minor change for LADAS coupling). + - Support for build of tarball of source code. + - Updated Circle-CI. + +- Bug fixes and other minor changes: + - Minor fixes for GNU compiler. + - Updated LICENSE.md. + - Fixed PAR handling in get_GEOSs2s(). + +------------------------------ [v17.9.4](https://github.com/GEOS-ESM/GEOSldas/releases/tag/v17.9.4) - 2021-07-15 ------------------------------ diff --git a/src/Applications/LDAS_App/ldas_setup b/src/Applications/LDAS_App/ldas_setup index e64f6f65..d2963d48 100755 --- a/src/Applications/LDAS_App/ldas_setup +++ b/src/Applications/LDAS_App/ldas_setup @@ -205,7 +205,7 @@ class LDASsetup: self.rqdExeInp['NUM_SGMT'] = 1 # hard set NUM_SGMT and NUM_SGMT if (self.ladas_coupling > 0) : - if self.rqdExeInp['NUM_SGMT'] != 1 : + if int(self.rqdExeInp['NUM_SGMT']) != 1 : sys.exit("'NUM_SGMT' should be set to 1 with LADAS_COUPLING") if self.rqdExeInp['JOB_SGMT'] != "00000000 060000" : sys.exit("'JOB_SGMT' should be set to 00000000 060000 with LADAS_COUPLING") diff --git a/src/Applications/LDAS_App/lenkf.j.template b/src/Applications/LDAS_App/lenkf.j.template index 34152276..aa71121d 100644 --- a/src/Applications/LDAS_App/lenkf.j.template +++ b/src/Applications/LDAS_App/lenkf.j.template @@ -28,6 +28,8 @@ setenv EXPDOMAIN MY_EXPDOMAIN setenv EXPDIR MY_EXPDIR setenv ESMADIR $EXPDIR/build/ setenv GEOSBIN $ESMADIR/bin/ +# need to unsetenv LD_LIBRARY_PATH for execution of LDAS within the coupled land-atm DAS +unsetenv LD_LIBRARY_PATH source $GEOSBIN/g5_modules setenv I_MPI_DAPL_UD enable diff --git a/src/Components/GEOSldas_GridComp/GEOSmetforce_GridComp/LDAS_Forcing.F90 b/src/Components/GEOSldas_GridComp/GEOSmetforce_GridComp/LDAS_Forcing.F90 index ade212ef..2da6caca 100755 --- a/src/Components/GEOSldas_GridComp/GEOSmetforce_GridComp/LDAS_Forcing.F90 +++ b/src/Components/GEOSldas_GridComp/GEOSmetforce_GridComp/LDAS_Forcing.F90 @@ -307,7 +307,7 @@ subroutine get_forcing( date_time, force_dtstep, met_path, met_tag, & elseif (index(met_tag(1:7), 'GEOSs2s')/=0) then call get_GEOSs2s( date_time_tmp, met_path, met_tag, N_catd, tile_coord, & - MET_HINTERP, met_force_obs_tile_new, nodata_forcing) + MET_HINTERP, met_force_obs_tile_new, nodata_forcing, PAR_available) else ! assume forcing from GEOS5 GCM ("DAS" or "MERRA") output @@ -2606,7 +2606,7 @@ end subroutine get_Viviana_OK_precip ! ************************************************************************ subroutine get_GEOSs2s(date_time, met_path, met_tag, N_catd, tile_coord, & - met_hinterp, met_force_new, nodata_forcing) + met_hinterp, met_force_new, nodata_forcing, PAR_available) ! read forcing derived from GEOS S2S output and map to tile space ! (using nearest neighbor or bilinear interpolation) @@ -2641,6 +2641,8 @@ subroutine get_GEOSs2s(date_time, met_path, met_tag, N_catd, tile_coord, & real, intent(out) :: nodata_forcing + logical, intent(out) :: PAR_available + ! Hindcast grid and netcdf parameters integer, parameter :: GEOSgcm_grid_N_lon = 576 @@ -2692,7 +2694,7 @@ subroutine get_GEOSs2s(date_time, met_path, met_tag, N_catd, tile_coord, & character(40), dimension(:), allocatable :: GEOSgcm_name - integer :: N_GEOSgcm_vars, dt_GEOSgcm_in_hours + integer :: N_GEOSgcm_vars, dt_GEOSgcm_in_hours, N_lon_tmp, N_lat_tmp real :: fnbr(2,2) @@ -2733,7 +2735,8 @@ subroutine get_GEOSs2s(date_time, met_path, met_tag, N_catd, tile_coord, & if (index(met_tag(8:11), 'FCST')/=0) then - FCST = .true. + FCST = .true. + PAR_available = .true. dt_GEOSgcm_in_hours = dt_GEOSgcm_in_hours_FCST N_GEOSgcm_vars = N_GEOSgcm_vars_FCST @@ -2749,7 +2752,8 @@ subroutine get_GEOSs2s(date_time, met_path, met_tag, N_catd, tile_coord, & elseif (index(met_tag(8:12), 'AODAS')/=0) then - AODAS = .true. + AODAS = .true. + PAR_available = .false. dt_GEOSgcm_in_hours = dt_GEOSgcm_in_hours_AODAS N_GEOSgcm_vars = N_GEOSgcm_vars_AODAS @@ -2833,24 +2837,27 @@ subroutine get_GEOSs2s(date_time, met_path, met_tag, N_catd, tile_coord, & do GEOSgcm_var = 1,N_GEOSgcm_vars - if (GEOSgcm_var==1) then - ! init share memory - if( (size(ptrShForce,1) /= GEOSgcm_grid_N_lon) .or. & - (size(ptrShForce,2) /= GEOSgcm_grid_N_lat) ) then - call MAPL_SyncSharedMemory(rc=status) - VERIFY_(status) - if (associated(ptrShForce)) then - call MAPL_DeallocNodeArray(ptrShForce,rc=status) - VERIFY_(status) - endif - call MAPL_AllocateShared(ptrShForce,(/GEOSgcm_grid_N_lon,GEOSgcm_grid_N_lat/),TransRoot= .true.,rc=status) - VERIFY_(status) - call MAPL_SyncSharedMemory(rc=status) + ! init shared memory + N_lon_tmp = -1 + N_lat_tmp = -1 + if (associated(ptrShForce)) then + N_lon_tmp = size(ptrShForce,1) + N_lat_tmp = size(ptrShForce,2) + endif + if( (N_lon_tmp /= GEOSgcm_grid_N_lon) .or. & + (N_lat_tmp /= GEOSgcm_grid_N_lat) ) then + call MAPL_SyncSharedMemory(rc=status) + VERIFY_(status) + if (associated(ptrShForce)) then + call MAPL_DeallocNodeArray(ptrShForce,rc=status) VERIFY_(status) - end if - endif ! (GEOSgcm_var==1) - rc = 0 + endif + call MAPL_AllocateShared(ptrShForce,(/GEOSgcm_grid_N_lon,GEOSgcm_grid_N_lat/),TransRoot= .true.,rc=status) + VERIFY_(status) + end if + call MAPL_SyncSharedMemory(rc=status) + VERIFY_(status) ! read variable from netcdf file if (MAPL_AmNodeRoot .or. (.not. MAPL_ShmInitialized)) then @@ -3143,7 +3150,7 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, & character( 3) :: met_file_ext character( 3) :: precip_corr_file_ext - integer :: N_GEOSgcm_vars + integer :: N_GEOSgcm_vars, N_lon_tmp, N_lat_tmp real :: this_lon, this_lat, tmp_lon, tmp_lat @@ -3676,31 +3683,29 @@ subroutine get_GEOS( date_time, force_dtstep, met_path, met_tag, & ! ---------------------------------------------- ! - ! for first variable, process grid dimensions - - if (GEOSgcm_var==1) then - - if ( (use_prec_corr) .and. (GEOSgcm_defs(GEOSgcm_var,1)(1:4)=='PREC') ) then - err_msg = 'grid dims must come from original GEOS-5 file!!' - call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg) - end if - - ! init share memory - if( size(ptrShForce,1) /= local_info%N_lon .or. & - size(ptrShForce,2) /= local_info%N_lat ) then - call MAPL_SyncSharedMemory(rc=status) - VERIFY_(status) - if (associated(ptrShForce)) then - call MAPL_DeallocNodeArray(ptrShForce,rc=status) - VERIFY_(status) - endif - call MAPL_AllocateShared(ptrShForce,(/local_info%N_lon,local_info%N_lat/),TransRoot= .true.,rc=status) - VERIFY_(status) - call MAPL_SyncSharedMemory(rc=status) - VERIFY_(status) - end if - + ! process grid dimensions + ! NOTE: corrected precipitation forcing from separate netcdf can be on different grid + + ! init shared memory + N_lon_tmp = -1 + N_lat_tmp = -1 + if (associated(ptrShForce)) then + N_lon_tmp = size(ptrShForce,1) + N_lat_tmp = size(ptrShForce,2) endif + if ( N_lon_tmp /= local_info%N_lon .or. & + N_lat_tmp /= local_info%N_lat ) then + call MAPL_SyncSharedMemory(rc=status) + VERIFY_(status) + if (associated(ptrShForce)) then + call MAPL_DeallocNodeArray(ptrShForce,rc=status) + VERIFY_(status) + endif + call MAPL_AllocateShared(ptrShForce,(/local_info%N_lon,local_info%N_lat/),TransRoot= .true.,rc=status) + VERIFY_(status) + call MAPL_SyncSharedMemory(rc=status) + VERIFY_(status) + end if ! ---------------------------------------------- !