functions in strategy_python are descibed here
calls Initialize and InitializeElements of the Scheme
- Initilize is intended to be called just once when the strategy is initialized
- InitializeElements calls Initialize function of the elements
This function is called at every time step to solve the problem. the order of calls is as follow
- Initializations needed and similar for all steps are done by Initialize. First of all it checks if Initialize is called or no so just in the first call of Solve, scheme and elements are initialized and then corresponding flag turns out to True
- Initializations needed for every step is done by InitializeSolutionStep.
- Predict to start nonlinear iteration is done by Predict function.It calls predict of the corresponding scheme.For example in Bossak scheme it consider Xnew=Xold+Vold*deltaT and then Update velocity and acceleration with this new displacement.
- ExecuteIteration does a nonlinear iteration and return 0.( for the first iteration which is out of iteration loop norm is not calculated
- Iteration loop starts with two stop criterion, one on the convergence and the other on the maximum number of iterations. In the iteration loop three functions are called.
- convergence_criteria.preciteria : if the convergence_criteria = displacement_criteria then this priciteria does nothing and just return True
- ExecuteIteration : one nonlinear iteration is done
- convergence_criteria.postcriteria : for convergence_criteria = displacement_criteria this post criteria calculate two norms: one of them is the ratio between norm of correction and norm of displacement itself and the other one is the absolute norm which is ratio of norm of correction to square root of number of DOFs
- FinalizeSolutionStep : now that a step is solved it is the time to finalize it.
In principle this function calls its counterpart in builder_and_solver and scheme but before if it is necessary the new set of DOFs to be solved in this iteration is identified and related changes are done by following functions of builder_and_solver: SetUpDofSet, SetUpSystem and ResizeAndInitializeVectors.
what do the initializesolutionstep of builder_and_solver and scheme do? I have no example for builder_and_solver. I'm using residulabased_elimination_builder_and_solver and this function does nothing but for scheme, for example Bossak, it does something. It calls initializesolutionstep of the Scheme that calls this function for element and condition and also calculate some constants for Bossak scheme.
following steps are done to execute a nonlinear iteration
- initializeNonlinIteration of the scheme is called. In Bossak scheme it does nothing!
- BuildAndSolve of corresponding builder_and_solver is called. As it is clear it builds the system and solve it for the unknowns. build process is done by a function named CalculateSystemContributions, defined in the scheme, which is called by Build function of the builder_and_solver. In a loop over all elements, CalculateSystemContributions calls following functions of the element
and then add them together with constants defined by the scheme. The same procedure is exactly done for condition instead of element by Condition_CalculateSystemContributions.
- Update: Of course after solving the system update is needed. it is done by the update function of the corresponding scheme.
- Movemesh: if it is necessary,It is identified by movemeshflag, nodes are moved. MoveMesh is defined in Kratos>python>add_strategies_to_python.cpp
- FinalizeNonLinIteration: calls this function of elements and conditions.this function is called at the end of every iteration.
- ExecuteIteration returns the second norm of Dx or zero.