3 use fckit_mpi_module,
only: fckit_mpi_comm, fckit_mpi_sum
34 subroutine getvalues(geom, state, locs, vars, gom, traj)
45 character(len=*),
parameter :: myname =
'getvalues' 47 type(fckit_mpi_comm) :: f_comm
49 type(
bump_type),
pointer :: pbump => null()
50 logical,
target :: bump_alloc = .false.
51 logical,
pointer :: pbump_alloc => null()
52 integer,
target,
save :: bumpid = 1000
53 integer,
pointer :: pbumpid => null()
55 integer :: ii, jj, ji, jvar, jlev, jloc, ngrid, nlocs, nlocsg
56 real(kind=kind_real),
allocatable :: mod_state(:,:)
57 real(kind=kind_real),
allocatable :: obs_state(:,:)
58 real(kind=kind_real),
target,
allocatable :: geovale(:,:,:), geovalm(:,:,:)
59 real(kind=kind_real),
pointer :: geoval(:,:,:)
63 integer :: isc,iec,jsc,jec,npz,i,j
66 real(kind=kind_real),
allocatable :: prsi(:,:,:)
67 real(kind=kind_real),
allocatable :: prs (:,:,:)
68 real(kind=kind_real),
allocatable :: logp(:,:,:)
71 real(kind=kind_real),
allocatable :: ql_ade(:,:,:)
72 real(kind=kind_real),
allocatable :: qi_ade(:,:,:)
73 real(kind=kind_real),
allocatable :: ql_efr(:,:,:)
74 real(kind=kind_real),
allocatable :: qi_efr(:,:,:)
75 real(kind=kind_real),
allocatable :: qmr(:,:,:)
76 real(kind=kind_real),
allocatable :: water_coverage_m(:,:)
79 integer ,
allocatable :: vegetation_type(:)
80 integer ,
allocatable :: land_type(:)
81 integer ,
allocatable :: soil_type(:)
82 real(kind=kind_real),
allocatable :: wind_speed(:)
83 real(kind=kind_real),
allocatable :: wind_direction(:)
84 real(kind=kind_real),
allocatable :: water_coverage(:)
85 real(kind=kind_real),
allocatable :: land_coverage(:)
86 real(kind=kind_real),
allocatable :: ice_coverage(:)
87 real(kind=kind_real),
allocatable :: snow_coverage(:)
88 real(kind=kind_real),
allocatable :: lai(:)
89 real(kind=kind_real),
allocatable :: water_temperature(:)
90 real(kind=kind_real),
allocatable :: land_temperature(:)
91 real(kind=kind_real),
allocatable :: ice_temperature(:)
92 real(kind=kind_real),
allocatable :: snow_temperature(:)
93 real(kind=kind_real),
allocatable :: soil_moisture_content(:)
94 real(kind=kind_real),
allocatable :: vegetation_fraction(:)
95 real(kind=kind_real),
allocatable :: soil_temperature(:)
96 real(kind=kind_real),
allocatable :: snow_depth(:)
97 logical,
parameter :: use_compress = .true.
108 ngrid = (iec-isc+1)*(jec-jsc+1)
114 f_comm = fckit_mpi_comm()
115 call f_comm%allreduce(nlocs,nlocsg,fckit_mpi_sum())
116 if (nlocsg == 0)
then 117 if (
present(traj))
then 126 if (
present(traj))
then 130 if (.not. traj%lalloc)
then 134 if (.not.
allocated(traj%t))
allocate(traj%t(isc:iec,jsc:jec,1:npz))
135 if (.not.
allocated(traj%q))
allocate(traj%q(isc:iec,jsc:jec,1:npz))
140 pbump_alloc => traj%lalloc
141 pbumpid => traj%bumpid
149 pbump_alloc => bump_alloc
155 if (.not. pbump_alloc)
then 162 allocate(mod_state(ngrid,1))
163 allocate(obs_state(nlocs,1))
168 allocate(geovale(isc:iec,jsc:jec,npz+1))
169 allocate(geovalm(isc:iec,jsc:jec,npz))
173 allocate(prsi(isc:iec,jsc:jec,npz+1))
174 allocate(prs(isc:iec,jsc:jec,npz ))
175 allocate(logp(isc:iec,jsc:jec,npz ))
181 allocate(wind_speed(nlocs))
182 allocate(wind_direction(nlocs))
183 allocate(land_type(nlocs))
184 allocate(vegetation_type(nlocs))
185 allocate(soil_type(nlocs))
186 allocate(water_coverage(nlocs))
187 allocate(land_coverage(nlocs))
188 allocate(ice_coverage(nlocs))
189 allocate(snow_coverage(nlocs))
191 allocate(water_temperature(nlocs))
192 allocate(land_temperature(nlocs))
193 allocate(ice_temperature(nlocs))
194 allocate(snow_temperature(nlocs))
195 allocate(soil_moisture_content(nlocs))
196 allocate(vegetation_fraction(nlocs))
197 allocate(soil_temperature(nlocs))
198 allocate(snow_depth(nlocs))
200 wind_speed = 0.0_kind_real
201 wind_direction = 0.0_kind_real
205 water_coverage = 0.0_kind_real
206 land_coverage = 0.0_kind_real
207 ice_coverage = 0.0_kind_real
208 snow_coverage = 0.0_kind_real
210 water_temperature = 0.0_kind_real
211 land_temperature = 0.0_kind_real
212 ice_temperature = 0.0_kind_real
213 snow_temperature = 0.0_kind_real
214 soil_moisture_content = 0.0_kind_real
215 vegetation_fraction = 0.0_kind_real
216 soil_temperature = 0.0_kind_real
217 snow_depth = 0.0_kind_real
219 if (state%havecrtmfields)
then 221 call crtm_surface( geom, nlocs, ngrid, locs%lat(:), locs%lon(:), &
222 state%slmsk, state%sheleg, state%tsea, state%vtype, &
223 state%stype, state%vfrac, state%stc, state%smc, state%snwdph, &
224 state%u_srf,state%v_srf,state%f10m, &
225 land_type, vegetation_type, soil_type, water_coverage, land_coverage, ice_coverage, &
226 snow_coverage, lai, water_temperature, land_temperature, ice_temperature, &
227 snow_temperature, soil_moisture_content, vegetation_fraction, soil_temperature, snow_depth, &
228 wind_speed, wind_direction )
234 allocate(ql_ade(isc:iec,jsc:jec,npz))
235 allocate(qi_ade(isc:iec,jsc:jec,npz))
236 allocate(ql_efr(isc:iec,jsc:jec,npz))
237 allocate(qi_efr(isc:iec,jsc:jec,npz))
238 allocate(qmr(isc:iec,jsc:jec,npz))
239 allocate(water_coverage_m(isc:iec,jsc:jec))
241 ql_ade = 0.0_kind_real
242 qi_ade = 0.0_kind_real
243 ql_efr = 0.0_kind_real
244 qi_efr = 0.0_kind_real
246 if (state%havecrtmfields)
then 249 water_coverage_m = 0.0_kind_real
252 if (state%slmsk(i,j) == 0) water_coverage_m(i,j) = 1.0_kind_real
256 call crtm_ade_efr( geom,prsi,state%t,state%delp,water_coverage_m,state%q, &
257 state%ql,state%qi,ql_ade,qi_ade,ql_efr,qi_efr )
269 geovalm = 0.0_kind_real
270 geovale = 0.0_kind_real
276 select case (trim(vars%fldnames(jvar)))
278 case (
"upper_air_u_component")
285 case (
"upper_air_v_component")
299 case (
"specific_humidity")
306 case (
"virtual_temperature")
310 call t_to_tv(geom,state%t,state%q,geovalm)
313 case (
"atmosphere_ln_pressure_coordinate")
317 geovalm = log(0.001_kind_real) + logp
320 case (
"humidity_mixing_ratio")
326 case (
"air_pressure")
330 geovalm = prs / 100.0_kind_real
333 case (
"air_pressure_levels")
337 geovale = prsi / 100.0_kind_real
340 case (
"geopotential_height")
342 call geop_height(geom,prs,prsi,state%t,state%q,state%phis,use_compress,geovalm)
347 case (
"geopotential_height_levels")
349 call geop_height_levels(geom,prs,prsi,state%t,state%q,state%phis,use_compress,geovale)
354 case (
"sfc_geopotential_height")
358 geovalm(:,:,1) = state%phis /
grav 361 case (
"mass_concentration_of_ozone_in_air")
368 case (
"mass_concentration_of_carbon_dioxide_in_air")
372 geovalm = 407.0_kind_real
375 case (
"atmosphere_mass_content_of_cloud_liquid_water")
382 case (
"atmosphere_mass_content_of_cloud_ice")
389 case (
"effective_radius_of_cloud_liquid_water_particle")
396 case (
"effective_radius_of_cloud_ice_particle")
403 case (
"Water_Fraction")
407 obs_state(:,1) = water_coverage
409 case (
"Land_Fraction")
413 obs_state(:,1) = land_coverage
415 case (
"Ice_Fraction")
419 obs_state(:,1) = ice_coverage
421 case (
"Snow_Fraction")
425 obs_state(:,1) = snow_coverage
427 case (
"Water_Temperature")
431 obs_state(:,1) = water_temperature
433 case (
"Land_Temperature")
437 obs_state(:,1) = land_temperature
439 case (
"Ice_Temperature")
443 obs_state(:,1) = ice_temperature
445 case (
"Snow_Temperature")
449 obs_state(:,1) = snow_temperature
455 obs_state(:,1) = snow_depth
457 case (
"Vegetation_Fraction")
461 obs_state(:,1) = vegetation_fraction
463 case (
"Sfc_Wind_Speed")
467 obs_state(:,1) = wind_speed
469 case (
"Sfc_Wind_Direction")
473 obs_state(:,1) = wind_direction
481 case (
"Soil_Moisture")
485 obs_state(:,1) = soil_moisture_content
487 case (
"Soil_Temperature")
491 obs_state(:,1) = soil_temperature
493 case (
"Land_Type_Index")
497 obs_state(:,1) =
real(land_type,
kind_real)
499 case (
"Vegetation_Type")
503 obs_state(:,1) =
real(vegetation_type,
kind_real)
509 obs_state(:,1) =
real(soil_type,
kind_real)
513 call abor1_ftn(trim(myname)//
"unknown variable")
536 mod_state(ii, 1) = geoval(ji, jj, jlev)
539 call pbump%apply_obsop(mod_state,obs_state)
540 do jloc = 1,locs%nlocs
541 gom%geovals(jvar)%vals(jlev,locs%indx(jloc)) = obs_state(jloc,1)
545 do jloc = 1,locs%nlocs
546 gom%geovals(jvar)%vals(nvl,locs%indx(jloc)) = obs_state(jloc,1)
554 if (.not.
present(traj))
then 564 if (
allocated(mod_state ))
deallocate(mod_state )
565 if (
allocated(obs_state ))
deallocate(obs_state )
566 if (
allocated(geovale ))
deallocate(geovale )
567 if (
allocated(geovalm ))
deallocate(geovalm )
568 if (
allocated(prsi ))
deallocate(prsi )
569 if (
allocated(prs ))
deallocate(prs )
570 if (
allocated(logp ))
deallocate(logp )
571 if (
allocated(wind_speed ))
deallocate(wind_speed )
572 if (
allocated(wind_direction ))
deallocate(wind_direction )
573 if (
allocated(land_type ))
deallocate(land_type )
574 if (
allocated(vegetation_type ))
deallocate(vegetation_type )
575 if (
allocated(soil_type ))
deallocate(soil_type )
576 if (
allocated(water_coverage ))
deallocate(water_coverage )
577 if (
allocated(land_coverage ))
deallocate(land_coverage )
578 if (
allocated(ice_coverage ))
deallocate(ice_coverage )
579 if (
allocated(snow_coverage ))
deallocate(snow_coverage )
580 if (
allocated(lai ))
deallocate(lai )
581 if (
allocated(water_temperature ))
deallocate(water_temperature )
582 if (
allocated(land_temperature ))
deallocate(land_temperature )
583 if (
allocated(ice_temperature ))
deallocate(ice_temperature )
584 if (
allocated(snow_temperature ))
deallocate(snow_temperature )
585 if (
allocated(soil_moisture_content))
deallocate(soil_moisture_content)
586 if (
allocated(vegetation_fraction ))
deallocate(vegetation_fraction )
587 if (
allocated(soil_temperature ))
deallocate(soil_temperature )
588 if (
allocated(snow_depth ))
deallocate(snow_depth )
589 if (
allocated(ql_ade ))
deallocate(ql_ade )
590 if (
allocated(qi_ade ))
deallocate(qi_ade )
591 if (
allocated(ql_efr ))
deallocate(ql_efr )
592 if (
allocated(qi_efr ))
deallocate(qi_efr )
593 if (
allocated(qmr ))
deallocate(qmr )
594 if (
allocated(water_coverage_m ))
deallocate(water_coverage_m )
600 subroutine getvalues_tl(geom, inc, locs, vars, gom, traj)
610 character(len=*),
parameter :: myname =
'getvalues_tl' 612 integer :: ii, jj, ji, jvar, jlev, jloc
613 real(kind=kind_real),
allocatable :: mod_increment(:,:)
614 real(kind=kind_real),
allocatable :: obs_increment(:,:)
617 real(kind=kind_real),
target,
allocatable :: geovale(:,:,:), geovalm(:,:,:)
618 real(kind=kind_real),
pointer :: geoval(:,:,:)
621 integer :: isc, iec, jsc, jec, npz
626 if (.not.traj%lalloc) &
627 call abor1_ftn(trim(myname)//
" trajectory for this obs op not found")
632 if (traj%noobs)
return 646 allocate(mod_increment(traj%ngrid,1))
647 allocate(obs_increment(locs%nlocs,1))
652 allocate(geovale(isc:iec,jsc:jec,npz+1))
653 allocate(geovalm(isc:iec,jsc:jec,npz))
660 geovalm = 0.0_kind_real
661 geovale = 0.0_kind_real
665 select case (trim(vars%fldnames(jvar)))
667 case (
"upper_air_u_component")
674 case (
"upper_air_v_component")
688 case (
"specific_humidity")
695 case (
"virtual_temperature")
699 call t_to_tv_tl(geom, traj%t, inc%t, traj%q, inc%q, geovalm )
702 case (
"humidity_mixing_ratio")
711 call abor1_ftn(trim(myname)//
"unknown variable")
735 mod_increment(ii, 1) = geoval(ji, jj, jlev)
738 call traj%bump%apply_obsop(mod_increment,obs_increment)
739 do jloc = 1,locs%nlocs
740 gom%geovals(jvar)%vals(jlev,locs%indx(jloc)) = obs_increment(jloc,1)
744 do jloc = 1,locs%nlocs
745 gom%geovals(jvar)%vals(nvl,locs%indx(jloc)) = obs_increment(jloc,1)
753 deallocate(geovalm,geovale)
755 deallocate(mod_increment)
756 deallocate(obs_increment)
762 subroutine getvalues_ad(geom, inc, locs, vars, gom, traj)
772 character(len=*),
parameter :: myname =
'getvalues_ad' 774 integer :: ii, jj, ji, jvar, jlev, jloc
775 real(kind=kind_real),
allocatable :: mod_increment(:,:)
776 real(kind=kind_real),
allocatable :: obs_increment(:,:)
779 real(kind=kind_real),
target,
allocatable :: geovale(:,:,:), geovalm(:,:,:)
780 real(kind=kind_real),
pointer :: geoval(:,:,:)
783 integer :: isc, iec, jsc, jec, npz
788 if (.not.traj%lalloc) &
789 call abor1_ftn(trim(myname)//
" trajectory for this obs op not found")
794 if (traj%noobs)
return 808 allocate(mod_increment(traj%ngrid,1))
809 allocate(obs_increment(locs%nlocs,1))
814 allocate(geovale(isc:iec,jsc:jec,npz+1))
815 allocate(geovalm(isc:iec,jsc:jec,npz))
817 geovale = 0.0_kind_real
818 geovalm = 0.0_kind_real
829 select case (trim(vars%fldnames(jvar)))
831 case (
"upper_air_u_component")
837 case (
"upper_air_v_component")
849 case (
"specific_humidity")
855 case (
"virtual_temperature")
861 case (
"humidity_mixing_ratio")
869 call abor1_ftn(trim(myname)//
"unknown variable")
878 do jloc = 1,locs%nlocs
879 obs_increment(jloc,1) = gom%geovals(jvar)%vals(jlev,locs%indx(jloc))
881 call traj%bump%apply_obsop_ad(obs_increment,mod_increment)
886 geoval(ji, jj, jlev) = mod_increment(ii, 1)
891 do jloc = 1,locs%nlocs
892 obs_increment(jloc,1) = gom%geovals(jvar)%vals(nvl,locs%indx(jloc))
899 select case (trim(vars%fldnames(jvar)))
901 case (
"upper_air_u_component")
905 case (
"upper_air_v_component")
913 case (
"specific_humidity")
917 case (
"virtual_temperature")
919 call t_to_tv_ad(geom, traj%t, inc%t, traj%q, inc%q, geovalm )
921 case (
"humidity_mixing_ratio")
927 call abor1_ftn(trim(myname)//
"unknown variable")
931 geovale = 0.0_kind_real
932 geovalm = 0.0_kind_real
936 deallocate(mod_increment)
937 deallocate(obs_increment)
946 type(ufo_geovals),
intent(inout) :: gom
947 integer,
intent(in) :: jvar
948 integer,
intent(in) :: gvlev
949 logical,
intent(in) :: lastvar
951 if (.not.
allocated(gom%geovals(jvar)%vals))
then 954 gom%geovals(jvar)%nval = gvlev
957 allocate(gom%geovals(jvar)%vals(gom%geovals(jvar)%nval,gom%geovals(jvar)%nobs))
958 gom%geovals(jvar)%vals = 0.0_kind_real
961 if (lastvar) gom%linit = .true.
974 type(fv3jedi_geom),
intent(in) :: geom
975 type(ioda_locs),
intent(in) :: locs
976 type(bump_type),
intent(inout) :: bump
977 integer,
intent(in) :: bumpid
981 real(kind=kind_real),
allocatable :: mod_lat(:), mod_lon(:)
982 real(kind=kind_real),
allocatable :: area(:),vunit(:,:)
983 logical,
allocatable :: lmask(:,:)
985 character(len=5) :: cbumpcount
986 character(len=255) :: bump_nam_prefix
988 type(fckit_mpi_comm) :: f_comm
993 f_comm = fckit_mpi_comm()
998 write(cbumpcount,
"(I0.5)") bumpid
999 bump_nam_prefix =
'fv3jedi_bump_data_'//cbumpcount
1003 mod_num = (geom%iec - geom%isc + 1) * (geom%jec - geom%jsc + 1)
1008 allocate(mod_lat(mod_num))
1009 allocate(mod_lon(mod_num))
1010 mod_lat = reshape(
rad2deg*geom%grid_lat(geom%isc:geom%iec, &
1011 geom%jsc:geom%jec), &
1013 mod_lon = reshape(
rad2deg*geom%grid_lon(geom%isc:geom%iec, &
1014 geom%jsc:geom%jec), &
1015 [mod_num] ) - 180.0_kind_real
1023 bump%nam%obsop_interp =
'bilin' 1026 bump%nam%prefix = trim(bump_nam_prefix)
1027 bump%nam%default_seed = .true.
1028 bump%nam%new_obsop = .true.
1033 allocate(area(mod_num))
1034 allocate(vunit(mod_num,1))
1035 allocate(lmask(mod_num,1))
1042 call bump%setup_online( mod_num,1,1,1,mod_lon,mod_lat,area,vunit,lmask, &
1043 nobs=locs%nlocs,lonobs=locs%lon(:)-180.0_kind_real,latobs=locs%lat(:) )
1046 call bump%run_drivers
1062 character(len=*),
intent(in) :: cop
1063 type(ioda_locs),
intent(in) :: locs
1064 type(ufo_vars),
intent(in) :: vars
1065 type(ufo_geovals),
intent(in) :: gom
1066 integer,
intent(in) :: jvar
1068 character(len=255) :: cinfo
1070 cinfo=
"fv3jedi_"//trim(cop)//
" checks:" 1074 if( gom%nvar .ne. vars%nv )
then 1075 call abor1_ftn(trim(cinfo)//
" nvar wrong size")
1077 if( .not.
allocated(gom%geovals) )
then 1078 call abor1_ftn(trim(cinfo)//
" geovals not allocated")
1080 if(
size(gom%geovals) .ne. vars%nv )
then 1081 call abor1_ftn(trim(cinfo)//
" size geovals does not match number of vars from UFo")
1083 if (.not.gom%linit)
then 1086 if (.not.
allocated(gom%geovals(jvar)%vals))
then 1087 call abor1_ftn(trim(cinfo)//
"vals not allocated")
Fortran derived type to hold FV3JEDI increment.
subroutine initialize_bump(geom, locs, bump, bumpid)
real(kind=kind_real), parameter, public rad2deg
Fortran derived type to hold observation locations.
subroutine, public delp_to_pe_p_logp(geom, delp, pe, p, logp)
Fortran derived type to hold FV3JEDI state.
Fortran module handling interpolation trajectory for the FV3 model.
subroutine, public getvalues(geom, state, locs, vars, gom, traj)
real(kind=kind_real), parameter, public grav
subroutine, public crtm_mixratio(geom, q, qmr)
subroutine allocate_geovals_vals(gom, jvar, gvlev, lastvar)
Fortran derived type to hold geometry data for the FV3JEDI model.
subroutine, public getvalues_ad(geom, inc, locs, vars, gom, traj)
Variable transforms on moisture variables for fv3-jedi Daniel Holdaway, NASA/JCSDA.
subroutine, public t_to_tv_tl(geom, T, T_tl, q, q_tl, Tv_tl)
Fortran derived type to represent model variables.
subroutine, public geop_height_levels(geom, prs, prsi, T, q, phis, use_compress, gphi)
subroutine, public crtm_ade_efr(geom, p, T, delp, sea_frac, q, ql, qi, ql_ade, qi_ade, ql_efr, qi_efr)
Compute cloud area density and effective radius for the crtm -----------—
Variable transforms on temperature variables for fv3-jedi Daniel Holdaway, NASA/JCSDA.
subroutine, public t_to_tv(geom, T, q, Tv)
subroutine, public crtm_mixratio_ad(geom, q, q_ad, qmr_ad)
subroutine, public getvalues_tl(geom, inc, locs, vars, gom, traj)
subroutine getvalues_checks(cop, locs, vars, gom, jvar)
subroutine, public geop_height(geom, prs, prsi, T, q, phis, use_compress, gph)
type to hold interpolated fields required by the obs operators
Utilities for increment for the FV3JEDI model.
Utilities for state for the FV3JEDI model.
Fortran module handling geometry for the FV3 model.
Variable transforms on pressure variables for fv3-jedi Daniel Holdaway, NASA/JCSDA.
subroutine, public t_to_tv_ad(geom, T, T_ad, q, q_ad, Tv_ad)
real(kind=kind_real), parameter, public constoz
subroutine, public crtm_mixratio_tl(geom, q, q_tl, qmr_tl)
subroutine, public crtm_surface(geom, nobs, ngrid, lats_ob, lons_ob, fld_slmsk, fld_sheleg, fld_tsea, fld_vtype, fld_stype, fld_vfrac, fld_stc, fld_smc, fld_snwdph, fld_u_srf, fld_v_srf, fld_f10m, land_type, vegetation_type, soil_type, water_coverage, land_coverage, ice_coverage, snow_coverage, lai, water_temperature, land_temperature, ice_temperature, snow_temperature, soil_moisture_content, vegetation_fraction, soil_temperature, snow_depth, wind_speed, wind_direction)
Fortran module handling observation locations.
Variable transforms/interpolation for surface variables in fv3-jedi Daniel Holdaway, NASA/JCSDA.
integer, parameter, public kind_real