35 use num_types,
only: rp, sp
36 use field,
only: field_t
37 use json_module,
only: json_file
41 use coefs,
only: coef_t
42 use scratch_registry,
only: neko_scratch_registry
43 use fld_file_output,
only: fld_file_output_t
44 use point_zone_registry,
only: neko_point_zone_registry
45 use point_zone,
only: point_zone_t
47 use neko_config,
only: neko_bcknd_device
48 use device,
only: device_memcpy, host_to_device
52 use json_module,
only: json_file
53 use json_utils,
only: json_get
55 use vector,
only: vector_t
57 use field_registry,
only: neko_field_registry
65 type(vector_t) :: values
76 generic,
public :: init => init_from_json, init_from_components
78 procedure, pass(this) :: init_from_json => &
79 design_simple_init_from_json
81 procedure, pass(this) :: init_from_components => &
82 design_simple_init_from_components
85 procedure, pass(this) :: add_mapping => design_simple_add_mapping
88 procedure, pass(this) :: get_values => design_simple_get_values
90 procedure, pass(this) :: get_x => design_simple_get_x
92 procedure, pass(this) :: get_y => design_simple_get_y
94 procedure, pass(this) :: get_z => design_simple_get_z
97 procedure, pass(this) :: update_design => design_simple_update_design
100 procedure, pass(this) :: map_forward => design_simple_map_forward
103 procedure, pass(this) :: map_backward => design_simple_map_backward
106 procedure, pass(this) :: write => design_simple_write
109 procedure, pass(this) :: free => design_simple_free
116 subroutine design_simple_init_from_json(this, parameters)
118 type(json_file),
intent(inout) :: parameters
119 character(len=:),
allocatable :: type
120 integer :: n, nx, ny, nz, i, j, k
121 real(kind=rp),
dimension(:),
allocatable :: limits
122 type(vector_t) :: x, y, z
124 call json_get(parameters,
'optimization.design.domain.type', type)
126 select case (trim(type))
128 call json_get(parameters,
'optimization.design.domain.nx', nx)
129 call json_get(parameters,
'optimization.design.domain.ny', ny)
130 call json_get(parameters,
'optimization.design.domain.nz', nz)
131 call json_get(parameters,
'optimization.design.domain.limits', limits)
141 x%x(i) = limits(1) + (limits(2) - limits(1)) * &
142 real(i - 1, kind=rp) / real(nx, kind=rp)
143 y%x(i) = limits(3) + (limits(4) - limits(3)) * &
144 real(j - 1, kind=rp) / real(ny, kind=rp)
145 z%x(i) = limits(5) + (limits(6) - limits(5)) * &
146 real(k - 1, kind=rp) / real(nz, kind=rp)
153 call this%init_from_components(n, x, y, z)
155 end subroutine design_simple_init_from_json
157 subroutine design_simple_init_from_components(this, n, x, y, z)
159 integer,
intent(in) :: n
160 type(vector_t),
intent(in) :: x, y, z
162 call this%init_base(n)
164 call this%values%init(n)
169 end subroutine design_simple_init_from_components
172 subroutine design_simple_free(this)
175 call this%free_base()
176 call this%values%free()
181 end subroutine design_simple_free
184 subroutine design_simple_add_mapping(this, parameters, simulation)
186 type(json_file),
intent(inout) :: parameters
189 end subroutine design_simple_add_mapping
192 subroutine design_simple_map_forward(this)
196 end subroutine design_simple_map_forward
198 function design_simple_get_values(this)
result(values)
200 type(vector_t) :: values
204 end function design_simple_get_values
206 function design_simple_get_x(this)
result(x)
212 end function design_simple_get_x
214 function design_simple_get_y(this)
result(y)
220 end function design_simple_get_y
222 function design_simple_get_z(this)
result(z)
228 end function design_simple_get_z
230 subroutine design_simple_update_design(this, values)
232 type(vector_t),
intent(inout) :: values
236 end subroutine design_simple_update_design
238 subroutine design_simple_map_backward(this, sensitivity)
240 type(vector_t),
intent(in) :: sensitivity
242 end subroutine design_simple_map_backward
244 subroutine design_simple_write(this, idx)
246 integer,
intent(in) :: idx
248 end subroutine design_simple_write
250end module simple_design
Mappings to be applied to a scalar field.
Some common Masking operations we may need.
A RAMP mapping of coefficients.
Implements the simple_brinkman_source_term_t type.
Implements the steady_problem_t type.
Base abstract class for mapping.
A PDE based filter mapping , see Lazarov & O. Sigmund 2010, by solving an equation of the form .
A RAMP mapping of coefficients This is the standard RAMP described in https://doi....
A simple Brinkman source term.
A topology optimization design variable.