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

CPU backend for the steepest-descent optimizer kernels. More...

Functions/Subroutines

subroutine, public sd_direction_cpu (s, x, xmin, xmax, n)
 Bound-projected steepest-descent direction on CPU (Eq. D22).
 
subroutine, public sd_update_move_limits_cpu (delta, x, x1, x2, dec, inc, dmin, dmax, n)
 Adapt the move limits on CPU (Eq. D23).
 
subroutine, public sd_update_design_cpu (x_new, x, s, delta, psi, smax, xmin, xmax, n)
 Move-limited, box-constrained design update on CPU (Eq. D24).
 

Detailed Description

Elementwise kernels of the steepest descent method with move limits, Appendix D of da Silva, Aage, Beck & Sigmund (2021), Eqs. D22-D24. The device backends in bcknd/device implement the same formulas.

Function/Subroutine Documentation

◆ sd_direction_cpu()

subroutine, public steepest_descent_cpu::sd_direction_cpu ( real(kind=rp), dimension(n), intent(inout)  s,
real(kind=rp), dimension(n), intent(in)  x,
real(kind=rp), intent(in)  xmin,
real(kind=rp), intent(in)  xmax,
integer, intent(in)  n 
)

On entry s holds the gradient G. On exit it holds S = -G, with every component that points out of the box at an active bound set to zero.

Parameters
[in,out]sGradient on entry, projected direction on exit.
[in]xDesign variables.
[in]xminLower bound of the design variables.
[in]xmaxUpper bound of the design variables.
[in]nNumber of design variables.

Definition at line 58 of file steepest_descent_cpu.f90.

Here is the caller graph for this function:

◆ sd_update_design_cpu()

subroutine, public steepest_descent_cpu::sd_update_design_cpu ( real(kind=rp), dimension(n), intent(out)  x_new,
real(kind=rp), dimension(n), intent(in)  x,
real(kind=rp), dimension(n), intent(in)  s,
real(kind=rp), dimension(n), intent(in)  delta,
real(kind=rp), intent(in)  psi,
real(kind=rp), intent(in)  smax,
real(kind=rp), intent(in)  xmin,
real(kind=rp), intent(in)  xmax,
integer, intent(in)  n 
)

Computes x_new = min(xmax, max(xmin, min(x + delta, max(x - delta, x + psi * (s / smax))))), i.e. the move limit first and the box second. This equals Eq. D24 whenever x lies in [xmin, xmax], and stays well defined for infeasible x.

Parameters
[out]x_newUpdated design variables.
[in]xCurrent design variables.
[in]sBound-projected steepest-descent direction.
[in]deltaMove limits.
[in]psiStep length.
[in]smaxGlobal maximum of the absolute value of s.
[in]xminLower bound of the design variables.
[in]xmaxUpper bound of the design variables.
[in]nNumber of design variables.

Definition at line 124 of file steepest_descent_cpu.f90.

Here is the caller graph for this function:

◆ sd_update_move_limits_cpu()

subroutine, public steepest_descent_cpu::sd_update_move_limits_cpu ( real(kind=rp), dimension(n), intent(inout)  delta,
real(kind=rp), dimension(n), intent(in)  x,
real(kind=rp), dimension(n), intent(in)  x1,
real(kind=rp), dimension(n), intent(in)  x2,
real(kind=rp), intent(in)  dec,
real(kind=rp), intent(in)  inc,
real(kind=rp), intent(in)  dmin,
real(kind=rp), intent(in)  dmax,
integer, intent(in)  n 
)

The move limit of a variable shrinks when its last two changes have opposite signs, grows when they have the same sign, and is then clamped to [dmin, dmax].

Parameters
[in,out]deltaMove limits.
[in]xDesign variables at the current iteration.
[in]x1Design variables one iteration back.
[in]x2Design variables two iterations back.
[in]decFactor applied on oscillation.
[in]incFactor applied on monotone progress.
[in]dminSmallest allowed move limit.
[in]dmaxLargest allowed move limit.
[in]nNumber of design variables.

Definition at line 88 of file steepest_descent_cpu.f90.

Here is the caller graph for this function: