diff --git a/CHANGELOG.md b/CHANGELOG.md index 483820b42..8ba96b2a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ This file documents all notable changes to the GEOS-Chem repository starting in The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - TBD +### Added +- Added allocate guards for arrays in `pressure_mod` + ### Changed - Renamed `Emiss_Carbon_Gases` to `CO2_Production` in `carbon_gases_mod.F90` - Updated start date and restart file for CO2 and tagCO simulations for consistency with carbon simulations diff --git a/GeosUtil/pressure_mod.F90 b/GeosUtil/pressure_mod.F90 index f81a1268d..f8de6e71e 100644 --- a/GeosUtil/pressure_mod.F90 +++ b/GeosUtil/pressure_mod.F90 @@ -517,42 +517,57 @@ SUBROUTINE INIT_PRESSURE( Input_Opt, State_Grid, RC ) RC = GC_SUCCESS ThisLoc = ' -> at Init_Pressure (in GeosUtil/pressure_mod.F90)' - ALLOCATE( PFLT_DRY( State_Grid%NX, State_Grid%NY ), STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:PFLT_DRY', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - PFLT_DRY = 0e+0_fp - - ALLOCATE( PFLT_WET( State_Grid%NX, State_Grid%NY ), STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:PFLT_WET', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - PFLT_WET = 0e+0_fp - - ALLOCATE( AP( State_Grid%NZ+1 ), STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:AP', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - AP = 1e+0_fp - - ALLOCATE( BP( State_Grid%NZ+1 ), STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:BP', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - BP = 0e+0_fp - - ALLOCATE( AP_FULLGRID( State_Grid%NativeNZ+1 ), STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:AP_FULLGRID', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - AP = 1e+0_fp - - ALLOCATE( BP_FULLGRID( State_Grid%NativeNZ+1 ), STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:BP_FULLGRID', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - BP = 0e+0_fp + IF (.NOT. ALLOCATED( PFLT_DRY )) THEN + ALLOCATE( PFLT_DRY( State_Grid%NX, State_Grid%NY ), STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:PFLT_DRY', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + PFLT_DRY = 0e+0_fp + END IF + + IF (.NOT. ALLOCATED( PFLT_WET )) THEN + ALLOCATE( PFLT_WET( State_Grid%NX, State_Grid%NY ), STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:PFLT_WET', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + PFLT_WET = 0e+0_fp + END IF + + IF (.NOT. ALLOCATED( AP )) THEN + ALLOCATE( AP( State_Grid%NZ+1 ), STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:AP', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + AP = 1e+0_fp + END IF + + IF (.NOT. ALLOCATED( BP )) THEN + ALLOCATE( BP( State_Grid%NZ+1 ), STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:BP', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + BP = 0e+0_fp + END IF + + IF (.NOT. ALLOCATED( AP_FULLGRID )) THEN + ALLOCATE( AP_FULLGRID( State_Grid%NativeNZ+1 ), STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:AP_FULLGRID', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + AP = 1e+0_fp + END IF + + IF (.NOT. ALLOCATED( BP_FULLGRID )) THEN + ALLOCATE( BP_FULLGRID( State_Grid%NativeNZ+1 ), STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:BP_FULLGRID', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + BP = 0e+0_fp + END IF #if defined( ESMF_ ) || defined( MODEL_ ) - ALLOCATE( EXTERNAL_PEDGE( State_Grid%NX, State_Grid%NY, State_Grid%NZ+1 ), & - STAT=RC ) - CALL GC_CheckVar( 'vdiff_mod.F90:EXTERNAL_PEDGE', 2, RC ) - IF ( RC /= GC_SUCCESS ) RETURN - EXTERNAL_PEDGE = 0e+0_fp + IF (.NOT. ALLOCATED( EXTERNAL_PEDGE )) THEN + ALLOCATE( EXTERNAL_PEDGE( State_Grid%NX, State_Grid%NY, & + State_Grid%NZ+1 ), & + STAT=RC ) + CALL GC_CheckVar( 'vdiff_mod.F90:EXTERNAL_PEDGE', 2, RC ) + IF ( RC /= GC_SUCCESS ) RETURN + EXTERNAL_PEDGE = 0e+0_fp + END IF #endif IF ( State_Grid%NZ == 47 ) THEN