36 use num_types,
only: rp
38 use json_module,
only: json_file
39 use field,
only: field_t
40 use coefs,
only: coef_t
41 use neko_config,
only: neko_bcknd_device
79 real(kind=rp) :: f_min
81 real(kind=rp) :: f_max
92 procedure, pass(this) :: init_from_attributes => &
99 procedure, pass(this) :: apply_backward => &
108 type(json_file),
intent(inout) :: json
109 type(coef_t),
intent(inout) :: coef
113 this%f_max = 1000.0_rp
115 this%convex_up = .true.
117 call this%init_base(json, coef)
125 type(coef_t),
intent(inout) :: coef
135 call this%free_base()
144 type(field_t),
intent(in) :: X_in
145 type(field_t),
intent(inout) :: X_out
147 if (this%convex_up .eqv. .true.)
then
164 type(field_t),
intent(in) :: X_in
165 type(field_t),
intent(in) :: dF_dX_out
166 type(field_t),
intent(inout) :: dF_dX_in
168 if (this%convex_up .eqv. .true.)
then
170 this%q, df_dx_in, df_dx_out, x_in)
173 this%q, df_dx_in, df_dx_out, x_in)
182 real(kind=rp),
intent(in) :: q, f_min, f_max
183 type(field_t),
intent(in) :: x_in
184 type(field_t),
intent(inout) :: X_out
190 if (neko_bcknd_device .eq. 1)
then
192 x_out%x_d, x_in%x_d, n)
195 x_out%x(i,1,1,1) = f_min + (f_max - f_min) * &
196 x_in%x(i,1,1,1) / (1.0_rp + q * (1.0_rp - x_in%x(i,1,1,1) ) )
208 dF_dX_in, dF_dX_out, X_in)
209 real(kind=rp),
intent(in) :: f_min, f_max, q
210 type(field_t),
intent(in) :: x_in
211 type(field_t),
intent(in) :: dF_dX_out
212 type(field_t),
intent(inout) :: dF_dX_in
221 if (neko_bcknd_device .eq. 1)
then
223 df_dx_in%x_d, df_dx_out%x_d, x_in%x_d, n)
226 df_dx_in%x(i,1,1,1) = (f_max - f_min) * (q + 1.0_rp) / &
227 ((1.0_rp - q * (x_in%x(i,1,1,1) - 1.0_rp))**2) * &
238 real(kind=rp),
intent(in) :: f_min, f_max, q
239 type(field_t),
intent(in) :: x_in
240 type(field_t),
intent(inout) :: X_out
247 if (neko_bcknd_device .eq. 1)
then
249 x_out%x_d, x_in%x_d, n)
252 x_out%x(i,1,1,1) = f_min + (f_max - f_min) * &
253 x_in%x(i,1,1,1) * (1.0_rp + q ) / (x_in%x(i,1,1,1) + q)
266 dF_dX_in, dF_dX_out, X_in)
267 real(kind=rp),
intent(in) :: f_min, f_max, q
268 type(field_t),
intent(in) :: x_in
269 type(field_t),
intent(in) :: dF_dX_out
270 type(field_t),
intent(inout) :: dF_dX_in
279 if (neko_bcknd_device .eq. 1)
then
281 df_dx_in%x_d, df_dx_out%x_d, x_in%x_d, n)
284 df_dx_in%x(i,1,1,1) = (f_max - f_min) * (q + 1.0_rp) / &
285 ( (x_in%x(i,1,1,1) + q)**2) * &
subroutine, public device_convex_up_ramp_mapping_apply(f_min, f_max, q, x_out_d, x_in_d, n)
subroutine, public device_convex_down_ramp_mapping_apply(f_min, f_max, q, x_out_d, x_in_d, n)
subroutine, public device_convex_up_ramp_mapping_apply_backward(f_min, f_max, q, df_dx_in_d, df_dx_out_d, x_in_d, n)
subroutine, public device_convex_down_ramp_mapping_apply_backward(f_min, f_max, q, df_dx_in_d, df_dx_out_d, x_in_d, n)
Mappings to be applied to a scalar field.
A RAMP mapping of coefficients.
subroutine ramp_mapping_init_from_attributes(this, coef)
Actual constructor.
subroutine convex_up_ramp_mapping_apply(f_min, f_max, q, x_out, x_in)
Apply the mapping.
subroutine ramp_mapping_free(this)
Destructor.
subroutine convex_down_ramp_mapping_apply(f_min, f_max, q, x_out, x_in)
Apply the mapping.
subroutine ramp_mapping_init_from_json(this, json, coef)
Constructor from json.
subroutine convex_down_ramp_mapping_apply_backward(f_min, f_max, q, df_dx_in, df_dx_out, x_in)
Apply the chain rule.
subroutine ramp_mapping_apply(this, x_out, x_in)
Apply the mapping.
subroutine ramp_mapping_apply_backward(this, df_dx_in, df_dx_out, x_in)
Apply the chain rule.
subroutine convex_up_ramp_mapping_apply_backward(f_min, f_max, q, df_dx_in, df_dx_out, x_in)
Apply the chain rule.
Base abstract class for mapping.
A RAMP mapping of coefficients This is the standard RAMP described in https://doi....