Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
RAMP_mapping_cpu.f90
Go to the documentation of this file.
1
34!
37 use num_types, only: rp
38 implicit none
39 private
40
45
46contains
47
55 subroutine convex_down_ramp_mapping_apply_cpu(f_min, f_max, q, X_out, X_in, n)
56 integer, intent(in) :: n
57 real(kind=rp), intent(in) :: f_min, f_max, q
58 real(kind=rp), dimension(n), intent(out) :: x_out
59 real(kind=rp), dimension(n), intent(in) :: x_in
60
61 x_out = convex_down_ramp_mapping_kernel(f_min, f_max, q, x_in)
62
64
73 subroutine convex_down_ramp_mapping_apply_backward_cpu(f_min, f_max, q, &
74 sens_out, sens_in, X_in, n)
75 integer, intent(in) :: n
76 real(kind=rp), intent(in) :: f_min, f_max, q
77 real(kind=rp), dimension(n), intent(out) :: sens_out
78 real(kind=rp), dimension(n), intent(in) :: sens_in
79 real(kind=rp), dimension(n), intent(in) :: x_in
80
81 sens_out = convex_down_ramp_mapping_backward_kernel(f_min, f_max, q, &
82 sens_in, x_in)
83
85
93 subroutine convex_up_ramp_mapping_apply_cpu(f_min, f_max, q, X_out, X_in, n)
94 integer, intent(in) :: n
95 real(kind=rp), intent(in) :: f_min, f_max, q
96 real(kind=rp), dimension(n), intent(out) :: x_out
97 real(kind=rp), dimension(n), intent(in) :: x_in
98
99 x_out = convex_up_ramp_mapping_kernel(f_min, f_max, q, x_in)
100
102
111 subroutine convex_up_ramp_mapping_apply_backward_cpu(f_min, f_max, q, &
112 sens_out, sens_in, X_in, n)
113 integer, intent(in) :: n
114 real(kind=rp), intent(in) :: f_min, f_max, q
115 real(kind=rp), dimension(n), intent(out) :: sens_out
116 real(kind=rp), dimension(n), intent(in) :: sens_in
117 real(kind=rp), dimension(n), intent(in) :: x_in
118
119 sens_out = convex_up_ramp_mapping_backward_kernel(f_min, f_max, q, &
120 sens_in, x_in)
121
123
130 elemental function convex_down_ramp_mapping_kernel(f_min, f_max, q, X_in) &
131 result(x_out)
132 real(kind=rp), intent(in) :: f_min, f_max, q
133 real(kind=rp), intent(in) :: x_in
134 real(kind=rp) :: x_out
135
136 x_out = f_min + (f_max - f_min) * x_in / (1.0_rp + q * (1.0_rp - x_in))
137
138 end function convex_down_ramp_mapping_kernel
139
147 elemental function convex_down_ramp_mapping_backward_kernel(f_min, f_max, q, &
148 sens_in, X_in) result(sens_out)
149 real(kind=rp), intent(in) :: f_min, f_max, q
150 real(kind=rp), intent(in) :: sens_in, x_in
151 real(kind=rp) :: sens_out
152
153 sens_out = sens_in * (f_max - f_min) * (q + 1.0_rp) / &
154 ((1.0_rp - q * (x_in - 1.0_rp))**2)
155
156 end function convex_down_ramp_mapping_backward_kernel
157
164 elemental function convex_up_ramp_mapping_kernel(f_min, f_max, q, X_in) &
165 result(x_out)
166 real(kind=rp), intent(in) :: f_min, f_max, q
167 real(kind=rp), intent(in) :: x_in
168 real(kind=rp) :: x_out
169
170 x_out = f_min + (f_max - f_min) * x_in * (1.0_rp + q) / (x_in + q)
171
172 end function convex_up_ramp_mapping_kernel
173
181 elemental function convex_up_ramp_mapping_backward_kernel(f_min, f_max, q, &
182 sens_in, X_in) result(sens_out)
183 real(kind=rp), intent(in) :: f_min, f_max, q
184 real(kind=rp), intent(in) :: sens_in, x_in
185 real(kind=rp) :: sens_out
186
187 sens_out = sens_in * (f_max - f_min) * (q + 1.0_rp) * q / ((x_in + q)**2)
188
189 end function convex_up_ramp_mapping_backward_kernel
190
191end module ramp_mapping_cpu
CPU backend for RAMP mapping operations.
subroutine, public convex_down_ramp_mapping_apply_backward_cpu(f_min, f_max, q, sens_out, sens_in, x_in, n)
Apply convex-down RAMP chain rule on CPU.
subroutine, public convex_up_ramp_mapping_apply_backward_cpu(f_min, f_max, q, sens_out, sens_in, x_in, n)
Apply convex-up RAMP chain rule on CPU.
subroutine, public convex_up_ramp_mapping_apply_cpu(f_min, f_max, q, x_out, x_in, n)
Apply convex-up RAMP forward mapping on CPU.
subroutine, public convex_down_ramp_mapping_apply_cpu(f_min, f_max, q, x_out, x_in, n)
Apply convex-down RAMP forward mapping on CPU.