Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
adjoint_fluid_scheme.f90
Go to the documentation of this file.
1
34!
35module adjoint_fluid_scheme
36 use gather_scatter, only: gs_t
37 use checkpoint, only: chkp_t
38 use num_types, only: rp
39 use field, only: field_t
40 use space, only: space_t
41 use dofmap, only: dofmap_t
42 use coefs, only: coef_t
43 use dirichlet, only: dirichlet_t
44 use precon, only: pc_t, precon_factory, precon_destroy
45 use fluid_stats, only: fluid_stats_t
46 use bc_list, only: bc_list_t
47 use mesh, only: mesh_t, neko_msh_max_zlbl_len
48 use time_state, only: time_state_t
49 use time_scheme_controller, only: time_scheme_controller_t
50 use logger, only: log_size
51 use json_module, only: json_file
52 use user_intf, only: user_t, user_material_properties_intf
53 use field_series, only: field_series_t
54 use time_step_controller, only: time_step_controller_t
55 use field_list, only : field_list_t
56 use interpolation, only: interpolator_t
57 use scratch_registry, only : scratch_registry_t
58
59 implicit none
60 private
61 public :: adjoint_fluid_scheme_t, adjoint_fluid_scheme_factory
62
64 type, abstract :: adjoint_fluid_scheme_t
66 character(len=:), allocatable :: name
67
68 type(space_t) :: xh
69 type(dofmap_t) :: dm_xh
70 type(gs_t) :: gs_xh
71 type(coef_t) :: c_xh
72
73 ! Tim. This will need to be refactored, but since we have so many extra
74 ! terms that involve products of variables, we often need to increase our
75 ! quadrature. So it's natural to have an over integration coef and a
76 ! way of converting between them
77 type(space_t) :: xh_gl
78 type(dofmap_t) :: dm_xh_gl
79 type(gs_t) :: gs_xh_gl
80 type(coef_t) :: c_xh_gl
82 type(interpolator_t) :: gll_to_gl
84 type(scratch_registry_t) :: scratch_gl
85
86 type(time_scheme_controller_t), allocatable :: ext_bdf
87
89 type(field_t), pointer :: u_adj => null()
90 type(field_t), pointer :: v_adj => null()
91 type(field_t), pointer :: w_adj => null()
92 type(field_t), pointer :: p_adj => null()
93 type(field_series_t) :: ulag, vlag, wlag
94
95 type(field_t), pointer :: u_b => null()
96 type(field_t), pointer :: v_b => null()
97 type(field_t), pointer :: w_b => null()
98 type(field_t), pointer :: p_b => null()
99
101 type(chkp_t), pointer :: chkp => null()
102
104 type(field_t), pointer :: f_adj_x => null()
106 type(field_t), pointer :: f_adj_y => null()
108 type(field_t), pointer :: f_adj_z => null()
109
111 ! List of boundary conditions for pressure
112 type(bc_list_t) :: bcs_prs
113 ! List of boundary conditions for velocity
114 type(bc_list_t) :: bcs_vel
115
116 type(json_file), pointer :: params
117 type(mesh_t), pointer :: msh => null()
118
120 character(len=NEKO_MSH_MAX_ZLBL_LEN), allocatable :: bc_labels(:)
121
123 type(field_t) :: rho
124
126 type(field_t) :: mu
127
129 type(field_list_t) :: material_properties
130
132 logical :: freeze = .false.
133
135 procedure(user_material_properties_intf), nopass, pointer :: &
136 user_material_properties => null()
137
138 contains
140 procedure(adjoint_fluid_scheme_init_intrf), pass(this), deferred :: init
142 procedure(adjoint_fluid_scheme_free_intrf), pass(this), deferred :: free
144 procedure(adjoint_fluid_scheme_step_intrf), pass(this), deferred :: step
146 procedure(adjoint_fluid_scheme_restart_intrf), &
147 pass(this), deferred :: restart
149 procedure(adjoint_fluid_scheme_setup_bcs_intrf), pass(this), deferred :: &
150 setup_bcs
151
153 procedure(validate_intrf), pass(this), deferred :: validate
155 procedure(fluid_scheme_base_compute_cfl_intrf), pass(this), deferred :: compute_cfl
157 procedure(update_material_properties), pass(this), deferred :: update_material_properties
159
161 abstract interface
162 subroutine adjoint_fluid_init_all_intrf(this, msh, lx, params, kspv_init, &
163 kspp_init, scheme, user)
165 import mesh_t
166 import json_file
167 import user_t
168 class(adjoint_fluid_scheme_t), target, intent(inout) :: this
169 type(mesh_t), target, intent(inout) :: msh
170 integer, intent(inout) :: lx
171 type(json_file), target, intent(inout) :: params
172 logical, intent(inout) :: kspv_init
173 logical, intent(inout) :: kspp_init
174 type(user_t), target, intent(in) :: user
175 character(len=*), intent(in) :: scheme
176 end subroutine adjoint_fluid_init_all_intrf
177 end interface
178
180 abstract interface
181 subroutine adjoint_fluid_init_common_intrf(this, msh, lx, params, scheme, &
182 user, kspv_init)
184 import mesh_t
185 import json_file
186 import user_t
187 class(adjoint_fluid_scheme_t), target, intent(inout) :: this
188 type(mesh_t), target, intent(inout) :: msh
189 integer, intent(inout) :: lx
190 character(len=*), intent(in) :: scheme
191 type(json_file), target, intent(inout) :: params
192 type(user_t), target, intent(in) :: user
193 logical, intent(in) :: kspv_init
194 end subroutine adjoint_fluid_init_common_intrf
195 end interface
196
198 abstract interface
199 subroutine adjoint_fluid_free_intrf(this)
201 class(adjoint_fluid_scheme_t), intent(inout) :: this
202 end subroutine adjoint_fluid_free_intrf
203 end interface
204
206 abstract interface
207 subroutine adjoint_fluid_scheme_init_intrf(this, msh, lx, params, user, &
208 chkp)
210 import json_file
211 import mesh_t
212 import user_t
213 import chkp_t
214 class(adjoint_fluid_scheme_t), target, intent(inout) :: this
215 type(mesh_t), target, intent(inout) :: msh
216 integer, intent(in) :: lx
217 type(json_file), target, intent(inout) :: params
218 type(user_t), target, intent(in) :: user
219 type(chkp_t), target, intent(inout) :: chkp
220 end subroutine adjoint_fluid_scheme_init_intrf
221 end interface
222
224 abstract interface
225 subroutine adjoint_fluid_scheme_free_intrf(this)
227 class(adjoint_fluid_scheme_t), intent(inout) :: this
228 end subroutine adjoint_fluid_scheme_free_intrf
229 end interface
230
232 abstract interface
233 subroutine adjoint_fluid_scheme_step_intrf(this, time, dt_controller)
234 import time_state_t
236 import time_step_controller_t
237 class(adjoint_fluid_scheme_t), target, intent(inout) :: this
238 type(time_state_t), intent(in) :: time
239 type(time_step_controller_t), intent(in) :: dt_controller
240 end subroutine adjoint_fluid_scheme_step_intrf
241 end interface
242
244 abstract interface
245 subroutine adjoint_fluid_scheme_restart_intrf(this, chkp)
247 import chkp_t
248 class(adjoint_fluid_scheme_t), target, intent(inout) :: this
249 type(chkp_t), intent(inout) :: chkp
250 end subroutine adjoint_fluid_scheme_restart_intrf
251 end interface
252
254 abstract interface
255 subroutine adjoint_fluid_scheme_setup_bcs_intrf(this, user, params)
256 import adjoint_fluid_scheme_t, user_t, json_file
257 class(adjoint_fluid_scheme_t), intent(inout) :: this
258 type(user_t), target, intent(in) :: user
259 type(json_file), intent(inout) :: params
260 end subroutine adjoint_fluid_scheme_setup_bcs_intrf
261 end interface
262
264 abstract interface
265 subroutine validate_intrf(this)
267 class(adjoint_fluid_scheme_t), target, intent(inout) :: this
268 end subroutine validate_intrf
269 end interface
270
272 abstract interface
273 subroutine update_material_properties(this, time)
274 import adjoint_fluid_scheme_t, time_state_t
275 class(adjoint_fluid_scheme_t), intent(inout) :: this
276 type(time_state_t), intent(in) :: time
277 end subroutine update_material_properties
278 end interface
279
281 abstract interface
282 function fluid_scheme_base_compute_cfl_intrf(this, dt) result(c)
284 import rp
285 class(adjoint_fluid_scheme_t), intent(in) :: this
286 real(kind=rp), intent(in) :: dt
287 real(kind=rp) :: c
288 end function fluid_scheme_base_compute_cfl_intrf
289 end interface
290
291 interface
292
293 module subroutine adjoint_fluid_scheme_factory(object, type_name)
294 class(adjoint_fluid_scheme_t), intent(inout), allocatable :: object
295 character(len=*) :: type_name
296 end subroutine adjoint_fluid_scheme_factory
297 end interface
298end module adjoint_fluid_scheme