Back to home page

MITgcm

 
 

    


File indexing completed on 2025-09-19 05:08:33 UTC

view on githubraw file Latest commit c3be0435 on 2025-09-18 18:40:16 UTC
fda3710353 Oliv*0001 #include "LONGSTEP_OPTIONS.h"
                0002 
                0003 CBOP
                0004 C !ROUTINE: LONGSTEP_FORCING_SURF
                0005 
                0006 C !INTERFACE: ==========================================================
                0007       SUBROUTINE LONGSTEP_FORCING_SURF(
                0008      I                            bi, bj, iMin, iMax, jMin, jMax,
cc9097e522 Oliv*0009      I                            myTime, myIter, myThid )
fda3710353 Oliv*0010 
                0011 C !DESCRIPTION:
                0012 C     Precomputes surface forcing term for pkg/ptracers.
                0013 C     Precomputation is needed because of non-local KPP transport term,
                0014 C     routine KPP_TRANSPORT_PTR.
                0015 
                0016 C !USES: ===============================================================
                0017       IMPLICIT NONE
                0018 #include "SIZE.h"
                0019 #include "EEPARAMS.h"
                0020 #include "PARAMS.h"
cc9097e522 Oliv*0021 c #include "GRID.h"
                0022 c #include "SURFACE.h"
                0023 c #include "FFIELDS.h"
fda3710353 Oliv*0024 c #include "DYNVARS.h"
                0025 #include "LONGSTEP.h"
cc9097e522 Oliv*0026 #ifdef ALLOW_PTRACERS
                0027 # include "PTRACERS_SIZE.h"
                0028 # include "PTRACERS_PARAMS.h"
                0029 # include "PTRACERS_FIELDS.h"
                0030 #endif
fda3710353 Oliv*0031 
                0032 C !INPUT PARAMETERS: ===================================================
                0033 C  bi,bj                :: tile indices
                0034 C  myTime               :: model time
                0035 C  myIter               :: time-step number
                0036 C  myThid               :: thread number
                0037       INTEGER bi, bj, iMin, iMax, jMin, jMax
                0038       _RL myTime
                0039       INTEGER myIter
                0040       INTEGER myThid
                0041 
                0042 #ifdef ALLOW_LONGSTEP
cc9097e522 Oliv*0043 #ifdef ALLOW_PTRACERS
fda3710353 Oliv*0044 
                0045 C !LOCAL VARIABLES: ====================================================
                0046 C  i,j                  :: loop indices
                0047 C  iTrc                 :: tracer index
                0048 C  ks                   :: surface level index
                0049       INTEGER i, j
                0050       INTEGER iTrc, ks
                0051 CEOP
                0052 
                0053       IF ( usingPCoords ) THEN
                0054         ks = Nr
                0055       ELSE
                0056         ks = 1
                0057       ENDIF
                0058 
                0059 C Example of how to add forcing at the surface
                0060       DO iTrc=1,PTRACERS_numInUse
                0061           DO j = jMin, jMax
                0062            DO i = iMin, iMax
                0063              surfaceForcingPTr(i,j,bi,bj,iTrc) =
                0064      &               0. _d 0
                0065 c    &               surfaceForcingS(i,j,bi,bj)
                0066            ENDDO
                0067           ENDDO
                0068       ENDDO
                0069 
                0070       IF ( (nonlinFreeSurf.GT.0 .OR. usingPCoords)
                0071      &     .AND. useRealFreshWaterFlux ) THEN
                0072 
                0073        DO iTrc=1,PTRACERS_numInUse
                0074 
                0075 c-  NonLin_FrSurf and RealFreshWaterFlux : PmEpR effectively changes
                0076 c   the water column height ; temp., salt, (tracer) flux associated
                0077 c   with this input/output of water is added here to the surface tendency.
                0078 c
                0079 c   NB: LS_fwflux is PmEpR
                0080 c
                0081          IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN
                0082           DO j = jMin, jMax
                0083            DO i = iMin, iMax
                0084              surfaceForcingPTr(i,j,bi,bj,iTrc) =
                0085      &          surfaceForcingPTr(i,j,bi,bj,iTrc)
                0086      &        + LS_fwFlux(i,j,bi,bj)
                0087      &          *( PTRACERS_EvPrRn(iTrc) - pTracer(i,j,ks,bi,bj,iTrc) )
                0088      &          *mass2rUnit
                0089            ENDDO
                0090           ENDDO
                0091          ENDIF
                0092 
                0093        ENDDO
                0094 
                0095 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0096       ELSE
                0097 
                0098 C--   EmPmR does not really affect the water column height (for tracer budget)
                0099 C     and is converted to a salt tendency.
                0100 
                0101        IF (convertFW2Salt .EQ. -1.) THEN
                0102 C-    use local surface tracer field to calculate forcing term:
                0103 
                0104         DO iTrc=1,PTRACERS_numInUse
                0105 
                0106          IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN
                0107 C        account for Rain/Evap tracer content (PTRACERS_EvPrRn) using
                0108 C        local surface tracer
                0109 c
                0110 c   NB: LS_fwflux is EmPmR
                0111 
                0112           DO j = jMin, jMax
                0113            DO i = iMin, iMax
                0114             surfaceForcingPTr(i,j,bi,bj,iTrc) =
                0115      &          surfaceForcingPTr(i,j,bi,bj,iTrc)
                0116      &        + LS_fwFlux(i,j,bi,bj)
                0117      &          *( pTracer(i,j,ks,bi,bj,iTrc) - PTRACERS_EvPrRn(iTrc) )
                0118      &          *mass2rUnit
                0119            ENDDO
                0120           ENDDO
                0121          ENDIF
                0122 
                0123         ENDDO
                0124 
                0125        ELSE
                0126 C-    use uniform tracer value to calculate forcing term:
                0127 
                0128         DO iTrc=1,PTRACERS_numInUse
                0129 
                0130          IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN
                0131 C     account for Rain/Evap tracer content (PTRACERS_EvPrRn) assuming uniform
                0132 C     surface tracer (=PTRACERS_ref)
                0133 c
                0134 c   NB: LS_fwflux is EmPmR
                0135 
                0136           DO j = jMin, jMax
                0137            DO i = iMin, iMax
                0138             surfaceForcingPTr(i,j,bi,bj,iTrc) =
                0139      &          surfaceForcingPTr(i,j,bi,bj,iTrc)
                0140      &        + LS_fwFlux(i,j,bi,bj)
                0141      &            *( PTRACERS_ref(ks,iTrc) - PTRACERS_EvPrRn(iTrc) )
                0142      &            *mass2rUnit
                0143            ENDDO
                0144           ENDDO
                0145          ENDIF
                0146 
                0147         ENDDO
                0148 
                0149 C-    end local-surface-tracer / uniform-value distinction
                0150        ENDIF
                0151 
                0152       ENDIF
                0153 
                0154 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0155 
cc9097e522 Oliv*0156 #endif /* ALLOW_PTRACERS */
fda3710353 Oliv*0157 #endif /* ALLOW_LONGSTEP */
                0158 
                0159       RETURN
                0160       END