Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
device_mma_math.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine, public device_mma_math::device_update_hessian_z (hess_d, a_d, m)
 Update Hessian for dual solver with z-term contribution: Hess -= 10 * a * a^T.
 
subroutine, public device_mma_math::device_prepare_aa_matrix (aa_d, s_d, lambda_d, d_d, mu_d, y_d, a_d, zeta, z, m)
 Prepare AA matrix for dual-primal solver on device.
 
subroutine, public device_mma_math::device_prepare_hessian (hess_d, y_d, mu_d, lambda_d, m)
 Solve linear system Ax = b on device.
 
subroutine, public device_mma_math::device_solve_linear_system (a_d, b_d, n, info)
 
subroutine, public device_mma_math::device_delta_1dbeam (delta_d, l_total, le, offset, n)
 A device support to do the following calculation for 1D beam elements: Delta(k) = ((L_total - Le*(offset+k-1))**3 - & (L_total - Le*(offset+k))**3) / 3.0_rp Where k ranges from 1 to n.
 
subroutine, public device_mma_math::device_hess (hess_d, hijx_d, ljjxinv_d, n, m)
 
subroutine, public device_mma_math::device_mma_ljjxinv (ljjxinv_d, pjlambda_d, qjlambda_d, x_d, low_d, upp_d, alpha_d, beta_d, n)
 A device support to do the following calculation needed for the dualsubsolve for MMA: Ljjxinv= - 1 / ( (2*pjlambda/(upp - x)**3) + & (2*qjlambda/(x - low)**3))
 
subroutine, public device_mma_math::device_mma_dipsolvesub1 (x_d, pjlambda_d, qjlambda_d, low_d, upp_d, alpha_d, beta_d, n)
 A device support to do the following calculation needed for the dualsubsolve for MMA: x = (sqrt(pjlambda) * low + sqrt(qjlambda) * upp) / & (sqrt(pjlambda) + sqrt(qjlambda))
 
subroutine, public device_mma_math::device_mattrans_v_mul (output_d, pij_d, lambda_d, m, n)
 A device support to do the following matrix multiplication output = matmul(transpose(pij), lambda) where matrix pij is mxn, vector lambda is of size m and the output vector is of size n.
 
subroutine, public device_mma_math::device_mma_gensub1 (low_d, upp_d, x_d, xmin_d, xmax_d, asyinit, n)
 
subroutine, public device_mma_math::device_mma_gensub2 (low_d, upp_d, x_d, xold1_d, xold2_d, xdiff_d, asydecr, asyincr, n)
 
subroutine, public device_mma_math::device_mma_gensub3 (x_d, df0dx_d, dfdx_d, low_d, upp_d, min_d, max_d, alpha_d, beta_d, p0j_d, q0j_d, pij_d, qij_d, n, m)
 
subroutine, public device_mma_math::device_mma_gensub3_dip (x_d, df0dx_d, dfdx_d, low_d, upp_d, min_d, max_d, alpha_d, beta_d, p0j_d, q0j_d, pij_d, qij_d, n, m)
 Compute the move limits alpha and beta and the coefficients p0j, q0j, pij and qij of the subproblem of the dip subsolver, as mma_gensub_cpu. Only the objective is regularised, by 0.5e-6/(upp - low).
 
subroutine, public device_mma_math::device_mma_gensub4 (x_d, low_d, upp_d, pij_d, qij_d, n, m, bi_d)
 
subroutine, public device_mma_math::device_mma_max (xsi_d, x_d, alpha_d, n)
 
subroutine, public device_mma_math::device_max2 (a_d, b, c_d, d, n)
 
subroutine, public device_mma_math::device_rex (rex_d, x_d, low_d, upp_d, pij_d, p0j_d, qij_d, q0j_d, lambda_d, xsi_d, eta_d, n, m)
 
real(kind=rp) function, public device_mma_math::device_lcsc2 (a_d, b_d, n)
 
subroutine, public device_mma_math::device_relambda (relambda_d, x_d, upp_d, low_d, pij_d, qij_d, n, m)
 
subroutine, public device_mma_math::device_sub2cons2 (rexsi_d, xsi_d, x_d, alpha_d, epsi, n)
 
real(kind=rp) function, public device_mma_math::device_maxval (rex_d, n)
 
real(kind=rp) function, public device_mma_math::device_norm (rex_d, n)
 
