FE-Project
Loading...
Searching...
No Matches
mod_cpl_component.F90
Go to the documentation of this file.
1!-------------------------------------------------------------------------------
2!> module Coupler component
3!!
4!! @par Description
5!! Coupler component module
6!!
7!! @author Yuta Kawai, Team SCALE
8!!
9!<
10!-------------------------------------------------------------------------------
11#include "scaleFElib.h"
13 !-----------------------------------------------------------------------------
14 !
15 !++ used modules
16 !
17 use scale_precision
18 use scale_io
19 use scale_prof
20 use scale_prc
22
25
26 use mod_cpl_vars, only: couplervars
27 !-----------------------------------------------------------------------------
28 implicit none
29 private
30 !-----------------------------------------------------------------------------
31 !
32 !++ Public type & procedure
33 !
34
35 !> Derived type to manage coupler component
36 type, extends(modelcomponent), public :: couplercomponent
37 type(couplervars) :: vars !< Object to mange variables with coupler component
38 contains
39 procedure, public :: setup => coupler_setup
40 procedure, public :: evaluate_activation => coupler_evaluate_activation
41 procedure, public :: setup_vars => coupler_setup_vars
42 procedure, public :: calc_tendency => coupler_calc_tendency
43 procedure, public :: update => coupler_update
44 procedure, public :: finalize => coupler_finalize
45 end type couplercomponent
46
47contains
48 !> Initialize an object to manage coupler component
49 subroutine coupler_setup( this )
50 class(couplercomponent), intent(inout), target :: this
51 !------------------------------------------------------------------------------
52 return
53 end subroutine coupler_setup
54
55 !> Evaluate whether the coupler component is needed or not
56 subroutine coupler_evaluate_activation( this, &
57 ocn_comp )
58 implicit none
59 class(couplercomponent), intent(inout) :: this
60 class(modelcomponent), intent(in) :: ocn_comp
61
62 logical :: is_needed
63 !------------------------------------------------------------------------------
64
65 log_info( 'CouplerComponent_setup',*) 'Check whether the coupler component is needed'
66
67 if ( ocn_comp%IsActivated() ) then
68 is_needed = .true.
69 else
70 is_needed = .false.
71 end if
72 call this%ModelComponent_Init('COUPLER', is_needed )
73 return
74 end subroutine coupler_evaluate_activation
75
76 !> Setup variables with coupler component
77 subroutine coupler_setup_vars( this, &
78 atm_mesh, ocn_mesh )
79 implicit none
80 class(couplercomponent), intent(inout) :: this
81 class(meshbase3d), intent(in) :: atm_mesh
82 class(meshbase3d), intent(in) :: ocn_mesh
83
84 logical :: ACTIVATE_FLAG
85 class(meshbase2d), pointer :: atm_mesh2D
86 class(meshbase2d), pointer :: ocn_mesh2D
87 !------------------------------------------------------------------------------
88
89 call prof_rapstart( 'Coupler_setup_vars', 1)
90 call atm_mesh%GetMesh2D( atm_mesh2d )
91 call ocn_mesh%GetMesh2D( ocn_mesh2d )
92
93 call this%vars%Init( atm_mesh, atm_mesh2d, ocn_mesh2d )
94 call prof_rapend( 'Coupler_setup_vars', 1)
95 return
96 end subroutine coupler_setup_vars
97
98 !> Finalize an object to manage coupler component
99 subroutine coupler_finalize(this)
100 class(couplercomponent), intent(inout) :: this
101 !------------------------------------------------------------------------------
102 log_info('CouplerComponent_finalize',*)
103 if ( .not. this%IsActivated() ) return
104
105 call this%vars%Final()
106 return
107 end subroutine coupler_finalize
108
109
110! Dummy subroutines for the coupler component -------------------------------
111
112 subroutine coupler_calc_tendency( this, force )
113 class(couplercomponent), intent(inout) :: this
114 logical, intent(in) :: force
115 !------------------------------------------------------------------------------
116 return
117 end subroutine coupler_calc_tendency
118
119 subroutine coupler_update( this )
120 class(couplercomponent), intent(inout) :: this
121 !------------------------------------------------------------------------------
122 return
123 end subroutine coupler_update
124
125end module mod_cpl_component
module Coupler component
subroutine coupler_setup(this)
Initialize an object to manage coupler component.
module Coupler / Variables
module FElib / Mesh / Base 2D
module FElib / Mesh / Base 3D
FElib / model framework / model component.
Derived type to manage coupler component.
Derived type to manage variables with coupler component.
Derived type to manage a computational mesh (base type for 2D domain)
Derived type to manage a computational mesh (base type for 3D domain)