3.1.1.5. c3po.couplers.FixedPointCoupler module
Contain the class FixedPointCoupler.
- class c3po.couplers.FixedPointCoupler.FixedPointCoupler(physics, exchangers, dataManagers)
Bases:
CouplerFixedPointCouplerinherits fromCouplerand proposes a damped fixed point algorithm.The class proposes an algorithm for the resolution of \(F(X) = X\). Thus
FixedPointCoupleris 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 and alpha the damping factor):
\[X^{n+1} = \alpha . F(X^{n}) + (1 - \alpha).X^{n}\]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.The default damping factor is 1 (no damping). Call
setDampingFactor()to change it.- __init__(physics, exchangers, dataManagers)
Build a
FixedPointCouplerobject.- Parameters:
physics (list[PhysicsDriver]) – 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.
- getIterateStatus()
- getSolveStatus()
- initTimeStep(dt)
- iterateTimeStep()
Make on iteration of a damped fixed-point algorithm.
See also
c3po.PhysicsDriver.PhysicsDriver.iterateTimeStep().
- setConvergenceParameters(tolerance, maxiter)
Set the convergence parameters (tolerance and maximum number of iterations).
- Parameters:
tolerance – The convergence threshold in \(||F(X^{n}) - X^{n}|| / ||F(X^{n})|| < \rm{tolerance}\).
maxiter – The maximal number of iterations.
- setDampingFactor(dampingFactor)
Set the damping factor of the method.
- Parameters:
dampingFactor – The damping factor alpha in the formula \(X^{n+1} = \alpha . F(X^{n}) + (1 - \alpha).X^{n}\).
- setFailureManagement(leaveIfSolvingFailed)
Set if iterations should continue or not in case of solver failure (
solveTimeStep()returns False).- Parameters:
leaveIfSolvingFailed (bool) – Set False to continue the iterations, True to stop. Default: False.
- 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.
- setUseIterate(useIterate)
If True is given, the
iterate()method on the givenPhysicsDriveris called instead of thesolve()method.
- solveTimeStep()
Solve a time step using the damped fixed-point algorithm.