subroutine, public device_mma_math::device_delx (delx_d, x_d, low_d, upp_d, pij_d, qij_d, p0j_d, q0j_d, alpha_d, beta_d, lambda_d, epsi, n, m)
 
subroutine, public device_mma_math::device_add2inv2 (a_d, b_d, c, n)
 
subroutine, public device_mma_math::device_gg (gg_d, x_d, low_d, upp_d, pij_d, qij_d, n, m)
 
subroutine, public device_mma_math::device_diagx (diagx_d, x_d, xsi_d, low_d, upp_d, p0j_d, q0j_d, pij_d, qij_d, alpha_d, beta_d, eta_d, lambda_d, n, m)
 
subroutine, public device_mma_math::device_bb (bb_d, gg_d, delx_d, diagx_d, n, m)
 
subroutine, public device_mma_math::device_updatebb (bb_d, dellambda_d, dely_d, d_d, mu_d, y_d, delz, m)
 
subroutine, public device_mma_math::device_aa (aa_d, gg_d, diagx_d, n, m)
 
subroutine, public device_mma_math::device_updateaa (aa_d, globaltmp_mm_d, s_d, lambda_d, d_d, mu_d, y_d, a_d, zeta, z, m)
 
subroutine, public device_mma_math::device_dx (dx_d, delx_d, diagx_d, gg_d, dlambda_d, n, m)
 
subroutine, public device_mma_math::device_dy (dy_d, dely_d, dlambda_d, d_d, mu_d, y_d, n)
 
subroutine, public device_mma_math::device_dxsi (dxsi_d, xsi_d, dx_d, x_d, alpha_d, epsi, n)
 
subroutine, public device_mma_math::device_deta (deta_d, eta_d, dx_d, x_d, beta_d, epsi, n)
 
real(kind=rp) function, public device_mma_math::device_maxval2 (dxx_d, xx_d, cons, n)
 
real(kind=rp) function, public device_mma_math::device_maxval3 (dx_d, x_d, alpha_d, cons, n)
 
subroutine, public device_mma_math::device_kkt_rex (rex_d, df0dx_d, dfdx_d, xsi_d, eta_d, lambda_d, n, m)
 
subroutine, public device_mma_math::device_mma_dip_kkt (res_d, x_d, df0dx_d, dfdx_d, xmin_d, xmax_d, lambda_d, n, m)
 Compute the residuals of the KKT conditions of the original problem for each local design variable, as mma_dip_KKT_cpu: the stationarity in res(1:n) and the complementarity of the lower and upper bounds in res(n+1:2n) and res(2n+1:3n). The bound multipliers are estimated where x is within 1e-5 of the bounds.
 

Detailed Description

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file device_mma_math.f90.

Function/Subroutine Documentation

◆ device_aa()

