3.1.1.3. c3po.couplers.CrossedSecantCoupler module
Contain the class CrossedSecantCoupler.
- class c3po.couplers.CrossedSecantCoupler.CrossedSecantCoupler(physics, exchangers, dataManagers)
Bases:
CouplerCrossedSecantCouplerinherits fromCouplerand proposes a fixed point algorithm with crossed secant acceleration.The class proposes an algorithm for the resolution of \(F(X) = X\). Thus
CrossedSecantCoupleris aCouplerworking with :A single
PhysicsDriver(possibly aCoupler) defining the calculations to be made each time \(F\) is called.A list of
DataManagerallowing to manipulate the data in the coupling (the \(X\)).Two
Exchangerallowing to go from thePhysicsDriverto theDataManagerand vice versa.
Each
DataManageris normalized with its own norm got after the first iteration. They are then used as a singleDataManagerusingCollaborativeDataManager.At each iteration we do (with \(n\) the iteration number):
\[ \begin{align}\begin{aligned}X^{n+1} = F(X^{n}) - (F(X^{n}) - X^{n}).[(F(X^{n}) - F(X^{n-1})).(F(X^{n}) - X^{n} -\\(F(X^{n-1}) - X^{n-1}))]/(||F(X^{n}) - X^{n} - (F(X^{n-1}) - X^{n-1})||^2)\end{aligned}\end{align} \]The convergence criteria is : \(||F(X^{n}) - X^{n}|| / ||F(X^{n})|| < \rm{tolerance}\). The default norm used is the infinite norm.
setNormChoice()allows to choose another one.The default value of tolerance is 1.E-6. Call
setConvergenceParameters()to change it.The default maximum number of iterations is 100. Call
setConvergenceParameters()to change it.- __init__(physics, exchangers, dataManagers)
Build a
CrossedSecantCouplerobject.- Parameters:
physics (list[PhysicsDriver], list[Coupler]) – List of only one
PhysicsDriver(possibly aCoupler).exchangers (list[Exchanger]) – List of exactly two
Exchangerallowing to go from thePhysicsDriverto theDataManagerand vice versa.dataManagers (list[DataManager]) – List of
DataManager.
- getSolveStatus()
- setConvergenceParameters(tolerance, maxiter)
Set the convergence parameters (
toleranceand maximum number of iterations).- Parameters:
tolerance – The convergence threshold in \(||F(X^{n}) - X^{n}|| / ||X^{n+1}|| < \rm{tolerance}\).
maxiter – The maximal number of iterations.
- setPrintLevel(level)
Set the print level during iterations (0=None, 1 keeps last iteration, 2 prints every iteration).
- Parameters:
level (int) – Integer in range [0;2]. Default: 2.
- solveTimeStep()
Solve a time step using the damped fixed-point algorithm.