MainSolver
MainSolverStatic
PyBind interface (trampoline) class for static solver. With this interface, the static solver and its substructures can be accessed via Python. NOTE that except from SolveSystem(…), these functions are only intended for experienced users and they need to be handled with care, as unexpected crashes may happen if used inappropriate. Furthermore, the functions have a lot of overhead (performance much lower than internal solver) due to Python interfaces, and should thus be used for small systems. To access the solver in Python, write:
solver = MainSolverStatic()
and hereafter you can access all data and functions via ‘solver’.
MainSolverStatic has the following items:
name |
type / return type |
default / arguments |
description |
|---|---|---|---|
|
SolverConvergenceData |
all information about tolerances, errors and residua |
|
|
SolverIterationData |
all information about iterations (steps, discontinuous iteration, newton,…) |
|
|
NewtonSettings |
copy of newton settings from timeint or staticSolver |
|
|
SolverOutputData |
output modes and timers for exporting solver information and solution |
|
|
CSolverTimer |
timer which measures the CPU time of solver sub functions |
|
|
bool |
mainSystem |
check if MainSolver and MainSystem are correctly initialized ==> otherwise raise SysError |
|
void |
mainSystem, velocityLevel=False |
compute the algebraic equations in systemResidual in range(nODE2+nODE1, nODE2+nODE1+nAE) |
|
void |
mainSystem, scalarFactor_ODE2=1., scalarFactor_ODE2_t=0., scalarFactor_ODE1=1., velocityLevel=False |
add jacobian of algebraic equations (multiplied with factor) to systemJacobian in cSolver; the scalarFactors are scaling the derivatives w.r.t. ODE2 coordinates, ODE2_t (velocity) coordinates and ODE1 coordinates; if velocityLevel == true, the constraints are evaluated at velocity level; the scalar factors scalarFactor_ODE2=0 and scalarFactor_ODE2 are used for the same ODE2 block in the jacobian |
|
void |
mainSystem, scalarFactor_ODE2=1., scalarFactor_ODE2_t=0., scalarFactor_ODE1=1. |
ADD jacobian of ODE1RHS (multiplied with factors for ODE2 and ODE1 coordinates) to the according rows (nODE2:nODE2+nODE1) of the exising systemJacobian in cSolver; it requires a prior call to ComputeJacobianODE2RHS(…); the scalar factors scalarFactor_ODE2=0 and scalarFactor_ODE2 are used for the same ODE2 block in the jacobian |
|
void |
mainSystem, scalarFactor_ODE2=1., scalarFactor_ODE2_t=0., scalarFactor_ODE1=1., computeLoadsJacobian=0 |
set systemJacobian to zero, size = (nODE2+nODE1+nAE) x (nODE2+nODE1+nAE), and add jacobian (multiplied with factors for ODE2 and ODE1 coordinates) of ODE2RHS to systemJacobian in cSolver; using (scalarFactor_ODE2=-1,scalarFactor_ODE2=0) gives the stiffness matrix (=derivatives of ODE2 coords) in the nODE2 x nODE2 part, while using (scalarFactor_ODE2=0,scalarFactor_ODE2=-1) gives the damping matrix (= derivatives of ODE2 velocity coordinates) in the same part; a superposition of these two parts makes sense for implicit solvers; if , Index computeLoadsJacobian=0, loads are not considered in the Jacobian computation; for , Index computeLoadsJacobian=1 the ODE2 and ODE1 derivatives of loads are included and for , Index computeLoadsJacobian=2, also the ODE2_t dependencies are added |
|
Real |
simulationSettings |
for static solver, this is a factor in interval [0,1]; MUST be overwritten |
|
void |
mainSystem, scalarFactor=1. |
compute systemMassMatrix (multiplied with factor) in cSolver and return mass nODE2 x nODE2 matrix |
|
void |
mainSystem, simulationSettings |
compute jacobian for newton method of given solver method; store result in systemJacobian |
|
Real |
mainSystem, simulationSettings |
compute residual for Newton method (e.g. static or time step); store residual vector in systemResidual and return scalar residual (specific computation may depend on solver types) |
|
void |
mainSystem, simulationSettings, initial=True |
compute update for currentState from newtonSolution (decrement from residual and jacobian); if initial, this is for the initial update with newtonSolution=0 |
|
void |
mainSystem |
compute the RHS of ODE2 equations in systemResidual in range(0,nODE2) |
|
bool |
mainSystem, simulationSettings |
perform discontinuousIteration for static step / time step; CALLS ComputeNewtonResidual |
|
void |
mainSystem, simulationSettings |
write concluding information (timer statistics, messages) and close files |
|
void |
mainSystem, simulationSettings |
finish static step / time step; write output of results to file |
|
Index |
number of algebraic equations in solver |
|
|
Index |
number of data (history) variables in solver |
|
|
std::string |
return error string if solver has not been successful |
|
|
NumpyVector |
get locally stored / last computed solution (=increment) of Newton |
|
|
Index |
number of ODE1 equations in solver (not yet implemented) |
|
|
Index |
number of ODE2 equations in solver |
|
|
Real |
simulationSettings |
compute simulation end time (depends on static or time integration solver) |
|
std::string |
get solver name - needed for output file header and visualization window |
|
|
NumpyMatrix |
get locally stored / last computed system jacobian of solver |
|
|
NumpyMatrix |
get locally stored / last computed mass matrix of solver |
|
|
NumpyVector |
get locally stored / last computed system residual |
|
|
bool |
mainSystem, simulationSettings |
return true, if solver supports automatic stepsize control, otherwise false |
|
void |
mainSystem, simulationSettings |
increase step size if convergence is good |
|
bool |
mainSystem, simulationSettings |
initialize solverSpecific,data,it,conv; set/compute initial conditions (solver-specific!); initialize output files |
|
void |
mainSystem, simulationSettings |
initialize all data,it,conv; called from InitializeSolver() |
|
void |
mainSystem, simulationSettings |
set/compute initial conditions (solver-specific!); called from InitializeSolver() |
|
void |
mainSystem, simulationSettings |
initialize output files; called from InitializeSolver() |
|
bool |
mainSystem, simulationSettings |
check if system is solvable; initialize dense/sparse computation modes |
|
void |
mainSystem, simulationSettings |
initialize static step / time step; Python-functions; do some outputs, checks, etc. |
|
bool |
return true, if static solver; needs to be overwritten in derived class |
|
|
bool |
level |
return true, if file or console output is at or above the given level |
|
Real |
multiplicative load step factor; this factor is computed from loadStepGeometric parameters in SolveSystem(…) |
|
|
bool |
mainSystem, simulationSettings |
perform Newton method for given solver method |
|
void |
mainSystem, simulationSettings |
post-initialize for solver specific tasks; called at the end of InitializeSolver |
|
void |
mainSystem, simulationSettings |
pre-initialize for solver specific tasks; called at beginning of InitializeSolver, right after Solver data reset |
|
bool |
mainSystem, simulationSettings, severity |
reduce step size (1..normal, 2..severe problems); return true, if reduction was successful |
|
void |
systemJacobian |
set locally stored system jacobian of solver; must have size nODE2+nODE1+nAE |
|
void |
systemMassMatrix |
set locally stored mass matrix of solver; must have size nODE2+nODE1+nAE |
|
void |
systemResidual |
set locally stored system residual; must have size nODE2+nODE1+nAE |
|
bool |
mainSystem, simulationSettings |
main solver part: calls multiple InitializeStep(…)/ DiscontinuousIteration(…)/ FinishStep(…); do step reduction if necessary; return true if success, false else |
|
bool |
mainSystem, simulationSettings |
solve System: InitializeSolver, SolveSteps, FinalizeSolver |
|
void |
mainSystem, simulationSettings |
update currentTime (and load factor); MUST be overwritten in special solver class |
|
void |
level, str |
write to console and/or file in case of level |
|
void |
mainSystem, simulationSettings |
write unique coordinates solution file |
|
void |
mainSystem, simulationSettings |
write unique file header, depending on static/ dynamic simulation |
MainSolverImplicitSecondOrder
PyBind interface (trampoline) class for dynamic implicit solver. Note that this solver includes the classical Newmark method (set useNewmark True; with option of index 2 reduction) as well as the generalized-alpha method. With the interface, the dynamic implicit solver and its substructures can be accessed via Python. NOTE that except from SolveSystem(…), these functions are only intended for experienced users and they need to be handled with care, as unexpected crashes may happen if used inappropriate. Furthermore, the functions have a lot of overhead (still fast, but performance much lower than internal solver) due to Python interfaces, and should thus be used for small systems. To access the solver in Python, write:
solver = MainSolverImplicitSecondOrder()
and hereafter you can access all data and functions via ‘solver’. In this solver, user functions are possible to extend the solver at certain parts, while keeping the overal C++ performance. User functions, which are added with SetUserFunction…(…), have the arguments (MainSolver, MainSystem, simulationSettings), except for ComputeNewtonUpdate which adds the initial flag as an additional argument and ComputeNewtonResidual, which returns the scalar residual.
MainSolverImplicitSecondOrder has the following items:
name |
type / return type |
default / arguments |
description |
|---|---|---|---|
|
SolverConvergenceData |
all information about tolerances, errors and residua |
|
|
SolverIterationData |
all information about iterations (steps, discontinuous iteration, newton,…) |
|
|
NewtonSettings |
copy of newton settings from timeint or staticSolver |
|
|
SolverOutputData |
output modes and timers for exporting solver information and solution |
|
|
CSolverTimer |
timer which measures the CPU time of solver sub functions; note that solver structures can only be written indirectly, e.g., timer=dynamicSolver.timer; timer.useTimer = False; dynamicSolver.timer=timer; however, dynamicSolver.timer.useTimer cannot be written. |
|
|
Real |
copy of parameter in timeIntegration.generalizedAlpha |
|
|
Real |
copy of parameter in timeIntegration.generalizedAlpha |
|
|
bool |
mainSystem |
check if MainSolver and MainSystem are correctly initialized ==> otherwise raise SysError |
|
void |
mainSystem, velocityLevel=False |
compute the algebraic equations in systemResidual in range(nODE2+nODE1, nODE2+nODE1+nAE) |
|
void |
mainSystem, scalarFactor_ODE2=1., scalarFactor_ODE2_t=0., scalarFactor_ODE1=1., velocityLevel=False |
add jacobian of algebraic equations (multiplied with factor) to systemJacobian in cSolver; the scalarFactors are scaling the derivatives w.r.t. ODE2 coordinates, ODE2_t (velocity) coordinates and ODE1 coordinates; if velocityLevel == true, the constraints are evaluated at velocity level; the scalar factors scalarFactor_ODE2=0 and scalarFactor_ODE2 are used for the same ODE2 block in the jacobian |
|
void |
mainSystem, scalarFactor_ODE2=1., scalarFactor_ODE2_t=0., scalarFactor_ODE1=1. |
ADD jacobian of ODE1RHS (multiplied with factors for ODE2 and ODE1 coordinates) to the according rows (nODE2:nODE2+nODE1) of the exising systemJacobian in cSolver; it requires a prior call to ComputeJacobianODE2RHS(…); the scalar factors scalarFactor_ODE2=0 and scalarFactor_ODE2 are used for the same ODE2 block in the jacobian |
|
void |
mainSystem, scalarFactor_ODE2=1., scalarFactor_ODE2_t=0., scalarFactor_ODE1=1., computeLoadsJacobian=0 |
set systemJacobian to zero, size = (nODE2+nODE1+nAE) x (nODE2+nODE1+nAE), and add jacobian (multiplied with factors for ODE2 and ODE1 coordinates) of ODE2RHS to systemJacobian in cSolver; using (scalarFactor_ODE2=-1,scalarFactor_ODE2=0) gives the stiffness matrix (=derivatives of ODE2 coords) in the nODE2 x nODE2 part, while using (scalarFactor_ODE2=0,scalarFactor_ODE2=-1) gives the damping matrix (= derivatives of ODE2 velocity coordinates) in the same part; a superposition of these two parts makes sense for implicit solvers; if , Index computeLoadsJacobian=0, loads are not considered in the Jacobian computation; for , Index computeLoadsJacobian=1 the ODE2 and ODE1 derivatives of loads are included and for , Index computeLoadsJacobian=2, also the ODE2_t dependencies are added |
|
Real |
simulationSettings |
for static solver, this is a factor in interval [0,1]; MUST be overwritten |
|
void |
mainSystem, scalarFactor=1. |
compute systemMassMatrix (multiplied with factor) in cSolver and return mass nODE2 x nODE2 matrix |
|
void |
mainSystem, simulationSettings |
compute jacobian for newton method of given solver method; store result in systemJacobian |
|
Real |
mainSystem, simulationSettings |
compute residual for Newton method (e.g. static or time step); store residual vector in systemResidual and return scalar residual (specific computation may depend on solver types) |
|
void |
mainSystem, simulationSettings, initial=True |
compute update for currentState from newtonSolution (decrement from residual and jacobian); if initial, this is for the initial update with newtonSolution=0 |
|
void |
mainSystem |
compute the RHS of ODE1 equations in systemResidual in range(0,nODE1) |
|
void |
mainSystem |
compute the RHS of ODE2 equations in systemResidual in range(0,nODE2) |
|
bool |
mainSystem, simulationSettings |
perform discontinuousIteration for static step / time step; CALLS ComputeNewtonResidual |
|
Real |
locally computed parameter from generalizedAlpha parameters |
|
|
void |
mainSystem, simulationSettings |
write concluding information (timer statistics, messages) and close files |
|
void |
mainSystem, simulationSettings |
finish static step / time step; write output of results to file |
|
NumpyVector |
get locally stored / last computed algorithmic accelerations |
|
|
Index |
number of algebraic equations in solver |
|
|
Index |
number of data (history) variables in solver |
|
|
std::string |
return error string if solver has not been successful |
|
|
NumpyVector |
get locally stored / last computed solution (=increment) of Newton |
|
|
Index |
number of ODE1 equations in solver (not yet implemented) |
|
|
Index |
number of ODE2 equations in solver |
|
|
Real |
simulationSettings |
compute simulation end time (depends on static or time integration solver) |
|
std::string |
get solver name - needed for output file header and visualization window |
|
|
NumpyVector |
get locally stored / last computed algorithmic accelerations at start of step |
|
|
NumpyMatrix |
get locally stored / last computed system jacobian of solver |
|
|
NumpyMatrix |
get locally stored / last computed mass matrix of solver |
|
|
NumpyVector |
get locally stored / last computed system residual |
|
|
bool |
mainSystem, simulationSettings |
return true, if solver supports automatic stepsize control, otherwise false |
|
void |
mainSystem, simulationSettings |
increase step size if convergence is good |
|
bool |
mainSystem, simulationSettings |
initialize solverSpecific,data,it,conv; set/compute initial conditions (solver-specific!); initialize output files |
|
void |
mainSystem, simulationSettings |
initialize all data,it,conv; called from InitializeSolver() |
|
void |
mainSystem, simulationSettings |
set/compute initial conditions (solver-specific!); called from InitializeSolver() |
|
void |
mainSystem, simulationSettings |
initialize output files; called from InitializeSolver() |
|
bool |
mainSystem, simulationSettings |
check if system is solvable; initialize dense/sparse computation modes |
|
void |
mainSystem, simulationSettings |
initialize static step / time step; Python-functions; do some outputs, checks, etc. |
|
bool |
return true, if static solver; needs to be overwritten in derived class |
|
|
bool |
level |
return true, if file or console output is at or above the given level |
|
Real |
copy of parameter in timeIntegration.generalizedAlpha |
|
|
Real |
copy of parameter in timeIntegration.generalizedAlpha |
|
|
bool |
mainSystem, simulationSettings |
perform Newton method for given solver method |
|
void |
mainSystem, simulationSettings |
post-initialize for solver specific tasks; called at the end of InitializeSolver |
|
Real |
mainSystem, simulationSettings |
call PostNewton for all relevant objects (contact, friction, … iterations); returns error for discontinuous iteration |
|
void |
mainSystem, simulationSettings |
pre-initialize for solver specific tasks; called at beginning of InitializeSolver, right after Solver data reset |
|
bool |
mainSystem, simulationSettings, severity |
reduce step size (1..normal, 2..severe problems); return true, if reduction was successful |
|
void |
systemJacobian |
set locally stored system jacobian of solver; must have size nODE2+nODE1+nAE |
|
void |
systemMassMatrix |
set locally stored mass matrix of solver; must have size nODE2+nODE1+nAE |
|
void |
systemResidual |
set locally stored system residual; must have size nODE2+nODE1+nAE |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
void |
mainSystem, userFunction |
set user function |
|
bool |
mainSystem, simulationSettings |
main solver part: calls multiple InitializeStep(…)/ DiscontinuousIteration(…)/ FinishStep(…); do step reduction if necessary; return true if success, false else |
|
bool |
mainSystem, simulationSettings |
solve System: InitializeSolver, SolveSteps, FinalizeSolver |
|
Real |
copy of parameter in timeIntegration.generalizedAlpha |
|
|
void |
mainSystem, simulationSettings |
update currentTime (and load factor); MUST be overwritten in special solver class |
|
void |
level, str |
write to console and/or file in case of level |
|
void |
mainSystem, simulationSettings |
write unique coordinates solution file |
|
void |
mainSystem, simulationSettings |
write unique file header, depending on static/ dynamic simulation |
MainSolverExplicit
PyBind interface (trampoline) class for dynamic explicit solver. Note that this solver includes the 1st order explicit Euler scheme and the 4th order Runge-Kutta scheme with 5th order error estimation (DOPRI5). With the interface, the solver and its substructures can be accessed via Python. NOTE that except from SolveSystem(…), these functions are only intended for experienced users and they need to be handled with care, as unexpected crashes may happen if used inappropriate. Furthermore, the functions have a lot of overhead (still fast, but performance much lower than internal solver) due to Python interfaces, and should thus be used for small systems. To access the solver in Python, write
solver = MainSolverExplicit()
and hereafter you can access all data and functions via ‘solver’. In this solver, no user functions are possible, but you can use SolverImplicitSecondOrder instead (turning off Newton gives explicit scheme …).
MainSolverExplicit has the following items:
name |
type / return type |
default / arguments |
description |
|---|---|---|---|
|
SolverConvergenceData |
all information about tolerances, errors and residua |
|
|
SolverIterationData |
all information about iterations (steps, discontinuous iteration, newton,…) |
|
|
SolverOutputData |
output modes and timers for exporting solver information and solution |
|
|
CSolverTimer |
timer which measures the CPU time of solver sub functions |
|
|
Real |
simulationSettings |
for static solver, this is a factor in interval [0,1]; MUST be overwritten |
|
void |
mainSystem, scalarFactor=1. |
compute systemMassMatrix (multiplied with factor) in cSolver and return mass matrix |
|
void |
mainSystem, simulationSettings |
compute jacobian for newton method of given solver method; store result in systemJacobian |
|
Real |
mainSystem, simulationSettings |
compute residual for Newton method (e.g. static or time step); store residual vector in systemResidual and return scalar residual (specific computation may depend on solver types) |
|
void |
mainSystem, simulationSettings, initial=True |
compute update for currentState from newtonSolution (decrement from residual and jacobian); if initial, this is for the initial update with newtonSolution=0 |
|
void |
mainSystem |
compute the RHS of ODE1 equations in systemResidual in range(0,nODE1) |
|
void |
mainSystem |
compute the RHS of ODE2 equations in systemResidual in range(0,nODE2) |
|
bool |
mainSystem, simulationSettings |
perform discontinuousIteration for static step / time step; CALLS ComputeNewtonResidual |
|
void |
mainSystem, simulationSettings |
write concluding information (timer statistics, messages) and close files |
|
void |
mainSystem, simulationSettings |
finish static step / time step; write output of results to file |
|
Index |
number of algebraic equations in solver |
|
|
Index |
number of data (history) variables in solver |
|
|
std::string |
return error string if solver has not been successful |
|
|
Index |
return order of method (higher value in methods with automatic step size, e.g., DOPRI5=5) |
|
|
Index |
return number of stages in current method |
|
|
Index |
number of ODE1 equations in solver (not yet implemented) |
|
|
Index |
number of ODE2 equations in solver |
|
|
Real |
simulationSettings |
compute simulation end time (depends on static or time integration solver) |
|
std::string |
get solver name - needed for output file header and visualization window |
|
|
NumpyMatrix |
get locally stored / last computed mass matrix of solver |
|
|
NumpyVector |
get locally stored / last computed system residual |
|
|
bool |
mainSystem, simulationSettings |
return true, if solver supports automatic stepsize control, otherwise false |
|
void |
mainSystem, simulationSettings |
increase step size if convergence is good |
|
bool |
mainSystem, simulationSettings |
initialize solverSpecific,data,it,conv; set/compute initial conditions (solver-specific!); initialize output files |
|
void |
mainSystem, simulationSettings |
initialize all data,it,conv; called from InitializeSolver() |
|
void |
mainSystem, simulationSettings |
set/compute initial conditions (solver-specific!); called from InitializeSolver() |
|
void |
mainSystem, simulationSettings |
initialize output files; called from InitializeSolver() |
|
bool |
mainSystem, simulationSettings |
check if system is solvable; initialize dense/sparse computation modes |
|
void |
mainSystem, simulationSettings |
initialize static step / time step; Python-functions; do some outputs, checks, etc. |
|
bool |
return true, if static solver; needs to be overwritten in derived class |
|
|
bool |
level |
return true, if file or console output is at or above the given level |
|
bool |
mainSystem, simulationSettings |
perform Newton method for given solver method |
|
void |
mainSystem, simulationSettings |
post-initialize for solver specific tasks; called at the end of InitializeSolver |
|
void |
mainSystem, simulationSettings |
pre-initialize for solver specific tasks; called at beginning of InitializeSolver, right after Solver data reset |
|
bool |
mainSystem, simulationSettings, severity |
reduce step size (1..normal, 2..severe problems); return true, if reduction was successful |
|
void |
systemMassMatrix |
set locally stored mass matrix of solver; must have size nODE2+nODE1+nAE |
|
void |
systemResidual |
set locally stored system residual; must have size nODE2+nODE1+nAE |
|
bool |
mainSystem, simulationSettings |
main solver part: calls multiple InitializeStep(…)/ DiscontinuousIteration(…)/ FinishStep(…); do step reduction if necessary; return true if success, false else |
|
bool |
mainSystem, simulationSettings |
solve System: InitializeSolver, SolveSteps, FinalizeSolver |
|
void |
mainSystem, simulationSettings |
update currentTime (and load factor); MUST be overwritten in special solver class |
|
void |
level, str |
write to console and/or file in case of level |
|
void |
mainSystem, simulationSettings |
write unique coordinates solution file |
|
void |
mainSystem, simulationSettings |
write unique file header, depending on static/ dynamic simulation |