| 1 |
#include "CPP_OPTIONS.h" |
| 2 |
#include "CPP_EEOPTIONS.h" |
| 3 |
|
| 4 |
subroutine smooth_init_varia (mythid) |
| 5 |
|
| 6 |
IMPLICIT NONE |
| 7 |
#include "SIZE.h" |
| 8 |
#include "EEPARAMS.h" |
| 9 |
#include "EESUPPORT.h" |
| 10 |
#include "PARAMS.h" |
| 11 |
#include "DYNVARS.h" |
| 12 |
#include "GRID.h" |
| 13 |
#include "GAD.h" |
| 14 |
#ifdef ALLOW_AUTODIFF_TAMC |
| 15 |
#include "tamc.h" |
| 16 |
#include "tamc_keys.h" |
| 17 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
| 18 |
# include "FFIELDS.h" |
| 19 |
# include "EOS.h" |
| 20 |
# include "GMREDI.h" |
| 21 |
#include "smooth.h" |
| 22 |
#ifdef ALLOW_SMOOTH_INV |
| 23 |
#include "ctrl.h" |
| 24 |
#endif |
| 25 |
integer k |
| 26 |
integer myThid |
| 27 |
integer ikey_bak |
| 28 |
logical useDiagnostics_bak, useKPP_bak |
| 29 |
& , useGMREDI_bak, GM_ExtraDiag_bak |
| 30 |
_RL GM_isopycK_bak, GM_background_K_bak |
| 31 |
c & , GM_Kmin_horiz_bak, GM_maxSlope_bak |
| 32 |
CHARACTER*(MAX_LEN_FNAM) GM_taper_scheme_bak |
| 33 |
_RL dTtracerLev_bak(nr) |
| 34 |
#ifdef ALLOW_SMOOTH_INV |
| 35 |
integer il |
| 36 |
character*( 80) fnamegeneric |
| 37 |
integer ilnblnk |
| 38 |
external ilnblnk |
| 39 |
#endif |
| 40 |
|
| 41 |
_BARRIER |
| 42 |
|
| 43 |
if ( .NOT.smooth_isset ) then |
| 44 |
smooth_isset=.TRUE. |
| 45 |
cgf this line would eventually go into init_fixed |
| 46 |
_BEGIN_MASTER( mythid ) |
| 47 |
wc01_implicitDiffusion=.TRUE. |
| 48 |
_END_MASTER( mythid ) |
| 49 |
|
| 50 |
cgf eventually this part could go into smooth_init3D |
| 51 |
_BEGIN_MASTER( mythid ) |
| 52 |
cgf ~ inconsistency here: GM_isopycK_bak etc are not in common block |
| 53 |
cgf but I do do _BEGIN_MASTER ... not a real inconcistency because only |
| 54 |
cgf the master values will be used later ... but dangerous |
| 55 |
WRITE(standardMessageUnit,'(A)') |
| 56 |
& 'smooth_init_varia: change GMREDI/SMOOTH params' |
| 57 |
DO k=1,nr |
| 58 |
dTtracerLev_bak(k)=dTtracerLev(k) |
| 59 |
dTtracerLev(k)=1. |
| 60 |
ENDDO |
| 61 |
useDiagnostics_bak=useDiagnostics |
| 62 |
useDiagnostics=.FALSE. |
| 63 |
useKPP_bak=useKPP |
| 64 |
useKPP=.FALSE. |
| 65 |
useGMREDI_bak=useGMREDI |
| 66 |
useGMREDI=.TRUE. |
| 67 |
GM_isopycK_bak=GM_isopycK |
| 68 |
GM_isopycK=1000 |
| 69 |
GM_background_K_bak=GM_background_K |
| 70 |
GM_background_K=0 |
| 71 |
GM_ExtraDiag_bak=GM_ExtraDiag |
| 72 |
GM_ExtraDiag=.TRUE. |
| 73 |
GM_taper_scheme_bak= GM_taper_scheme |
| 74 |
GM_taper_scheme='gkw91' |
| 75 |
c now dealt with through local tests in smooth_init3D |
| 76 |
c GM_maxSlope_bak=GM_maxSlope |
| 77 |
c GM_maxSlope=1.D-3 |
| 78 |
c GM_Kmin_horiz_bak=GM_Kmin_horiz |
| 79 |
c GM_Kmin_horiz=100 |
| 80 |
_END_MASTER( mythid ) |
| 81 |
#ifdef ALLOW_AUTODIFF_TAMC |
| 82 |
ikey_bak=ikey |
| 83 |
#endif |
| 84 |
|
| 85 |
#ifdef ALLOW_SMOOTH2D |
| 86 |
DO smoothOpNbCur=1,smoothOpNbMax |
| 87 |
if (smooth2Dtype(smoothOpNbCur).NE.0) then |
| 88 |
call smooth_init2D(mythid) |
| 89 |
endif |
| 90 |
ENDDO |
| 91 |
#endif |
| 92 |
|
| 93 |
#ifdef ALLOW_SMOOTH3D |
| 94 |
DO smoothOpNbCur=1,smoothOpNbMax |
| 95 |
if ((smooth3DtypeZ(smoothOpNbCur).NE.0).OR. |
| 96 |
& (smooth3DtypeH(smoothOpNbCur).NE.0)) then |
| 97 |
call smooth_init3D(mythid) |
| 98 |
endif |
| 99 |
ENDDO |
| 100 |
#endif |
| 101 |
|
| 102 |
#ifdef ALLOW_AUTODIFF_TAMC |
| 103 |
ikey=ikey_bak |
| 104 |
#endif |
| 105 |
_BEGIN_MASTER( mythid ) |
| 106 |
DO k=1,nr |
| 107 |
dTtracerLev(k)=dTtracerLev_bak(k) |
| 108 |
ENDDO |
| 109 |
useDiagnostics=useDiagnostics_bak |
| 110 |
useKPP=useKPP_bak |
| 111 |
useGMREDI=useGMREDI_bak |
| 112 |
GM_isopycK=GM_isopycK_bak |
| 113 |
GM_background_K=GM_background_K_bak |
| 114 |
GM_ExtraDiag=GM_ExtraDiag_bak |
| 115 |
GM_taper_scheme= GM_taper_scheme_bak |
| 116 |
c GM_maxSlope=GM_maxSlope_bak |
| 117 |
c GM_Kmin_horiz=GM_Kmin_horiz_bak |
| 118 |
WRITE(standardMessageUnit,'(A)') |
| 119 |
& 'smooth_init_varia: unchange GMREDI/SMOOTH params' |
| 120 |
_END_MASTER( mythid ) |
| 121 |
|
| 122 |
|
| 123 |
cgf this part calls smooth_diff3D, which switch dTtracerLev, |
| 124 |
cgf so it needs to happen after dTtracerLev is restored to the |
| 125 |
cgf normal value |
| 126 |
#ifdef ALLOW_SMOOTH2D |
| 127 |
DO smoothOpNbCur=1,smoothOpNbMax |
| 128 |
if (smooth2Dtype(smoothOpNbCur).NE.0) then |
| 129 |
call smooth_filtervar2D(mythid) |
| 130 |
c call smooth_ensemble2D(mythid) |
| 131 |
endif |
| 132 |
ENDDO |
| 133 |
#endif |
| 134 |
|
| 135 |
#ifdef ALLOW_SMOOTH3D |
| 136 |
DO smoothOpNbCur=1,smoothOpNbMax |
| 137 |
if ((smooth3DtypeZ(smoothOpNbCur).NE.0).OR. |
| 138 |
& (smooth3DtypeH(smoothOpNbCur).NE.0)) then |
| 139 |
call smooth_filtervar3D(mythid) |
| 140 |
c call smooth_ensemble3D(mythid) |
| 141 |
endif |
| 142 |
ENDDO |
| 143 |
#endif |
| 144 |
c stop |
| 145 |
|
| 146 |
endif |
| 147 |
|
| 148 |
_BARRIER |
| 149 |
|
| 150 |
|
| 151 |
cgf this needs to happen after ini_fields [otherwise ini_fields overwrites] |
| 152 |
cgf , before/after smooth_init3D does not matter [specific wc01theta/wc01salt to compute operator] |
| 153 |
cgf , before ctrl_map_ini_ecco [uses these theta/salt] |
| 154 |
cgf , and any time packages_init_variables is called [not only if ( .NOT.smooth_isset )] |
| 155 |
cgf ... nothing in adjoint because ini_fields will reset to adtheta/adsalt to 0 |
| 156 |
#ifdef ALLOW_SMOOTH_INV |
| 157 |
il=ilnblnk( xx_theta_file ) |
| 158 |
write(fnamegeneric(1:80),'(2a)') |
| 159 |
& xx_theta_file(1:il), '.bckgd' |
| 160 |
call mdsreadfield(fnamegeneric,32,'RL',nr, |
| 161 |
& theta, 1, mythid) |
| 162 |
_EXCH_XYZ_RL( theta, mythid ) |
| 163 |
il=ilnblnk( xx_salt_file ) |
| 164 |
write(fnamegeneric(1:80),'(2a)') |
| 165 |
& xx_salt_file(1:il), '.bckgd' |
| 166 |
call mdsreadfield(fnamegeneric,32,'RL',nr, |
| 167 |
& salt, 1, mythid) |
| 168 |
_EXCH_XYZ_RL( salt, mythid ) |
| 169 |
#endif |
| 170 |
|
| 171 |
END |
| 172 |
|
| 173 |
|