SPEC 3.20
Stepped Pressure Equilibrium Code
Force-driver

Functions/Subroutines

subroutine newton (NGdof, position, ihybrd)
 Employs Newton method to find \({\bf F}({\bf x})=0\), where \({\bf x}\equiv\{\mathrm{geometry}\}\) and \({\bf F}\) is defined in dforce() . More...
 
subroutine writereadgf (readorwrite, NGdof, ireadhessian)
 read or write force-derivative matrix More...
 
subroutine fcn1 (NGdof, xx, fvec, irevcm)
 Objective to be given to the Newton solver, using only function values. More...
 
subroutine fcn2 (NGdof, xx, fvec, fjac, Ldfjac, irevcm)
 Objective to be given to the Newton solver, using function values and derivatives. More...
 

Detailed Description

Function/Subroutine Documentation

◆ newton()

subroutine newton ( integer, intent(in)  NGdof,
real, dimension(0:ngdof), intent(inout)  position,
integer, intent(out)  ihybrd 
)

Employs Newton method to find \({\bf F}({\bf x})=0\), where \({\bf x}\equiv\{\mathrm{geometry}\}\) and \({\bf F}\) is defined in dforce() .

Solves \({\bf F}({\bf \xi})=0\), where \({\bf F} \equiv \{ [[p+B^2/2]]_{i,l}, I_{i,l} \}\) and \({\bf \xi} \equiv \{ R_{i,l},Z_{i,l} \}\).

iterative, reverse communication loop

  • The iterative, Newton search to find \({\bf x} \equiv \{ \mathrm{geometry} \} \equiv \{ R_{i,l}, Z_{i,l} \}\) such that \({\bf F}({\bf x})=0\), where \({\bf F}\) and its derivatives, \(\nabla_{{\bf x}} {\bf F}\), are calculated by dforce() , is provided by either
    • C05NDF if Lfindzero=1 , which only uses function values; or
    • C05PDF if Lfindzero=2, which uses user-provided derivatives.
  • The iterative search will terminate when the solution is within c05xtol of the true solution (see NAG documentation).
  • The input variable c05factor is provided to determine the initial step bound (see NAG documentation).

logic, writing/reading from file

  • Before proceeding with iterative search, dforce() is called to determine the magnitude of the initial force imbalance, and if this is less than forcetol then the iterative search will not be performed.
  • As the iterations proceed, wrtend() will be called to save itermediate information (also see xspech() ).
  • If the derivative matrix, \(\nabla_{{\bf x}} {\bf F}\), is required, i.e. if Lfindzero=2 , and if LreadGF=T then the derivative matrix will initially be read from .ext.sp.DF , if it exists, or from .sp.DF .
  • As the iterations proceed, the derivative matrix will be written to .ext.sp.DF .
Parameters
[in]NGdof
[in,out]position
[out]ihybrd

References allglobal::bbe, allglobal::bbo, inputlist::c05factor, inputlist::c05xmax, inputlist::c05xtol, allglobal::cpus, allglobal::dbbdmp, allglobal::dessian, allglobal::dffdrz, dforce(), allglobal::dmupfdx, allglobal::energy, fcn1(), fcn2(), allglobal::forceerr, inputlist::forcetol, allglobal::hessian, inputlist::igeometry, allglobal::iie, allglobal::iio, allglobal::im, allglobal::in, allglobal::irbc, allglobal::irbs, allglobal::izbc, allglobal::izbs, newtontime::lastcpu, inputlist::lcheck, inputlist::lfindzero, allglobal::lgdof, allglobal::lhessian2dallocated, allglobal::lhessian3dallocated, allglobal::lhessianallocated, allglobal::localconstraint, inputlist::lreadgf, allglobal::mn, allglobal::mpi_comm_spec, allglobal::myid, allglobal::ncpu, newtontime::ndcalls, newton(), newtontime::nfcalls, allglobal::nfreeboundaryiterations, allglobal::notstellsym, inputlist::nvol, constants::one, fileunits::ounit, numerical::sqrtmachprec, constants::ten, constants::two, inputlist::wmacros, writereadgf(), and constants::zero.

Referenced by fcn1(), fcn2(), newton(), spec(), and writereadgf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writereadgf()

subroutine writereadgf ( character, intent(in)  readorwrite,
integer, intent(in)  NGdof,
integer, intent(out)  ireadhessian 
)

read or write force-derivative matrix

Parameters
[in]readorwrite
[in]NGdof
[out]ireadhessian

References allglobal::cpus, fileunits::dunit, allglobal::hessian, inputlist::igeometry, allglobal::im, allglobal::in, inputlist::istellsym, inputlist::lfreebound, allglobal::lhessianallocated, matrix(), allglobal::mn, allglobal::mpi_comm_spec, inputlist::mpol, allglobal::myid, newton(), inputlist::ntor, inputlist::nvol, fileunits::ounit, and constants::zero.

Referenced by fcn2(), and newton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fcn1()

subroutine fcn1 ( integer, intent(in)  NGdof,
real, dimension(1:ngdof), intent(in)  xx,
real, dimension(1:ngdof), intent(out)  fvec,
integer, intent(in)  irevcm 
)

◆ fcn2()

subroutine fcn2 ( integer, intent(in)  NGdof,
real, dimension(1:ngdof), intent(in)  xx,
real, dimension(1:ngdof), intent(out)  fvec,
real, dimension(1:ldfjac,1:ngdof), intent(out)  fjac,
integer, intent(in)  Ldfjac,
integer, intent(in)  irevcm 
)

Objective to be given to the Newton solver, using function values and derivatives.

Parameters
[in]NGdof
[in]xx
[out]fvec
[out]fjac
[in]Ldfjac
[in]irevcmindicator for reverse communication; provided by solver to tell this method what to compute

References allglobal::bbe, allglobal::bbo, inputlist::c05factor, inputlist::c05xmax, inputlist::c05xtol, allglobal::cpus, allglobal::dbbdmp, allglobal::dessian, allglobal::dffdrz, dforce(), allglobal::dmupfdx, allglobal::energy, fcn2(), allglobal::forceerr, inputlist::forcetol, allglobal::hessian, inputlist::igeometry, allglobal::iie, allglobal::iio, allglobal::im, allglobal::in, allglobal::irbc, allglobal::irbs, allglobal::izbc, allglobal::izbs, newtontime::lastcpu, inputlist::lcheck, inputlist::lfindzero, allglobal::lgdof, allglobal::lhessianallocated, inputlist::lreadgf, allglobal::mn, allglobal::mpi_comm_spec, allglobal::myid, allglobal::ncpu, newtontime::ndcalls, newton(), newtontime::nfcalls, allglobal::nfreeboundaryiterations, allglobal::notstellsym, inputlist::nvol, constants::one, fileunits::ounit, packxi(), numerical::sqrtmachprec, constants::ten, constants::two, volume(), inputlist::wmacros, sphdf5::write_convergence_output(), writereadgf(), allglobal::wrtend(), and constants::zero.

Referenced by fcn2(), and newton().

Here is the call graph for this function:
Here is the caller graph for this function: