File indexing completed on 2023-02-04 06:09:50 UTC
view on githubraw file Latest commit 2e3e8c33 on 2023-02-03 17:26:01 UTC
6d54cf9ca1 Ed H*0001 #include "DIC_OPTIONS.h"
daab022f42 Step*0002
f84ec16ca2 Jean*0003
0004
0005
daab022f42 Step*0006 SUBROUTINE Fe_CHEM(
f84ec16ca2 Jean*0007 I bi,bj, iMin,iMax,jMin,jMax,
85d94247b5 Jean*0008 I fe,
0009 O freefe,
daab022f42 Step*0010 I myIter, myThid )
f84ec16ca2 Jean*0011
0012
0013
0014
0015
0016
0017
0018
0019
daab022f42 Step*0020 IMPLICIT NONE
0021
0022
0023 #include "SIZE.h"
0024 #include "EEPARAMS.h"
0025 #include "PARAMS.h"
0026 #include "GRID.h"
2ef8966791 Davi*0027 #include "DIC_VARS.h"
daab022f42 Step*0028
f84ec16ca2 Jean*0029
0030
0031
0032
0033
0034 INTEGER bi,bj
0035 INTEGER iMin,iMax,jMin,jMax
0036 _RL fe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0037 _RL freefe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0038 INTEGER myIter, myThid
0039
daab022f42 Step*0040
49373516f9 Jean*0041 #ifdef ALLOW_FE
f84ec16ca2 Jean*0042
0043 INTEGER i,j,k
daab022f42 Step*0044 _RL lig, FeL
f7bc6bf9ae Step*0045 _RL tmpfe
2e3e8c330d Jona*0046 #if ( defined MINFE && defined DIC_AD_SAFE )
f84ec16ca2 Jean*0047 _RL thx, thy, theps
0048 #endif
daab022f42 Step*0049
f84ec16ca2 Jean*0050
0051
0052
0053
0054
daab022f42 Step*0055
85d94247b5 Jean*0056 DO k=1,Nr
0057 DO j=1-OLy,sNy+OLy
0058 DO i=1-OLx,sNx+OLx
0059 freefe(i,j,k) = 0. _d 0
0060 ENDDO
0061 ENDDO
0062 ENDDO
0063
daab022f42 Step*0064
0065
0066
f84ec16ca2 Jean*0067 DO k=1,Nr
0068 DO j=jMin,jMax
0069 DO i=iMin,iMax
0070 IF ( maskC(i,j,k,bi,bj).GT.0. ) THEN
daab022f42 Step*0071
f7bc6bf9ae Step*0072 #ifdef DIC_NO_NEG
f84ec16ca2 Jean*0073 tmpfe =MAX( 0. _d 0 , fe(i,j,k) )
f7bc6bf9ae Step*0074 #else
f84ec16ca2 Jean*0075 tmpfe = fe(i,j,k)
f7bc6bf9ae Step*0076 #endif
f84ec16ca2 Jean*0077
f7bc6bf9ae Step*0078
0079 lig=(-ligand_stab*tmpfe +
75e97f1e14 Davi*0080 & ligand_stab*ligand_tot-1. _d 0
f84ec16ca2 Jean*0081 & +((ligand_stab*tmpfe
75e97f1e14 Davi*0082 & -ligand_stab*ligand_tot+1. _d 0)**2
0083 & +4. _d 0*ligand_stab*ligand_tot)**0.5 _d 0
0084 & )/(2. _d 0*ligand_stab)
f84ec16ca2 Jean*0085
daab022f42 Step*0086 FeL = ligand_tot-lig
f84ec16ca2 Jean*0087 IF (tmpfe.NE.0. _d 0) THEN
0088 freefe(i,j,k) = tmpfe -FeL
0089 ELSE
0090 freefe(i,j,k) = 0. _d 0
0091 ENDIF
9b8a71f139 Step*0092 #ifdef MINFE
2e3e8c330d Jona*0093 #ifdef DIC_AD_SAFE
f84ec16ca2 Jean*0094 thx=freefe(i,j,k)
720e9330bd Step*0095 thy=freefemax
75e97f1e14 Davi*0096 theps=1. _d -8
f84ec16ca2 Jean*0097 freefe(i,j,k) =
75e97f1e14 Davi*0098 & ( 1. _d 0 - tanh((thx-thy)/theps) ) * thx/2.+
0099 & ( 1. _d 0 + tanh((thx-thy)/theps) ) * thy/2.
720e9330bd Step*0100
0101 #else
f84ec16ca2 Jean*0102 freefe(i,j,k) = MIN(freefe(i,j,k),freefemax)
720e9330bd Step*0103 #endif
f84ec16ca2 Jean*0104 fe(i,j,k) = FeL+freefe(i,j,k)
9b8a71f139 Step*0105 #endif
f84ec16ca2 Jean*0106 ENDIF
daab022f42 Step*0107 ENDDO
0108 ENDDO
f84ec16ca2 Jean*0109 ENDDO
0110
0111 #endif /* ALLOW_FE */
0112 RETURN
0113 END