--- MITgcm/pkg/dic/fe_chem.F 2003/10/02 18:30:07 1.1.2.1 +++ MITgcm/pkg/dic/fe_chem.F 2007/10/26 21:08:13 1.10 @@ -1,3 +1,6 @@ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/dic/fe_chem.F,v 1.10 2007/10/26 21:08:13 dfer Exp $ +C $Name: $ + #include "DIC_OPTIONS.h" #include "GCHEM_OPTIONS.h" @@ -20,7 +23,6 @@ #include "PARAMS.h" #include "GRID.h" #include "DIC_BIOTIC.h" -#include "PTRACERS.h" C == Routine arguments == C bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation @@ -30,8 +32,12 @@ _RL fe(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) INTEGER bi,bj,iMin,iMax,jMin,jMax INTEGER myIter,myThid +#ifdef AD_SAFE + _RL thx, thy, theps +#endif CEndOfInterface +#ifdef ALLOW_FE INTEGER I,J,K _RL lig, FeL @@ -50,26 +56,41 @@ C ligand balance in surface layer C in surface layer - DO j=jMin,jMax - DO i=iMin,iMax - DO k=1,nR - IF(hFacC(i,j,k,bi,bj) .gt. 0.0)THEN + DO j=jmin,jmax + DO i=imin,imax + DO k=1,Nr + IF (hFacC(i,j,k,bi,bj) .GT. 0. _d 0) THEN C Ligand,FeL,Fe calculation lig=(-ligand_stab*fe (i,j,k,bi,bj)+ - & ligand_stab*ligand_tot-1 + & ligand_stab*ligand_tot-1. _d 0 & +((ligand_stab*fe (i,j,k,bi,bj) - & -ligand_stab*ligand_tot+1)**2+4 - & *ligand_stab*ligand_tot)**0.5)/(2*ligand_stab) + & -ligand_stab*ligand_tot+1. _d 0)**2 + & +4. _d 0*ligand_stab*ligand_tot)**0.5 _d 0 + & )/(2. _d 0*ligand_stab) FeL = ligand_tot-lig freefe(i,j,k,bi,bj) = fe (i,j,k,bi,bj)-FeL +#ifdef MINFE +#ifdef AD_SAFE + thx=freefe(i,j,k,bi,bj) + thy=freefemax + theps=1. _d -8 + freefe(i,j,k,bi,bj) = + & ( 1. _d 0 - tanh((thx-thy)/theps) ) * thx/2.+ + & ( 1. _d 0 + tanh((thx-thy)/theps) ) * thy/2. + +#else + freefe(i,j,k,bi,bj) = min(freefe(i,j,k,bi,bj),freefemax) +#endif + fe(i,j,k,bi,bj) = FeL+freefe(i,j,k,bi,bj) +#endif END IF ENDDO ENDDO ENDDO c +#endif RETURN - END - + END