#include "CPP_OPTIONS.h" #include "CPP_EEOPTIONS.h" subroutine smooth_init_varia (mythid) IMPLICIT NONE #include "SIZE.h" #include "EEPARAMS.h" #include "EESUPPORT.h" #include "PARAMS.h" #include "DYNVARS.h" #include "GRID.h" #include "GAD.h" #ifdef ALLOW_AUTODIFF_TAMC #include "tamc.h" #include "tamc_keys.h" #endif /* ALLOW_AUTODIFF_TAMC */ # include "FFIELDS.h" # include "EOS.h" # include "GMREDI.h" #include "smooth.h" #ifdef ALLOW_SMOOTH_INV #include "ctrl.h" #endif integer k integer myThid integer ikey_bak logical useDiagnostics_bak, useKPP_bak & , useGMREDI_bak, GM_ExtraDiag_bak _RL GM_isopycK_bak, GM_background_K_bak c & , GM_Kmin_horiz_bak, GM_maxSlope_bak CHARACTER*(MAX_LEN_FNAM) GM_taper_scheme_bak _RL dTtracerLev_bak(nr) #ifdef ALLOW_SMOOTH_INV integer il character*( 80) fnamegeneric integer ilnblnk external ilnblnk #endif _BARRIER if ( .NOT.smooth_isset ) then smooth_isset=.TRUE. cgf this line would eventually go into init_fixed _BEGIN_MASTER( mythid ) wc01_implicitDiffusion=.TRUE. _END_MASTER( mythid ) cgf eventually this part could go into smooth_init3D _BEGIN_MASTER( mythid ) cgf ~ inconsistency here: GM_isopycK_bak etc are not in common block cgf but I do do _BEGIN_MASTER ... not a real inconcistency because only cgf the master values will be used later ... but dangerous WRITE(standardMessageUnit,'(A)') & 'smooth_init_varia: change GMREDI/SMOOTH params' DO k=1,nr dTtracerLev_bak(k)=dTtracerLev(k) dTtracerLev(k)=1. ENDDO useDiagnostics_bak=useDiagnostics useDiagnostics=.FALSE. useKPP_bak=useKPP useKPP=.FALSE. useGMREDI_bak=useGMREDI useGMREDI=.TRUE. GM_isopycK_bak=GM_isopycK GM_isopycK=1000 GM_background_K_bak=GM_background_K GM_background_K=0 GM_ExtraDiag_bak=GM_ExtraDiag GM_ExtraDiag=.TRUE. GM_taper_scheme_bak= GM_taper_scheme GM_taper_scheme='gkw91' c now dealt with through local tests in smooth_init3D c GM_maxSlope_bak=GM_maxSlope c GM_maxSlope=1.D-3 c GM_Kmin_horiz_bak=GM_Kmin_horiz c GM_Kmin_horiz=100 _END_MASTER( mythid ) #ifdef ALLOW_AUTODIFF_TAMC ikey_bak=ikey #endif #ifdef ALLOW_SMOOTH2D DO smoothOpNbCur=1,smoothOpNbMax if (smooth2Dtype(smoothOpNbCur).NE.0) then call smooth_init2D(mythid) endif ENDDO #endif #ifdef ALLOW_SMOOTH3D DO smoothOpNbCur=1,smoothOpNbMax if ((smooth3DtypeZ(smoothOpNbCur).NE.0).OR. & (smooth3DtypeH(smoothOpNbCur).NE.0)) then call smooth_init3D(mythid) endif ENDDO #endif #ifdef ALLOW_AUTODIFF_TAMC ikey=ikey_bak #endif _BEGIN_MASTER( mythid ) DO k=1,nr dTtracerLev(k)=dTtracerLev_bak(k) ENDDO useDiagnostics=useDiagnostics_bak useKPP=useKPP_bak useGMREDI=useGMREDI_bak GM_isopycK=GM_isopycK_bak GM_background_K=GM_background_K_bak GM_ExtraDiag=GM_ExtraDiag_bak GM_taper_scheme= GM_taper_scheme_bak c GM_maxSlope=GM_maxSlope_bak c GM_Kmin_horiz=GM_Kmin_horiz_bak WRITE(standardMessageUnit,'(A)') & 'smooth_init_varia: unchange GMREDI/SMOOTH params' _END_MASTER( mythid ) cgf this part calls smooth_diff3D, which switch dTtracerLev, cgf so it needs to happen after dTtracerLev is restored to the cgf normal value #ifdef ALLOW_SMOOTH2D DO smoothOpNbCur=1,smoothOpNbMax if (smooth2Dtype(smoothOpNbCur).NE.0) then call smooth_filtervar2D(mythid) c call smooth_ensemble2D(mythid) endif ENDDO #endif #ifdef ALLOW_SMOOTH3D DO smoothOpNbCur=1,smoothOpNbMax if ((smooth3DtypeZ(smoothOpNbCur).NE.0).OR. & (smooth3DtypeH(smoothOpNbCur).NE.0)) then call smooth_filtervar3D(mythid) c call smooth_ensemble3D(mythid) endif ENDDO #endif c stop endif _BARRIER cgf this needs to happen after ini_fields [otherwise ini_fields overwrites] cgf , before/after smooth_init3D does not matter [specific wc01theta/wc01salt to compute operator] cgf , before ctrl_map_ini_ecco [uses these theta/salt] cgf , and any time packages_init_variables is called [not only if ( .NOT.smooth_isset )] cgf ... nothing in adjoint because ini_fields will reset to adtheta/adsalt to 0 #ifdef ALLOW_SMOOTH_INV il=ilnblnk( xx_theta_file ) write(fnamegeneric(1:80),'(2a)') & xx_theta_file(1:il), '.bckgd' call mdsreadfield(fnamegeneric,32,'RL',nr, & theta, 1, mythid) _EXCH_XYZ_RL( theta, mythid ) il=ilnblnk( xx_salt_file ) write(fnamegeneric(1:80),'(2a)') & xx_salt_file(1:il), '.bckgd' call mdsreadfield(fnamegeneric,32,'RL',nr, & salt, 1, mythid) _EXCH_XYZ_RL( salt, mythid ) #endif END