Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
dummy_constraint.f90
Go to the documentation of this file.
1
34!
36! $C = -1$
37! $dC/dx = 0$
39 use constraint, only: constraint_t
40 use json_module, only: json_file
41
42 use design, only: design_t
43
44 use num_types, only: rp
45 use vector_math, only: vector_add2, vector_cmult
46
47 implicit none
48 private
49
51 type, public, extends(constraint_t) :: dummy_constraint_t
52 private
53 contains
55 procedure, public, pass(this) :: init_json => &
58 procedure, public, pass(this) :: init_from_attributes => &
59 dummy_constraint_init_attributes
61 procedure, public, pass(this) :: free => dummy_constraint_free
63 procedure, public, pass(this) :: update_value => &
64 dummy_constraint_update_value
66 procedure, public, pass(this) :: update_sensitivity => &
67 dummy_constraint_update_sensitivity
69 procedure, public, pass(this) :: get_log_size => &
70 dummy_constraint_get_log_size
72 procedure, public, pass(this) :: get_log_headers => &
73 dummy_constraint_get_log_headers
75 procedure, public, pass(this) :: get_log_values => &
76 dummy_constraint_get_log_values
77 end type dummy_constraint_t
78
79contains
80
82 subroutine dummy_constraint_init_json(this, json, design)
83 class(dummy_constraint_t), intent(inout) :: this
84 type(json_file), intent(inout) :: json
85 class(design_t), intent(in) :: design
86 call this%init_from_attributes(design)
87 end subroutine dummy_constraint_init_json
88
90 subroutine dummy_constraint_init_attributes(this, design)
91 class(dummy_constraint_t), intent(inout) :: this
92 class(design_t), intent(in) :: design
93
94 ! Initialize the base class
95 call this%init_base("dummy_constraint", design%size())
96
97 ! ------------------------------------------------------------------------ !
98 ! Initialize the value of constraint
99
100 this%value = -1.0_rp
101
102 ! ------------------------------------------------------------------------ !
103 ! Initialize the sensitivity value
104
105 this%sensitivity = 0.0_rp
106
107 end subroutine dummy_constraint_init_attributes
108
110 subroutine dummy_constraint_free(this)
111 class(dummy_constraint_t), intent(inout) :: this
112
113 call this%free_base()
114 end subroutine dummy_constraint_free
115
117 subroutine dummy_constraint_update_value(this, design)
118 class(dummy_constraint_t), intent(inout) :: this
119 class(design_t), intent(in) :: design
120 end subroutine dummy_constraint_update_value
121
123 subroutine dummy_constraint_update_sensitivity(this, design)
124 class(dummy_constraint_t), intent(inout) :: this
125 class(design_t), intent(in) :: design
126 end subroutine dummy_constraint_update_sensitivity
127
131 function dummy_constraint_get_log_size(this) result(n)
132 class(dummy_constraint_t), intent(in) :: this
133 integer :: n
134
135 n = 0
136 end function dummy_constraint_get_log_size
137
141 subroutine dummy_constraint_get_log_headers(this, headers)
142 class(dummy_constraint_t), intent(in) :: this
143 character(len=*), intent(out) :: headers(:)
144
145 if (size(headers) .eq. 0) return
146 headers = ""
147 end subroutine dummy_constraint_get_log_headers
148
152 subroutine dummy_constraint_get_log_values(this, values)
153 class(dummy_constraint_t), intent(in) :: this
154 real(kind=rp), intent(out) :: values(:)
155
156 if (size(values) .eq. 0) return
157 values = 0.0_rp
158 end subroutine dummy_constraint_get_log_values
159
160end module dummy_constraint
Implements the constraint_t type.
Implements the design_t.
Definition design.f90:36
Implements the dummy_constraint_t type.
subroutine dummy_constraint_init_json(this, json, design)
The common constructor using a JSON object.
The abstract constraint type.
An abstract design type.
Definition design.f90:54