JEDI does not go inside the model structure but needs to be able to call the model one time step at a time.

Model
type :: model
contains
  procedure :: create           ! Constructor
  procedure :: delete           ! Destructor
  procedure :: initialize       ! Initialize (before time loop)
  procedure :: step             ! One time step (inside time loop)
  procedure :: finalize         ! Clean-up (after time loop)
  procedure :: save_trajectory  ! Compute trajectory for TL/AD
  procedure :: print            ! Prints human readable info
end type model
 
subroutine create(self, geom, config)
  type(model), intent(inout) :: self
end subroutine create
 
subroutine delete(self)
  type(model), intent(inout) :: self
end subroutine delete
 
subroutine initialize(self, xx)
  type(model), intent(in)    :: self
  type(state), intent(inout) :: xx
end subroutine initialize
 
subroutine step(self, xx)
  type(model), intent(in)    :: self
  type(state), intent(inout) :: xx
end subroutine step
 
subroutine finalize(self, xx)
  type(model), intent(in)    :: self
  type(state), intent(inout) :: xx
end subroutine finalize
 
subroutine save_trajectory(self, xx, traj)
  type(model), intent(in)         :: self
  type(state), intent(inout)      :: xx
  type(trajectory), intent(inout) :: traj
end subroutine save_trajectory
 
subroutine print(self)
  type(model), intent(in) :: self
end subroutine print

 

The TL/AD is similar:

Linear Model
type :: model
contains
  procedure :: create           ! Constructor
  procedure :: delete           ! Destructor
  procedure :: set_trajectory   ! Set trajectory for TL/AD
 
  procedure :: initialize_tl    ! Initialize TL
  procedure :: step_tl          ! One time step TL
  procedure :: finalize_tl      ! Clean-up TL
 
  procedure :: initialize_ad    ! Initialize AD
  procedure :: step_ad          ! One time step AD
  procedure :: finalize_tad      ! Clean-up AD
  procedure :: print            ! Prints human readable info
end type model
 
subroutine create(self, geom, config)
  type(model), intent(inout) :: self
end subroutine create
 
subroutine delete(self)
  type(model), intent(inout) :: self
end subroutine delete
 
subroutine set_trajectory(self, xx, xlr)
  type(model), intent(inout) :: self
  type(state), intent(in)    :: xx
  type(state), intent(inout) :: xlr
end subroutine set_trajectory
 
subroutine initialize_tl(self, dx)
  type(model), intent(in)        :: self
  type(increment), intent(inout) :: dx
end subroutine initialize_tl
 
subroutine step_tl(self, dx)
  type(model), intent(in)        :: self
  type(increment), intent(inout) :: dx
end subroutine step_tl
 
subroutine finalize_tl(self, dx)
  type(model), intent(in)        :: self
  type(increment), intent(inout) :: dx
end subroutine finalize_tl
 
subroutine initialize_ad(self, dx)
  type(model), intent(in)        :: self
  type(increment), intent(inout) :: dx
end subroutine initialize_ad
 
subroutine step_ad(self, dx)
  type(model), intent(in)        :: self
  type(increment), intent(inout) :: dx
end subroutine step_ad
 
subroutine finalize_ad(self, dx)
  type(model), intent(in)        :: self
  type(increment), intent(inout) :: dx
end subroutine finalize_ad
 
subroutine print(self)
  type(model), intent(in) :: self
end subroutine print

 

 

  • No labels