Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
sensitivity.f90
Go to the documentation of this file.
1
7
11 use simulation_component, only: simulation_component_t
12 use json_file_module, only: json_file
13 use case, only: case_t
14 use num_types, only: rp
15 use field, only: field_t
16 use field_registry, only: neko_field_registry
17 use json_utils, only: json_get_or_default
18 implicit none
19 private
20
21 type, public :: sensitivity_t
22
24 type(field_t), pointer :: test
25
26 contains
27
29 procedure, pass(this) :: init => sensitivity_init
31 procedure, pass(this) :: free => sensitivity_free
33 procedure, pass(this) :: update => update_sensitivity
34 end type sensitivity_t
35
36contains
37
39 subroutine sensitivity_init(this, json, neko_case)
40 class(sensitivity_t), intent(inout) :: this
41 class(json_file), intent(inout) :: json
42 class(case_t), intent(inout) :: neko_case
43
44 ! Allocate new fields if they don't exist yet.
45 if (.not. neko_field_registry%field_exists("test")) then
46 call neko_field_registry%add_field(neko_case%fluid%u%dof, "test")
47 end if
48
49 this%test => neko_field_registry%get_field_by_name("test")
50
51 call neko_case%f_out%fluid%append(this%test)
52
53 end subroutine sensitivity_init
54
56 subroutine sensitivity_free(this)
57 class(sensitivity_t), intent(inout) :: this
58
59 end subroutine sensitivity_free
60
64 subroutine update_sensitivity(this, t, tstep)
65 class(sensitivity_t), intent(inout) :: this
66 real(kind=rp), intent(in) :: t
67 integer, intent(in) :: tstep
68
69 call compute_sensitivity(this)
70
71 end subroutine update_sensitivity
72
73 ! ========================================================================== !
74 ! Each part of the simulation component is implemented as a subroutine.
75
77 subroutine compute_sensitivity(this)
78 class(sensitivity_t), intent(inout) :: this
79
80 end subroutine compute_sensitivity
81
82 ! subroutine compute_adjoint(this)
83 ! class(sensitivity_t), intent(inout) :: this
84
85 ! end subroutine compute_adjoint
86
87end module sensitivity
Sensitivity module. This module contains the sensitivity computation of the topology optimization.
subroutine sensitivity_free(this)
Destructor.
subroutine update_sensitivity(this, t, tstep)
Compute the sensitivities field.
subroutine compute_sensitivity(this)
Compute the sensitivity of our topology optimization.
subroutine sensitivity_init(this, json, neko_case)
Actual constructor.