UFO
ufo_coolskin_mod.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017-2018 UCAR
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 
6 !> Fortran coolskin module for observation operator
7 
9 
10  use fckit_configuration_module, only: fckit_configuration
11  use iso_c_binding
12  use kinds
13 
15  use ufo_basis_mod, only: ufo_basis
16  use ufo_vars_mod
17  use obsspace_mod
18  use missing_values_mod
19 
20 
21  implicit none
22  private
23 
24  integer, parameter :: max_string=800
25 
26 !> Fortran derived type for the observation type
27  type, extends(ufo_basis), public :: ufo_coolskin
28  private
29  contains
30  procedure :: setup => ufo_coolskin_setup
31  procedure :: delete => ufo_coolskin_delete
32  procedure :: simobs => ufo_coolskin_simobs
33  end type ufo_coolskin
34 
35 contains
36 
37 ! ------------------------------------------------------------------------------
38 subroutine ufo_coolskin_setup(self, f_conf)
39 implicit none
40 class(ufo_coolskin), intent(inout) :: self
41 type(fckit_configuration), intent(in) :: f_conf
42 
43 end subroutine ufo_coolskin_setup
44 
45 ! ------------------------------------------------------------------------------
46 subroutine ufo_coolskin_delete(self)
47 implicit none
48 class(ufo_coolskin), intent(inout) :: self
49 
50 end subroutine ufo_coolskin_delete
51 
52 ! ------------------------------------------------------------------------------
53 subroutine ufo_coolskin_simobs(self, geovals, hofx, obss)
54 
56 implicit none
57  class(ufo_coolskin), intent(in) :: self
58  type(ufo_geovals), intent(in) :: geovals
59  real(kind_real), intent(inout) :: hofx(:)
60  type(c_ptr), value, intent(in) :: obss
61 
62  character(len=*), parameter :: myname_="ufo_coolskin_simobs"
63  character(max_string) :: err_msg
64  type(ufo_geoval), pointer :: S_ns,H_I,H_s,R_nl,Td,u
65  integer :: obss_nlocs
66  integer :: iobs
67  real(c_double) :: missing
68  real(kind_real) :: dTc
69 
70  ! Set missing flag
71  missing = missing_value(missing)
72 
73  ! check if nobs is consistent in geovals & hofx
74  obss_nlocs = obsspace_get_nlocs(obss)
75 
76  !nlocs = size(hofx,1)
77  if (geovals%nlocs /= size(hofx,1)) then
78  write(err_msg,*) myname_, ' error: nobs inconsistent!'
79  call abor1_ftn(err_msg)
80  endif
81 
82  ! check if coolskin input variables are in geovals and get them
83 
84  call ufo_geovals_get_var(geovals, var_ocn_sst, td)
85  call ufo_geovals_get_var(geovals, var_sw_rad , r_nl )
86  call ufo_geovals_get_var(geovals, var_latent_heat , h_i )
87  call ufo_geovals_get_var(geovals, var_sens_heat , h_s )
88  call ufo_geovals_get_var(geovals, var_lw_rad , s_ns )
89  call ufo_geovals_get_var(geovals, var_sea_fric_vel , u )
90 
91  ! simulated obs, hofx(iobs)=Ts
92  do iobs = 1, obss_nlocs
93  call ufo_coolskin_sim(hofx(iobs),&
94  dtc,&
95  s_ns%vals(1,iobs),&
96  h_i%vals(1,iobs),&
97  h_s%vals(1,iobs),&
98  r_nl%vals(1,iobs),&
99  td%vals(1,iobs),&
100  u%vals(1,iobs))
101  enddo
102 
103 
104  end subroutine ufo_coolskin_simobs
105 
106 
107 !--------------------------------------------------
108 
109 end module ufo_coolskin_mod
Fortran coolskin module for observation operator.
subroutine ufo_coolskin_delete(self)
subroutine ufo_coolskin_setup(self, f_conf)
subroutine ufo_coolskin_simobs(self, geovals, hofx, obss)
integer, parameter max_string
subroutine, public ufo_coolskin_sim(Ts, dTc, S_ns, H_I, H_s, R_nl, Tdc, u0)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
character(len=maxvarlen), public var_sens_heat
character(len=maxvarlen), public var_latent_heat
character(len=maxvarlen), public var_lw_rad
character(len=maxvarlen), public var_sw_rad
character(len=maxvarlen), public var_ocn_sst
character(len=maxvarlen), parameter, public var_sea_fric_vel
Fortran derived type for the observation type.
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators