From 99ee81b5ed4abcebc9075061b55d35902f32a788 Mon Sep 17 00:00:00 2001 From: Melissa Sulprizio Date: Thu, 15 Aug 2024 11:57:45 -0400 Subject: [PATCH] Add TSOIL1 field to ExtState object for soil NOx extension Signed-off-by: Melissa Sulprizio --- CHANGELOG.md | 3 +++ src/Extensions/hcox_state_mod.F90 | 8 ++++++++ .../Standalone/hcoi_standalone_mod.F90 | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfbb7f1e..c2793559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ 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 TSOIL1 field to ExtState + ### Changed - Updated soil NOx extention to include the option to use soil temperature and parameterization based on Yi Wang et al. (ERL, 2021) instead of the temperature at 2 meters. diff --git a/src/Extensions/hcox_state_mod.F90 b/src/Extensions/hcox_state_mod.F90 index ea6e5f02..832c3c66 100644 --- a/src/Extensions/hcox_state_mod.F90 +++ b/src/Extensions/hcox_state_mod.F90 @@ -131,6 +131,7 @@ MODULE HCOX_STATE_MOD TYPE(ExtDat_2R), POINTER :: ALBD ! Surface albedo [-] TYPE(ExtDat_2R), POINTER :: T2M ! 2m Sfce temperature [K] TYPE(ExtDat_2R), POINTER :: TSKIN ! Surface skin temperature [K] + TYPE(ExtDat_2R), POINTER :: TSOIL1 ! Soil temperature, layer 1 [K] TYPE(ExtDat_2R), POINTER :: GWETROOT ! Root soil wetness [1] TYPE(ExtDat_2R), POINTER :: GWETTOP ! Top soil moisture [-] TYPE(ExtDat_2R), POINTER :: SNOWHGT ! Snow height [mm H2O = kg H2O/m2] @@ -355,6 +356,12 @@ SUBROUTINE ExtStateInit( ExtState, RC ) RETURN ENDIF + CALL ExtDat_Init ( ExtState%TSOIL1, RC ) + IF ( RC /= HCO_SUCCESS ) THEN + CALL HCO_ERROR( 'Initializing TSOIL1', RC, THISLOC=LOC ) + RETURN + ENDIF + CALL ExtDat_Init ( ExtState%GWETROOT, RC ) IF ( RC /= HCO_SUCCESS ) THEN CALL HCO_ERROR( 'ERROR 6', RC, THISLOC=LOC ) @@ -676,6 +683,7 @@ SUBROUTINE ExtStateFinal( ExtState ) CALL ExtDat_Cleanup( ExtState%ALBD ) CALL ExtDat_Cleanup( ExtState%T2M ) CALL ExtDat_Cleanup( ExtState%TSKIN ) + CALL ExtDat_Cleanup( ExtState%TSOIL1 ) CALL ExtDat_Cleanup( ExtState%GWETROOT ) CALL ExtDat_Cleanup( ExtState%GWETTOP ) CALL ExtDat_Cleanup( ExtState%SNOWHGT ) diff --git a/src/Interfaces/Standalone/hcoi_standalone_mod.F90 b/src/Interfaces/Standalone/hcoi_standalone_mod.F90 index 1d5085fb..fc508a6a 100644 --- a/src/Interfaces/Standalone/hcoi_standalone_mod.F90 +++ b/src/Interfaces/Standalone/hcoi_standalone_mod.F90 @@ -2210,7 +2210,7 @@ SUBROUTINE ExtState_SetFields ( HcoState, ExtState, RC ) ENDIF ENDIF - !%%%%% Air and skin temperature %%%%% + !%%%%% Air temperature %%%%% IF ( ExtState%T2M%DoUse ) THEN Name = 'T2M' CALL ExtDat_Set( HcoState, ExtState%T2M, & @@ -2224,6 +2224,7 @@ SUBROUTINE ExtState_SetFields ( HcoState, ExtState, RC ) ENDIF ENDIF + !%%%%% Skin temperature %%%%% IF ( ExtState%TSKIN%DoUse ) THEN Name = 'TS' CALL ExtDat_Set( HcoState, ExtState%TSKIN, & @@ -2237,6 +2238,20 @@ SUBROUTINE ExtState_SetFields ( HcoState, ExtState, RC ) ENDIF ENDIF + !%%%%% Soil temperature %%%%% + IF ( ExtState%TSOIL1%DoUse ) THEN + Name = 'TSOIL1' + CALL ExtDat_Set( HcoState, ExtState%TSOIL1, & + TRIM( Name ), RC, FIRST=FIRST ) + IF ( RC /= HCO_SUCCESS ) THEN + ErrMsg = 'Could not find quantity "' // TRIM( Name ) // & + '" for the HEMCO standalone simulation!' + CALL HCO_Error( ErrMsg, RC, ThisLoc ) + CALL HCO_Leave( HcoState%Config%Err, RC ) + RETURN + ENDIF + ENDIF + !%%%%% Soil moisture %%%%% IF ( ExtState%GWETROOT%DoUse ) THEN Name = 'GWETROOT'