UFO
ufo_example_tlad_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 module for example tl/ad observation operator
7 
9 
10  use oops_variables_mod
11  use ufo_vars_mod
12 
13  implicit none
14  private
15 
16  !> Fortran derived type for the tl/ad observation operator
17  ! TODO: add to the below type what you need for your tl/ad observation operator
18  ! this type can hold information on trajectory, for example
19  type, public :: ufo_example_tlad
20  private
21  type(oops_variables), public :: obsvars
22  type(oops_variables), public :: geovars
23  contains
24  procedure :: setup => ufo_example_tlad_setup
25  procedure :: settraj => ufo_example_tlad_settraj
26  procedure :: simobs_tl => ufo_example_simobs_tl
27  procedure :: simobs_ad => ufo_example_simobs_ad
28  final :: destructor
29  end type ufo_example_tlad
30 
31 contains
32 
33 ! ------------------------------------------------------------------------------
34 ! TODO: add setup of your TL/AD observation operator (optional)
35 subroutine ufo_example_tlad_setup(self, f_conf)
36 use fckit_configuration_module, only: fckit_configuration
37 implicit none
38 class(ufo_example_tlad), intent(inout) :: self
39 type(fckit_configuration), intent(in) :: f_conf
40 
41 ! TODO: setup input variables varin (updated model variables)
42 ! self%geovars%push_back("variable name")
43 
44 end subroutine ufo_example_tlad_setup
45 
46 ! ------------------------------------------------------------------------------
47 ! TODO: add cleanup of your TL/AD observation operator (optional)
48 subroutine destructor(self)
49 implicit none
50 type(ufo_example_tlad), intent(inout) :: self
51 
52 end subroutine destructor
53 
54 ! ------------------------------------------------------------------------------
55 ! TODO: replace below function with your set trajectory for tl/ad code
56 subroutine ufo_example_tlad_settraj(self, geovals, obss, hofxdiags)
57 use iso_c_binding
59 use obsspace_mod
60 implicit none
61 class(ufo_example_tlad), intent(inout) :: self
62 type(ufo_geovals), intent(in) :: geovals
63 type(c_ptr), value, intent(in) :: obss
64 type(ufo_geovals), intent(inout) :: hofxdiags !non-h(x) diagnostics
65 
66 end subroutine ufo_example_tlad_settraj
67 
68 ! ------------------------------------------------------------------------------
69 ! TODO: replace below function with your tl observation operator.
70 ! Note: this can use information saved from trajectory in your ufo_example_tlad type
71 ! Input geovals parameter represents dx for tangent linear model
72 subroutine ufo_example_simobs_tl(self, geovals, obss, nvars, nlocs, hofx)
73 use iso_c_binding
75 use obsspace_mod
76 implicit none
77 class(ufo_example_tlad), intent(in) :: self
78 type(ufo_geovals), intent(in) :: geovals
79 integer, intent(in) :: nvars, nlocs
80 real(c_double), intent(inout) :: hofx(nvars, nlocs)
81 type(c_ptr), value, intent(in) :: obss
82 
83 end subroutine ufo_example_simobs_tl
84 
85 ! ------------------------------------------------------------------------------
86 ! TODO: replace below function with your ad observation operator.
87 ! Note: this can use information saved from trajectory in your ufo_example_tlad type
88 subroutine ufo_example_simobs_ad(self, geovals, obss, nvars, nlocs, hofx)
89 use iso_c_binding
91 use obsspace_mod
92 implicit none
93 class(ufo_example_tlad), intent(in) :: self
94 type(ufo_geovals), intent(inout) :: geovals
95 integer, intent(in) :: nvars, nlocs
96 real(c_double), intent(in) :: hofx(nvars, nlocs)
97 type(c_ptr), value, intent(in) :: obss
98 
99 
100 end subroutine ufo_example_simobs_ad
101 
102 ! ------------------------------------------------------------------------------
103 
104 end module ufo_example_tlad_mod
Fortran module for example tl/ad observation operator.
subroutine ufo_example_tlad_settraj(self, geovals, obss, hofxdiags)
subroutine ufo_example_simobs_tl(self, geovals, obss, nvars, nlocs, hofx)
subroutine ufo_example_tlad_setup(self, f_conf)
subroutine ufo_example_simobs_ad(self, geovals, obss, nvars, nlocs, hofx)
subroutine, public ufo_geovals_get_var(self, varname, geoval)
Fortran derived type for the tl/ad observation operator.
type to hold interpolated field for one variable, one observation
type to hold interpolated fields required by the obs operators