New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 9186 for branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90 – NEMO

Ignore:
Timestamp:
2018-01-05T14:29:29+01:00 (6 years ago)
Author:
dford
Message:

Initial implementation of 3D biogeochemistry observation operator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_obs_oper_update_bgc3d/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90

    r9016 r9186  
    164164         & cn_sfco2fbfiles,    & ! Surface fugacity         of carbon dioxide input filenames 
    165165         & cn_spco2fbfiles,    & ! Surface partial pressure of carbon dioxide input filenames 
     166         & cn_plchltotfbfiles, & ! Profile total log10(chlorophyll) input filenames 
     167         & cn_pchltotfbfiles,  & ! Profile total chlorophyll input filenames 
     168         & cn_pno3fbfiles,     & ! Profile nitrate input filenames 
     169         & cn_psi4fbfiles,     & ! Profile silicate input filenames 
     170         & cn_ppo4fbfiles,     & ! Profile phosphate input filenames 
     171         & cn_pdicfbfiles,     & ! Profile dissolved inorganic carbon input filenames 
     172         & cn_palkfbfiles,     & ! Profile alkalinity input filenames 
     173         & cn_pphfbfiles,      & ! Profile pH input filenames 
     174         & cn_po2fbfiles,      & ! Profile dissolved oxygen input filenames 
    166175         & cn_sstbiasfiles       ! SST bias input filenames 
    167176 
     
    188197      LOGICAL :: ln_sfco2        ! Logical switch for surface fugacity         of carbon dioxide obs 
    189198      LOGICAL :: ln_spco2        ! Logical switch for surface partial pressure of carbon dioxide obs 
     199      LOGICAL :: ln_plchltot     ! Logical switch for profile total log10(chlorophyll) obs 
     200      LOGICAL :: ln_pchltot      ! Logical switch for profile total chlorophyll obs 
     201      LOGICAL :: ln_pno3         ! Logical switch for profile nitrate obs 
     202      LOGICAL :: ln_psi4         ! Logical switch for profile silicate obs 
     203      LOGICAL :: ln_ppo4         ! Logical switch for profile phosphate obs 
     204      LOGICAL :: ln_pdic         ! Logical switch for profile dissolved inorganic carbon obs 
     205      LOGICAL :: ln_palk         ! Logical switch for profile alkalinity obs 
     206      LOGICAL :: ln_pph          ! Logical switch for profile pH obs 
     207      LOGICAL :: ln_po2          ! Logical switch for profile dissolved oxygen obs 
    190208      LOGICAL :: ln_nea          ! Logical switch to remove obs near land 
    191209      LOGICAL :: ln_altbias      ! Logical switch for altimeter bias 
     
    227245         &            ln_slchlpic, ln_schltot,                        & 
    228246         &            ln_sspm,     ln_sfco2,    ln_spco2,             & 
     247         &            ln_plchltot, ln_pchltot,  ln_pno3,              & 
     248         &            ln_psi4,     ln_ppo4,     ln_pdic,              & 
     249         &            ln_palk,     ln_pph,      ln_po2,               & 
    229250         &            ln_altbias, ln_sstbias, ln_nea,                 & 
    230251         &            ln_grid_global, ln_grid_search_lookup,          & 
     
    242263         &            cn_schltotfbfiles, cn_sspmfbfiles,              & 
    243264         &            cn_sfco2fbfiles, cn_spco2fbfiles,               & 
     265         &            cn_plchltotfbfiles, cn_pchltotfbfiles,          & 
     266         &            cn_pno3fbfiles, cn_psi4fbfiles, cn_ppo4fbfiles, & 
     267         &            cn_pdicfbfiles, cn_palkfbfiles, cn_pphfbfiles,  & 
     268         &            cn_po2fbfiles,                                  & 
    244269         &            cn_sstbiasfiles, cn_altbiasfile,                & 
    245270         &            cn_gridsearchfile, rn_gridsearchres,            & 
     
    285310      cn_sfco2fbfiles(:)    = '' 
    286311      cn_spco2fbfiles(:)    = '' 
     312      cn_plchltotfbfiles(:) = '' 
     313      cn_pchltotfbfiles(:)  = '' 
     314      cn_pno3fbfiles(:)     = '' 
     315      cn_psi4fbfiles(:)     = '' 
     316      cn_ppo4fbfiles(:)     = '' 
     317      cn_pdicfbfiles(:)     = '' 
     318      cn_palkfbfiles(:)     = '' 
     319      cn_pphfbfiles(:)      = '' 
     320      cn_po2fbfiles(:)      = '' 
    287321      cn_sstbiasfiles(:)    = '' 
    288322      nn_profdavtypes(:)    = -1 
     
    335369         WRITE(numout,*) '             Logical switch for surface fCO2 observations           ln_sfco2 = ', ln_sfco2 
    336370         WRITE(numout,*) '             Logical switch for surface pCO2 observations           ln_spco2 = ', ln_spco2 
     371         WRITE(numout,*) '             Logical switch for profile total logchl obs         ln_plchltot = ', ln_plchltot 
     372         WRITE(numout,*) '             Logical switch for profile total chl obs             ln_pchltot = ', ln_pchltot 
     373         WRITE(numout,*) '             Logical switch for profile nitrate obs                  ln_pno3 = ', ln_pno3 
     374         WRITE(numout,*) '             Logical switch for profile silicate obs                 ln_psi4 = ', ln_psi4 
     375         WRITE(numout,*) '             Logical switch for profile phosphate obs                ln_ppo4 = ', ln_ppo4 
     376         WRITE(numout,*) '             Logical switch for profile DIC obs                      ln_pdic = ', ln_pdic 
     377         WRITE(numout,*) '             Logical switch for profile alkalinity obs               ln_palk = ', ln_palk 
     378         WRITE(numout,*) '             Logical switch for profile pH obs                        ln_pph = ', ln_pph 
     379         WRITE(numout,*) '             Logical switch for profile oxygen obs                    ln_po2 = ', ln_po2 
    337380         WRITE(numout,*) '             Global distribution of observations              ln_grid_global = ', ln_grid_global 
    338381         WRITE(numout,*) '             Logical switch for obs grid search lookup ln_grid_search_lookup = ', ln_grid_search_lookup 
     
    375418      !----------------------------------------------------------------------- 
    376419 
    377       nproftypes = COUNT( (/ln_t3d .OR. ln_s3d, ln_vel3d /) ) 
     420      nproftypes = COUNT( (/ln_t3d .OR. ln_s3d, ln_vel3d, ln_plchltot,          & 
     421         &                  ln_pchltot,  ln_pno3,     ln_psi4,     ln_ppo4,     & 
     422         &                  ln_pdic,     ln_palk,     ln_pph,      ln_po2 /) ) 
    378423      nsurftypes = COUNT( (/ln_sla, ln_sst, ln_sic, ln_sss,                     & 
    379424         &                  ln_slchltot, ln_slchldia, ln_slchlnon, ln_slchldin, & 
    380425         &                  ln_slchlmic, ln_slchlnan, ln_slchlpic, ln_schltot,  & 
    381          &                  ln_sspm, ln_sfco2, ln_spco2 /) ) 
     426         &                  ln_sspm,     ln_sfco2,    ln_spco2 /) ) 
    382427 
    383428      IF ( nproftypes == 0 .AND. nsurftypes == 0 ) THEN 
     
    400445         IF (ln_t3d .OR. ln_s3d) THEN 
    401446            jtype = jtype + 1 
    402             CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'prof  ', & 
     447            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'prof', & 
    403448               &                   cn_profbfiles, ifilesprof, cobstypesprof, clproffiles ) 
    404449         ENDIF 
    405450         IF (ln_vel3d) THEN 
    406451            jtype = jtype + 1 
    407             CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'vel   ', & 
     452            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'vel', & 
    408453               &                   cn_velfbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     454         ENDIF 
     455         IF (ln_plchltot) THEN 
     456            jtype = jtype + 1 
     457            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'plchltot', & 
     458               &                   cn_plchltotfbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     459         ENDIF 
     460         IF (ln_pchltot) THEN 
     461            jtype = jtype + 1 
     462            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pchltot', & 
     463               &                   cn_pchltotfbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     464         ENDIF 
     465         IF (ln_pno3) THEN 
     466            jtype = jtype + 1 
     467            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pno3', & 
     468               &                   cn_pno3fbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     469         ENDIF 
     470         IF (ln_psi4) THEN 
     471            jtype = jtype + 1 
     472            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'psi4', & 
     473               &                   cn_psi4fbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     474         ENDIF 
     475         IF (ln_ppo4) THEN 
     476            jtype = jtype + 1 
     477            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'ppo4', & 
     478               &                   cn_ppo4fbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     479         ENDIF 
     480         IF (ln_pdic) THEN 
     481            jtype = jtype + 1 
     482            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pdic', & 
     483               &                   cn_pdicfbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     484         ENDIF 
     485         IF (ln_palk) THEN 
     486            jtype = jtype + 1 
     487            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'palk', & 
     488               &                   cn_palkfbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     489         ENDIF 
     490         IF (ln_pph) THEN 
     491            jtype = jtype + 1 
     492            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'pph', & 
     493               &                   cn_pphfbfiles, ifilesprof, cobstypesprof, clproffiles ) 
     494         ENDIF 
     495         IF (ln_po2) THEN 
     496            jtype = jtype + 1 
     497            CALL obs_settypefiles( nproftypes, jpmaxnfiles, jtype, 'po2', & 
     498               &                   cn_po2fbfiles, ifilesprof, cobstypesprof, clproffiles ) 
    409499         ENDIF 
    410500 
     
    615705         DO jtype = 1, nproftypes 
    616706 
    617             nvarsprof(jtype) = 2 
    618707            IF ( TRIM(cobstypesprof(jtype)) == 'prof' ) THEN 
     708               nvarsprof(jtype) = 2 
    619709               nextrprof(jtype) = 1 
    620710               llvar1 = ln_t3d 
     
    626716               zgphi2 = gphit 
    627717               zmask2 = tmask 
    628             ENDIF 
    629             IF ( TRIM(cobstypesprof(jtype)) == 'vel' )  THEN 
     718            ELSE IF ( TRIM(cobstypesprof(jtype)) == 'vel' )  THEN 
     719               nvarsprof(jtype) = 2 
    630720               nextrprof(jtype) = 2 
    631721               llvar1 = ln_vel3d 
     
    637727               zgphi2 = gphiv 
    638728               zmask2 = vmask 
     729            ELSE 
     730               nvarsprof(jtype) = 1 
     731               nextrprof(jtype) = 0 
     732               llvar1 = .TRUE. 
     733               llvar2 = .FALSE. 
     734               zglam1 = glamt 
     735               zgphi1 = gphit 
     736               zmask1 = tmask 
     737               zglam2 = glamt 
     738               zgphi2 = gphit 
     739               zmask2 = tmask 
    639740            ENDIF 
    640741 
     
    763864#endif 
    764865#if defined key_hadocc 
    765       USE trc, ONLY :  &           ! HadOCC chlorophyll, fCO2 and pCO2 
     866      USE trc, ONLY :  &           ! HadOCC variables 
     867         & trn, & 
    766868         & HADOCC_CHL, & 
    767869         & HADOCC_FCO2, & 
    768870         & HADOCC_PCO2, & 
    769871         & HADOCC_FILL_FLT 
     872      USE par_hadocc 
    770873#elif defined key_medusa && defined key_foam_medusa 
    771       USE trc, ONLY :  &           ! MEDUSA chlorophyll, fCO2 and pCO2 
     874      USE trc, ONLY :  &           ! MEDUSA variables 
    772875         & trn 
    773       USE par_medusa, ONLY: & 
    774          & jpchn, & 
    775          & jpchd 
     876      USE par_medusa 
    776877#if defined key_roam 
    777878      USE sms_medusa, ONLY: & 
    778879         & f2_pco2w, & 
    779          & f2_fco2w 
     880         & f2_fco2w, & 
     881         & f3_pH 
    780882#endif 
    781883#elif defined key_fabm 
     
    864966               zgphi1(:,:) = gphiu(:,:) 
    865967               zgphi2(:,:) = gphiv(:,:) 
     968 
     969            CASE('plchltot') 
     970#if defined key_hadocc 
     971               ! Chlorophyll from HadOCC 
     972               zprofvar1(:,:,:) = HADOCC_CHL(:,:,:) 
     973#elif defined key_medusa && defined key_foam_medusa 
     974               ! Add non-diatom and diatom chlorophyll from MEDUSA 
     975               zprofvar1(:,:,:) = trn(:,:,:,jpchn) + trn(:,:,:,jpchd) 
     976#elif defined key_fabm 
     977               ! Add all chlorophyll groups from ERSEM 
     978               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_chl1) + trn(:,:,:,jp_fabm_chl2) + & 
     979                  &               trn(:,:,:,jp_fabm_chl3) + trn(:,:,:,jp_fabm_chl4) 
     980#else 
     981               CALL ctl_stop( ' Trying to run plchltot observation operator', & 
     982                  &           ' but no biogeochemical model appears to have been defined' ) 
     983#endif 
     984               zprofmask1(:,:,:) = tmask(:,:,:) 
     985               ! Take the log10 where we can, otherwise exclude 
     986               tiny = 1.0e-20 
     987               WHERE(zprofvar1(:,:,:) > tiny .AND. zprofvar1(:,:,:) /= obfillflt ) 
     988                  zprofvar1(:,:,:)  = LOG10(zprofvar1(:,:,:)) 
     989               ELSEWHERE 
     990                  zprofvar1(:,:,:)  = obfillflt 
     991                  zprofmask1(:,:,:) = 0 
     992               END WHERE 
     993               zglam1(:,:) = glamt(:,:) 
     994               zgphi1(:,:) = gphit(:,:) 
     995 
     996            CASE('pchltot') 
     997#if defined key_hadocc 
     998               ! Chlorophyll from HadOCC 
     999               zprofvar1(:,:,:) = HADOCC_CHL(:,:,:) 
     1000#elif defined key_medusa && defined key_foam_medusa 
     1001               ! Add non-diatom and diatom chlorophyll from MEDUSA 
     1002               zprofvar1(:,:,:) = trn(:,:,:,jpchn) + trn(:,:,:,jpchd) 
     1003#elif defined key_fabm 
     1004               ! Add all chlorophyll groups from ERSEM 
     1005               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_chl1) + trn(:,:,:,jp_fabm_chl2) + & 
     1006                  &               trn(:,:,:,jp_fabm_chl3) + trn(:,:,:,jp_fabm_chl4) 
     1007#else 
     1008               CALL ctl_stop( ' Trying to run pchltot observation operator', & 
     1009                  &           ' but no biogeochemical model appears to have been defined' ) 
     1010#endif 
     1011               zprofmask1(:,:,:) = tmask(:,:,:) 
     1012               zglam1(:,:) = glamt(:,:) 
     1013               zgphi1(:,:) = gphit(:,:) 
     1014 
     1015            CASE('pno3') 
     1016#if defined key_hadocc 
     1017               ! Dissolved inorganic nitrogen from HadOCC 
     1018               zprofvar1(:,:,:) = trn(:,:,:,jp_had_nut) 
     1019#elif defined key_medusa && defined key_foam_medusa 
     1020               ! Dissolved inorganic nitrogen from MEDUSA 
     1021               zprofvar1(:,:,:) = trn(:,:,:,jpdin) 
     1022#elif defined key_fabm 
     1023               ! Nitrate from ERSEM 
     1024               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_n3n) 
     1025#else 
     1026               CALL ctl_stop( ' Trying to run pno3 observation operator', & 
     1027                  &           ' but no biogeochemical model appears to have been defined' ) 
     1028#endif 
     1029               zprofmask1(:,:,:) = tmask(:,:,:) 
     1030               zglam1(:,:) = glamt(:,:) 
     1031               zgphi1(:,:) = gphit(:,:) 
     1032 
     1033            CASE('psi4') 
     1034#if defined key_hadocc 
     1035               CALL ctl_stop( ' Trying to run psi4 observation operator', & 
     1036                  &           ' but HadOCC does not simulate silicate' ) 
     1037#elif defined key_medusa && defined key_foam_medusa 
     1038               ! Silicate from MEDUSA 
     1039               zprofvar1(:,:,:) = trn(:,:,:,jpsil) 
     1040#elif defined key_fabm 
     1041               ! Silicate from ERSEM 
     1042               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_n5s) 
     1043#else 
     1044               CALL ctl_stop( ' Trying to run psi4 observation operator', & 
     1045                  &           ' but no biogeochemical model appears to have been defined' ) 
     1046#endif 
     1047               zprofmask1(:,:,:) = tmask(:,:,:) 
     1048               zglam1(:,:) = glamt(:,:) 
     1049               zgphi1(:,:) = gphit(:,:) 
     1050 
     1051            CASE('ppo4') 
     1052#if defined key_hadocc 
     1053               CALL ctl_stop( ' Trying to run ppo4 observation operator', & 
     1054                  &           ' but HadOCC does not simulate phosphate' ) 
     1055#elif defined key_medusa && defined key_foam_medusa 
     1056               CALL ctl_stop( ' Trying to run ppo4 observation operator', & 
     1057                  &           ' but MEDUSA does not simulate phosphate' ) 
     1058#elif defined key_fabm 
     1059               ! Phosphate from ERSEM 
     1060               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_n1p) 
     1061#else 
     1062               CALL ctl_stop( ' Trying to run ppo4 observation operator', & 
     1063                  &           ' but no biogeochemical model appears to have been defined' ) 
     1064#endif 
     1065               zprofmask1(:,:,:) = tmask(:,:,:) 
     1066               zglam1(:,:) = glamt(:,:) 
     1067               zgphi1(:,:) = gphit(:,:) 
     1068 
     1069            CASE('pdic') 
     1070#if defined key_hadocc 
     1071               ! Dissolved inorganic carbon from HadOCC 
     1072               zprofvar1(:,:,:) = trn(:,:,:,jp_had_dic) 
     1073#elif defined key_medusa && defined key_foam_medusa 
     1074               ! Dissolved inorganic carbon from MEDUSA 
     1075               zprofvar1(:,:,:) = trn(:,:,:,jpdic) 
     1076#elif defined key_fabm 
     1077               ! Dissolved inorganic carbon from ERSEM 
     1078               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_o3c) 
     1079#else 
     1080               CALL ctl_stop( ' Trying to run pdic observation operator', & 
     1081                  &           ' but no biogeochemical model appears to have been defined' ) 
     1082#endif 
     1083               zprofmask1(:,:,:) = tmask(:,:,:) 
     1084               zglam1(:,:) = glamt(:,:) 
     1085               zgphi1(:,:) = gphit(:,:) 
     1086 
     1087            CASE('palk') 
     1088#if defined key_hadocc 
     1089               ! Alkalinity from HadOCC 
     1090               zprofvar1(:,:,:) = trn(:,:,:,jp_had_alk) 
     1091#elif defined key_medusa && defined key_foam_medusa 
     1092               ! Alkalinity from MEDUSA 
     1093               zprofvar1(:,:,:) = trn(:,:,:,jpalk) 
     1094#elif defined key_fabm 
     1095               ! Alkalinity from ERSEM 
     1096               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_o3a) 
     1097#else 
     1098               CALL ctl_stop( ' Trying to run palk observation operator', & 
     1099                  &           ' but no biogeochemical model appears to have been defined' ) 
     1100#endif 
     1101               zprofmask1(:,:,:) = tmask(:,:,:) 
     1102               zglam1(:,:) = glamt(:,:) 
     1103               zgphi1(:,:) = gphit(:,:) 
     1104 
     1105            CASE('pph') 
     1106#if defined key_hadocc 
     1107               CALL ctl_stop( ' Trying to run pph observation operator', & 
     1108                  &           ' but HadOCC has no pH diagnostic defined' ) 
     1109#elif defined key_medusa && defined key_foam_medusa 
     1110               ! pH from MEDUSA 
     1111               zprofvar1(:,:,:) = f3_pH(:,:,:) 
     1112#elif defined key_fabm 
     1113               ! pH from ERSEM 
     1114               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_o3ph) 
     1115#else 
     1116               CALL ctl_stop( ' Trying to run pph observation operator', & 
     1117                  &           ' but no biogeochemical model appears to have been defined' ) 
     1118#endif 
     1119               zprofmask1(:,:,:) = tmask(:,:,:) 
     1120               zglam1(:,:) = glamt(:,:) 
     1121               zgphi1(:,:) = gphit(:,:) 
     1122 
     1123            CASE('po2') 
     1124#if defined key_hadocc 
     1125               CALL ctl_stop( ' Trying to run po2 observation operator', & 
     1126                  &           ' but HadOCC does not simulate oxygen' ) 
     1127#elif defined key_medusa && defined key_foam_medusa 
     1128               ! Oxygen from MEDUSA 
     1129               zprofvar1(:,:,:) = trn(:,:,:,jpoxy) 
     1130#elif defined key_fabm 
     1131               ! Oxygen from ERSEM 
     1132               zprofvar1(:,:,:) = trn(:,:,:,jp_fabm_o2o) 
     1133#else 
     1134               CALL ctl_stop( ' Trying to run po2 observation operator', & 
     1135                  &           ' but no biogeochemical model appears to have been defined' ) 
     1136#endif 
     1137               zprofmask1(:,:,:) = tmask(:,:,:) 
     1138               zglam1(:,:) = glamt(:,:) 
     1139               zgphi1(:,:) = gphit(:,:) 
     1140 
    8661141            CASE DEFAULT 
    8671142               CALL ctl_stop( 'Unknown profile observation type '//TRIM(cobstypesprof(jtype))//' in dia_obs' ) 
    8681143            END SELECT 
     1144             
     1145            IF ( ( TRIM(cobstypesprof(jtype)) /= 'prof' ) .AND. ( TRIM(cobstypesprof(jtype)) /= 'vel' ) ) THEN 
     1146               zprofvar2(:,:,:)  = zprofvar1(:,:,:) 
     1147               zprofmask2(:,:,:) = zprofmask1(:,:,:) 
     1148               zglam2(:,:)       = zglam1(:,:) 
     1149               zgphi2(:,:)       = zgphi1(:,:) 
     1150            ENDIF 
    8691151 
    8701152            CALL obs_prof_opt( profdataqc(jtype), kstp, jpi, jpj, jpk,  & 
Note: See TracChangeset for help on using the changeset viewer.