subroutine, public device_mma_math::device_aa ( type(c_ptr)  aa_d,
type(c_ptr)  gg_d,
type(c_ptr)  diagx_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 584 of file device_mma_math.f90.

◆ device_add2inv2()

subroutine, public device_mma_math::device_add2inv2 ( type(c_ptr)  a_d,
type(c_ptr)  b_d,
real(kind=rp)  c,
integer(c_int)  n 
)

Definition at line 505 of file device_mma_math.f90.

◆ device_bb()

subroutine, public device_mma_math::device_bb ( type(c_ptr)  bb_d,
type(c_ptr)  gg_d,
type(c_ptr)  delx_d,
type(c_ptr)  diagx_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 555 of file device_mma_math.f90.

◆ device_delta_1dbeam()

subroutine, public device_mma_math::device_delta_1dbeam ( type(c_ptr)  delta_d,
real(c_rp)  l_total,
real(c_rp)  le,
integer(c_int), value  offset,
integer(c_int), value  n 
)

Definition at line 154 of file device_mma_math.f90.

◆ device_delx()

subroutine, public device_mma_math::device_delx ( type(c_ptr)  delx_d,
type(c_ptr)  x_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
type(c_ptr)  p0j_d,
type(c_ptr)  q0j_d,
type(c_ptr)  alpha_d,
type(c_ptr)  beta_d,
type(c_ptr)  lambda_d,
real(kind=rp)  epsi,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 486 of file device_mma_math.f90.

◆ device_deta()

subroutine, public device_mma_math::device_deta ( type(c_ptr)  deta_d,
type(c_ptr)  eta_d,
type(c_ptr)  dx_d,
type(c_ptr)  x_d,
type(c_ptr)  beta_d,
real(c_rp)  epsi,
integer(c_int)  n 
)

Definition at line 659 of file device_mma_math.f90.

◆ device_diagx()

subroutine, public device_mma_math::device_diagx ( type(c_ptr)  diagx_d,
type(c_ptr)  x_d,
type(c_ptr)  xsi_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  p0j_d,
type(c_ptr)  q0j_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
type(c_ptr)  alpha_d,
type(c_ptr)  beta_d,
type(c_ptr)  eta_d,
type(c_ptr)  lambda_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 535 of file device_mma_math.f90.

◆ device_dx()

subroutine, public device_mma_math::device_dx ( type(c_ptr)  dx_d,
type(c_ptr)  delx_d,
type(c_ptr)  diagx_d,
type(c_ptr)  gg_d,
type(c_ptr)  dlambda_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 616 of file device_mma_math.f90.

◆ device_dxsi()

subroutine, public device_mma_math::device_dxsi ( type(c_ptr)  dxsi_d,
type(c_ptr)  xsi_d,
type(c_ptr)  dx_d,
type(c_ptr)  x_d,
type(c_ptr)  alpha_d,
real(c_rp)  epsi,
integer(c_int)  n 
)

Definition at line 644 of file device_mma_math.f90.

◆ device_dy()

subroutine, public device_mma_math::device_dy ( type(c_ptr)  dy_d,
type(c_ptr)  dely_d,
type(c_ptr)  dlambda_d,
type(c_ptr)  d_d,
type(c_ptr)  mu_d,
type(c_ptr)  y_d,
integer(c_int)  n 
)

Definition at line 630 of file device_mma_math.f90.

◆ device_gg()

subroutine, public device_mma_math::device_gg ( type(c_ptr)  gg_d,
type(c_ptr)  x_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 521 of file device_mma_math.f90.

◆ device_hess()

subroutine, public device_mma_math::device_hess ( type(c_ptr)  hess_d,
type(c_ptr)  hijx_d,
type(c_ptr)  ljjxinv_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 170 of file device_mma_math.f90.

◆ device_kkt_rex()

subroutine, public device_mma_math::device_kkt_rex ( type(c_ptr)  rex_d,
type(c_ptr)  df0dx_d,
type(c_ptr)  dfdx_d,
type(c_ptr)  xsi_d,
type(c_ptr)  eta_d,
type(c_ptr)  lambda_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 713 of file device_mma_math.f90.

◆ device_lcsc2()

real(kind=rp) function, public device_mma_math::device_lcsc2 ( type(c_ptr)  a_d,
type(c_ptr)  b_d,
integer(c_int)  n 
)

Definition at line 406 of file device_mma_math.f90.

◆ device_mattrans_v_mul()

subroutine, public device_mma_math::device_mattrans_v_mul ( type(c_ptr)  output_d,
type(c_ptr)  pij_d,
type(c_ptr)  lambda_d,
integer  m,
integer  n 
)

Definition at line 239 of file device_mma_math.f90.

◆ device_max2()

subroutine, public device_mma_math::device_max2 ( type(c_ptr)  a_d,
real(c_rp)  b,
type(c_ptr)  c_d,
real(c_rp)  d,
integer  n 
)

Definition at line 371 of file device_mma_math.f90.

◆ device_maxval()

real(kind=rp) function, public device_mma_math::device_maxval ( type(c_ptr)  rex_d,
integer(c_int)  n 
)

Definition at line 452 of file device_mma_math.f90.

◆ device_maxval2()

real(kind=rp) function, public device_mma_math::device_maxval2 ( type(c_ptr)  dxx_d,
type(c_ptr)  xx_d,
real(kind=rp), intent(in)  cons,
integer  n 
)

Definition at line 674 of file device_mma_math.f90.

◆ device_maxval3()

real(kind=rp) function, public device_mma_math::device_maxval3 ( type(c_ptr)  dx_d,
type(c_ptr)  x_d,
type(c_ptr)  alpha_d,
real(kind=rp), intent(in)  cons,
integer(c_int)  n 
)

Definition at line 693 of file device_mma_math.f90.

◆ device_mma_dip_kkt()

subroutine, public device_mma_math::device_mma_dip_kkt ( type(c_ptr)  res_d,
type(c_ptr)  x_d,
type(c_ptr)  df0dx_d,
type(c_ptr)  dfdx_d,
type(c_ptr)  xmin_d,
type(c_ptr)  xmax_d,
type(c_ptr)  lambda_d,
integer(c_int)  n,
integer(c_int)  m 
)
Parameters
res_dResiduals, of size 3n (output).
x_dCurrent design.
df0dx_dSensitivities of the objective.
dfdx_dSensitivities of the constraints, m x n.
xmin_dLower bounds of the design.
xmax_dUpper bounds of the design.
lambda_dMultipliers of the constraints.
nNumber of local design variables.
mNumber of constraints.

Definition at line 742 of file device_mma_math.f90.

◆ device_mma_dipsolvesub1()

subroutine, public device_mma_math::device_mma_dipsolvesub1 ( type(c_ptr)  x_d,
type(c_ptr)  pjlambda_d,
type(c_ptr)  qjlambda_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  alpha_d,
type(c_ptr)  beta_d,
integer(c_int)  n 
)

Definition at line 216 of file device_mma_math.f90.

◆ device_mma_gensub1()

subroutine, public device_mma_math::device_mma_gensub1 ( type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  x_d,
type(c_ptr)  xmin_d,
type(c_ptr)  xmax_d,
real(c_rp)  asyinit,
integer  n 
)

Definition at line 255 of file device_mma_math.f90.

◆ device_mma_gensub2()

subroutine, public device_mma_math::device_mma_gensub2 ( type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  x_d,
type(c_ptr)  xold1_d,
type(c_ptr)  xold2_d,
type(c_ptr)  xdiff_d,
real(c_rp)  asydecr,
real(c_rp)  asyincr,
integer  n 
)

Definition at line 271 of file device_mma_math.f90.

◆ device_mma_gensub3()

subroutine, public device_mma_math::device_mma_gensub3 ( type(c_ptr)  x_d,
type(c_ptr)  df0dx_d,
type(c_ptr)  dfdx_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  min_d,
type(c_ptr)  max_d,
type(c_ptr)  alpha_d,
type(c_ptr)  beta_d,
type(c_ptr)  p0j_d,
type(c_ptr)  q0j_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
integer  n,
integer  m 
)

Definition at line 289 of file device_mma_math.f90.

◆ device_mma_gensub3_dip()

subroutine, public device_mma_math::device_mma_gensub3_dip ( type(c_ptr)  x_d,
type(c_ptr)  df0dx_d,
type(c_ptr)  dfdx_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  min_d,
type(c_ptr)  max_d,
type(c_ptr)  alpha_d,
type(c_ptr)  beta_d,
type(c_ptr)  p0j_d,
type(c_ptr)  q0j_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
integer(c_int)  n,
integer(c_int)  m 
)
Parameters
x_dCurrent design.
df0dx_dSensitivities of the objective.
dfdx_dSensitivities of the constraints, m x n.
low_dLower asymptotes.
upp_dUpper asymptotes.
min_dLower bounds of the design, with the move limit applied.
max_dUpper bounds of the design, with the move limit applied.
alpha_dLower bounds of the subproblem (output).
beta_dUpper bounds of the subproblem (output).
p0j_dCoefficients p0j of the objective (output).
q0j_dCoefficients q0j of the objective (output).
pij_dCoefficients pij of the constraints, m x n (output).
qij_dCoefficients qij of the constraints, m x n (output).
nNumber of local design variables.
mNumber of constraints.

Definition at line 325 of file device_mma_math.f90.

◆ device_mma_gensub4()

subroutine, public device_mma_math::device_mma_gensub4 ( type(c_ptr)  x_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
integer  n,
integer  m,
type(c_ptr)  bi_d 
)

Definition at line 343 of file device_mma_math.f90.

◆ device_mma_ljjxinv()

subroutine, public device_mma_math::device_mma_ljjxinv ( type(c_ptr)  ljjxinv_d,
type(c_ptr)  pjlambda_d,
type(c_ptr)  qjlambda_d,
type(c_ptr)  x_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  alpha_d,
type(c_ptr)  beta_d,
integer(c_int)  n 
)

And then remove the sensitivity for the active primal constraints Ljjxinv = merge(0.0_rp, Ljjxinv, x - alpha < NEKO_EPS) Ljjxinv = merge(0.0_rp, Ljjxinv, beta - x < NEKO_EPS)

Definition at line 193 of file device_mma_math.f90.

◆ device_mma_max()

subroutine, public device_mma_math::device_mma_max ( type(c_ptr)  xsi_d,
type(c_ptr)  x_d,
type(c_ptr)  alpha_d,
integer  n 
)

Definition at line 357 of file device_mma_math.f90.

◆ device_norm()

real(kind=rp) function, public device_mma_math::device_norm ( type(c_ptr)  rex_d,
integer(c_int)  n 
)

Definition at line 469 of file device_mma_math.f90.

◆ device_prepare_aa_matrix()

subroutine, public device_mma_math::device_prepare_aa_matrix ( type(c_ptr)  aa_d,
type(c_ptr)  s_d,
type(c_ptr)  lambda_d,
type(c_ptr)  d_d,
type(c_ptr)  mu_d,
type(c_ptr)  y_d,
type(c_ptr)  a_d,
real(c_rp)  zeta,
real(c_rp)  z,
integer, value  m 
)

Definition at line 99 of file device_mma_math.f90.

◆ device_prepare_hessian()

subroutine, public device_mma_math::device_prepare_hessian ( type(c_ptr)  hess_d,
type(c_ptr)  y_d,
type(c_ptr)  mu_d,
type(c_ptr)  lambda_d,
integer, value  m 
)

Definition at line 118 of file device_mma_math.f90.

◆ device_relambda()

subroutine, public device_mma_math::device_relambda ( type(c_ptr)  relambda_d,
type(c_ptr)  x_d,
type(c_ptr)  upp_d,
type(c_ptr)  low_d,
type(c_ptr)  pij_d,
type(c_ptr)  qij_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 423 of file device_mma_math.f90.

◆ device_rex()

subroutine, public device_mma_math::device_rex ( type(c_ptr)  rex_d,
type(c_ptr)  x_d,
type(c_ptr)  low_d,
type(c_ptr)  upp_d,
type(c_ptr)  pij_d,
type(c_ptr)  p0j_d,
type(c_ptr)  qij_d,
type(c_ptr)  q0j_d,
type(c_ptr)  lambda_d,
type(c_ptr)  xsi_d,
type(c_ptr)  eta_d,
integer(c_int)  n,
integer(c_int)  m 
)

Definition at line 388 of file device_mma_math.f90.

◆ device_solve_linear_system()

subroutine, public device_mma_math::device_solve_linear_system ( type(c_ptr)  a_d,
type(c_ptr)  b_d,
integer(c_int), value  n,
integer(c_int)  info 
)

Definition at line 132 of file device_mma_math.f90.

◆ device_sub2cons2()

subroutine, public device_mma_math::device_sub2cons2 ( type(c_ptr)  rexsi_d,
type(c_ptr)  xsi_d,
type(c_ptr)  x_d,
type(c_ptr)  alpha_d,
real(kind=rp)  epsi,
integer(c_int)  n 
)

Definition at line 437 of file device_mma_math.f90.

◆ device_update_hessian_z()

subroutine, public device_mma_math::device_update_hessian_z ( type(c_ptr), intent(in)  hess_d,
type(c_ptr), intent(in)  a_d,
integer, value  m 
)

Definition at line 81 of file device_mma_math.f90.

◆ device_updateaa()

subroutine, public device_mma_math::device_updateaa ( type(c_ptr)  aa_d,
type(c_ptr)  globaltmp_mm_d,
type(c_ptr)  s_d,
type(c_ptr)  lambda_d,
type(c_ptr)  d_d,
type(c_ptr)  mu_d,
type(c_ptr)  y_d,
type(c_ptr)  a_d,
real(c_rp)  zeta,
real(c_rp)  z,
integer(c_int)  m 
)

Definition at line 598 of file device_mma_math.f90.

◆ device_updatebb()

subroutine, public device_mma_math::device_updatebb ( type(c_ptr)  bb_d,
type(c_ptr)  dellambda_d,
type(c_ptr)  dely_d,
type(c_ptr)  d_d,
type(c_ptr)  mu_d,
type(c_ptr)  y_d,
real(c_rp)  delz,
integer(c_int)  m 
)

Definition at line 569 of file device_mma_math.f90.