Skip to content

Commit

Permalink
Now register SSAlkAccum and SSAlkCoarse separately
Browse files Browse the repository at this point in the history
The State_Chm%SSAlk array cannot be registered as a single array,
because it is has a 4th dimension of size 2, which is interpreted as per
species.

The solution is to register the two fields separately, as SSAlkAccum
and SSAlkCoarse.  This also requires a slight modification to the
HISTORY.rc files.

Signed-off-by: Bob Yantosca <[email protected]>
  • Loading branch information
yantosca committed Aug 22, 2018
1 parent b63cc3b commit 55d1687
Showing 1 changed file with 43 additions and 6 deletions.
49 changes: 43 additions & 6 deletions Headers/state_chm_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
IF ( RC /= GC_SUCCESS ) RETURN
State_Chm%Species = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%Species, State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%Species', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!=======================================================================
! Allocate and initialize quantities that are only relevant for the
Expand Down Expand Up @@ -758,6 +760,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )

CALL Register_ChmField( am_I_Root, chmID, State_Chm%AeroArea, &
State_Chm, RC, Ncat=N )
CALL GC_CheckVar( 'State_Chm%AeroArea', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN
ENDDO

Expand Down Expand Up @@ -811,6 +814,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )

CALL Register_ChmField( am_I_Root, chmID, State_Chm%AeroRadi, &
State_Chm, RC, Ncat=N )
CALL GC_CheckVar( 'State_Chm%AeroRadi', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN
ENDDO

Expand Down Expand Up @@ -864,6 +868,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )

CALL Register_ChmField( am_I_Root, chmID, State_Chm%WetAeroArea, &
State_Chm, RC, Ncat=N )
CALL GC_CheckVar( 'State_Chm%WetAeroArea', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN
ENDDO

Expand Down Expand Up @@ -917,6 +922,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )

CALL Register_ChmField( am_I_Root, chmID, State_Chm%WetAeroRadi, &
State_Chm, RC, Ncat=N )
CALL GC_CheckVar( 'State_Chm%WetAeroRadi', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN
ENDDO

Expand All @@ -930,6 +936,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%phSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%phSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%phSav', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand All @@ -942,6 +949,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%HplusSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%HplusSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%HplusSav', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand All @@ -954,6 +962,8 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%WaterSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%WaterSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%WaterSav', 0, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
! SulRatSav
Expand All @@ -965,6 +975,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%SulRatSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%SulRatSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%SulRatSav', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand All @@ -977,6 +988,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%NaRatSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%NaRatSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%NaRatSav', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand All @@ -989,6 +1001,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%AcidPurSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%AcidPurSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%AcidPurSav', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand All @@ -1001,6 +1014,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%BisulSav = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%BisulSav, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%BiSulSav', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand All @@ -1013,17 +1027,30 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%pHCloud = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%pHCloud, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%pHCloud', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
! SSAlk
!--------------------------------------------------------------------
chmId = 'SSAlk'
ALLOCATE( State_Chm%SSAlk( IM, JM, LM, 2 ), STAT=RC )
CALL GC_CheckVar( 'State_Chm%SSAlk', 0, RC )
IF ( RC /= GC_SUCCESS ) RETURN
State_Chm%SSAlk = 0e+0_fp
State_Chm%SSAlk = 0.0_fp

! Register accumulation mode as category 1
chmId = 'SSAlkAccum'
CALL Register_ChmField( am_I_Root, chmID, State_Chm%SSAlk, &
State_Chm, RC )
State_Chm, RC, nCat=1 )
CALL GC_CheckVar( 'State-Chm%SsAlk', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

! Register coarse mode as category 1
chmId = 'SSAlkCoarse'
CALL Register_ChmField( am_I_Root, chmID, State_Chm%SSAlk, &
State_Chm, RC, nCat=2 )
CALL GC_CheckVar( 'State_Chm%SSAlk', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!------------------------------------------------------------------
! HSO3_AQ
Expand All @@ -1035,6 +1062,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%HSO3_AQ = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%HSO3_AQ, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%HSO3_AQ', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!------------------------------------------------------------------
Expand All @@ -1047,6 +1075,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%SO3_AQ = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%SO3_AQ, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%SO3_AQ', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!------------------------------------------------------------------
Expand All @@ -1059,6 +1088,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%fupdateHOBr = 0.0_fp
CALL Register_ChmField( am_I_Root, chmID, State_Chm%fupdateHOBr, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%fupdateHOBr', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN
ENDIF

Expand All @@ -1077,6 +1107,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )
State_Chm%STATE_PSC = 0.0_f4
CALL Register_ChmField( am_I_Root, chmID, State_Chm%STATE_PSC, &
State_Chm, RC )
CALL GC_CheckVar( 'State_Chm%STATE_PSC', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN

!--------------------------------------------------------------------
Expand Down Expand Up @@ -1124,6 +1155,7 @@ SUBROUTINE Init_State_Chm( am_I_Root, Input_Opt, State_Chm, RC )

CALL Register_ChmField( am_I_Root, chmID, State_Chm%KHETI_SLA, &
State_Chm, RC, Ncat=N )
CALL GC_CheckVar( 'State_Chm%KHETISLA', 1, RC )
IF ( RC /= GC_SUCCESS ) RETURN
ENDDO
ENDIF
Expand Down Expand Up @@ -2050,8 +2082,13 @@ SUBROUTINE Get_Metadata_State_Chm( am_I_Root, metadataID, Found, &
IF ( isUnits ) Units = '1'
IF ( isRank ) Rank = 3

CASE( 'SSALK' )
IF ( isDesc ) Desc = 'Sea salt alkalinity'
CASE( 'SSALKACCUM' )
IF ( isDesc ) Desc = 'Sea salt alkalinity, accumulation mode'
IF ( isUnits ) Units = '1'
IF ( isRank ) Rank = 3

CASE( 'SSALKCOARSE' )
IF ( isDesc ) Desc = 'Sea salt alkalinity, coarse mode'
IF ( isUnits ) Units = '1'
IF ( isRank ) Rank = 3

Expand Down Expand Up @@ -2483,7 +2520,7 @@ SUBROUTINE Register_ChmField_Rfp_4D( am_I_Root, metadataID, Ptr2Data, &
!-----------------------------------------------------------------------
ELSE
ErrMsg = 'Handling of PerSpecies metadata ' // TRIM(perSpecies) // &
' is not implemented for this combo of data type and size'
' is not implemented for this combo of data type and size!'
CALL GC_Error( ErrMsg, RC, ThisLoc )
RETURN
ENDIF
Expand Down

0 comments on commit 55d1687

Please sign in to comment.