A SolidBody with methods for the assembly of sparse vectors/matrices.
Parameters:
umat (class) – A class which provides methods for evaluating the gradient and the hessian of
the strain energy density function per unit undeformed volume. The function
signatures must be dψdF,ζ_new=umat.gradient([F,ζ]) for
the gradient and d2ψdFdF=umat.hessian([F,ζ]) for the hessian of
the strain energy density function \(\psi(\boldsymbol{F})\), where
\(\boldsymbol{F}\) is the deformation gradient tensor and \(\zeta\)
holds the array of internal state variables.
field (FieldContainer) – A field container with one or more fields.
statevars (ndarray or None, optional) – Array of initial internal state variables (default is None).
density (float or None, optional) – The density of the solid body.
block (bool, optional) – Assemble a sparse matrix from sparse sub-blocks or assemble a sparse vector by
stacking sparse matrices vertically (row wise). Default is True.
apply (callable or None, optional) – Apply a callable on the assembled vectors and sparse matrices. Default is None.
multiplier (float or None, optional) – A scale factor for the assembled vector and matrix. Default is None.
grad (list of bool or None, optional) – A list with gradient flags for the individual fields. If None, the gradient
will be computed for the first field, whereas the for the remaining fields, the
field values (no gradient) will be used. Default is None.
Notes
The total potential energy of internal forces is given in Eq. (1)
The solid body is now revolved around the x-axis. This model may now be used to
apply non-axisymmetric loads. Here, the same load case is also applied on the
3d-model.
A (nearly) incompressible solid body with methods for the assembly of sparse
vectors/matrices. The constitutive material definition must provide the distortional
part of the strain energy density function per unit undeformed volume only. The
volumetric part of the strain energy density function is automatically added on
additional internal (dual) cell-wise constant fields.
Parameters:
umat (class) – A class which provides methods for evaluating the gradient and the hessian of
the isochoric part of the strain energy density function per unit undeformed
volume \(\hat\psi(\boldsymbol{F})\). The function signatures must be
dψdF,ζ_new=umat.gradient([F,ζ]) for the gradient and
d2ψdFdF=umat.hessian([F,ζ]) for the hessian of
the strain energy density function \(\hat{\psi}(\boldsymbol{F})\), where
\(\boldsymbol{F}\) is the deformation gradient tensor and \(\zeta\)
holds the array of internal state variables.
field (FieldContainer) – A field container with one or more fields.
bulk (float or None, optional) – The bulk modulus \(K\) of the volumetric part of the strain energy density
function \(U(\bar{J})\), which is required if volumetric is a kind. It
must be None if volumetric is an instance, which holds its own parameters.
Default is None.
state (StateNearlyIncompressible or None, optional) – A valid initial state for a (nearly) incompressible solid (default is None).
statevars (ndarray or None, optional) – Array of initial internal state variables (default is None).
density (float or None, optional) – The density of the solid body.
volumetric (str or VolumetricStrainEnergy, optional) – The volumetric part of the strain energy density function \(U(\bar{J})\),
given by a kind with the bulk modulus, "volume-ratio" for
\(U(\bar{J})=K(\bar{J}-1)^2/2\), "stretch" for
\(U(\bar{J})=9K(\bar{J}^{1/3}-1)^2/2\) or "log" for
\(U(\bar{J})=K\ln(\bar{J})^2/2\), or by an instance of
VolumetricStrainEnergy, e.g. of a custom subclass. Default is
"volume-ratio".
The total potential energy of internal forces for a three-field variational
approach, suitable for nearly-incompressible material behaviour, is given in Eq.
(5)
(5)#\[\Pi_{int}(\boldsymbol{F}, p, \bar{J}) =
\int_V \hat{\psi}(\boldsymbol{F})\ dV +
\int_V U(\bar{J})\ dV +
\int_V p (J - \bar{J})\ dV\]
with the volumetric part of the strain energy density function \(U(\bar{J})\),
see VolumetricStrainEnergy. Its first and second derivatives
w.r.t. the volume ratio are abbreviated by \(\bar{U}'=U'(\bar{J})\) and
\(\bar{U}''=U''(\bar{J})\). The variations of the total potential energy are
given in Eq. (6)
The volumetric part of the strain energy density function is given by
volumetric, see VolumetricStrainEnergy for the kinds
"volume-ratio" (default), "stretch" and "log" and for a custom
volumetric part. The undeformed configuration is free of stress only if
\(U'(1)=0\), and a positive second derivative \(U''(\bar{J})>0\) is
required for a stable volumetric response.
Hu-Washizu Three-Field-Variational Principle
The Three-Field-Variation \((\boldsymbol{u},p,\bar{J})\) leads to a linearized
equation system with nine sub block-matrices, see Eq. (9)[4].
Due to the fact that the equation system is derived by a potential, the matrix is
symmetric and hence, only six independent sub-matrices have to be evaluated.
Furthermore, by the application of the mean dilatation technique, two of the
remaining six sub-matrices are identified to be zero. That means four sub-matrices
are left to be evaluated, where two non-zero sub-matrices are scalar-valued entries.
A condensed representation of the equation system, only dependent on the primary
unknowns \(\boldsymbol{u}\) is carried out. To do so, the second line is
multiplied by the second derivative \(\bar{U}''\), see Eq.
(10).
The terms \(\bar{U}' + \bar{U}''\ (\dots)\) in Eq. (13) and
Eq. (14) are the linearizations of
\(U'(\bar{J} + \delta \bar{J})\) and \(U'(v/V)\). Instead, their exact
values are used, i.e. the pressure is updated by \(p = U'(\bar{J})\) and the
condensed constraint is evaluated by \(U'(v/V) - p\). Both are identical for
volumetric="volume-ratio". Hence, the assembled vector is the gradient of
the total potential energy of internal forces of the mean dilatation technique,
see Eq. (16), where the sum is taken over the cells.
checkpoint (dict) – A dict with checkpoint arrays / objects.
restore_statevars (bool, optional) – Flag to restore state variables. This is a power feature and must be used
with caution! Default is True.
restore_state (bool, optional) – Flag to restore the internal fields, i.e. the pressure \(p\) and the
volume ratio \(\bar{J}\), of the checkpoint. If False, the internal
fields are re-initialized by the deformation of the restored field,
\(\bar{J} = v / V\) and \(p = U'(\bar{J})\). Default is True.
Notes
The deformation gradient is evaluated for the restored field before the
results are re-evaluated. Hence, the internal fields are not updated by the
deformation gradient of the last evaluation (e.g. of a failed Newton
iteration).
field (FieldContainer) – A field container with fields created on a boundary region.
values (ndarray or None, optional) – The prescribed values (e.g. gravity \(\boldsymbol{g}\)). Default is None. If
None, the values are set to zero (the dimension is derived from the first field
of the field container).
scale (float, optional) – An optional scale factor for the values, e.g. density \(\rho\) of the solid
body. Default is 1.0.
field (FieldContainer) – A field container with fields created on a boundary region.
pressure (float or ndarray or None, optional) – A scaling factor for the prescribed pressure \(p\) (default is None). If
None, the pressure is set to zero.
Notes
Hint
The pressure is always given as normal force per deformed area. This is
important for axisymmetric problems.
field (FieldContainer) – A field container with fields created on a boundary region.
stress (ndarray of shape (3, 3, ...) or None, optional) – The prescribed Cauchy stress components \(\sigma_{ij}\) (default is None).
If None, all Cauchy stress components are set to zero.
A Truss body with methods for the assembly of sparse vectors/matrices.
Parameters:
umat (class) – A class which provides methods for evaluating the gradient and the hessian of
the strain energy density function per unit undeformed volume. The function
signatures must be dψdλ,ζ_new=umat.gradient([λ,ζ]) for
the gradient and d2ψdλdλ=umat.hessian([λ,ζ]) for the hessian of
the strain energy density function \(\psi(\lambda)\), where
\(\lambda\) is the stretch and \(\zeta\)
holds the array of internal state variables.
field (FieldContainer) – A field container with one or more fields.
area (float or ndarray) – The cross-sectional areas of the trusses.
statevars (ndarray or None, optional) – Array of initial internal state variables (default is None).
Notes
For a truss element the stretch is evaluated as given in Eq. (17)
The normal force of a truss depends directly on the geometric exactly defined
strain measure \(E_{11}\). For the general case of a nonlinear material
behaviour the normal force is defined as given in Eq. (20)
The (nonlinear) fixing force column vector may be expressed as a function of the
elemental force \(N_k\) and the deformed unit vector \(\boldsymbol{n}_k\),
see Eq. (23).
A change in the fixing force vector at the end node E w.r.t. a small change of
the displacements at node E is defined as the tangent stiffnes EE, see
Eq. (25).
ramp (dict, optional) – A dict with Boundary or item-keys which holds the array of
values to ramp (default is None). If None, only one substep is evaluated.
boundaries (dict of Boundary, optional) – A dict with Boundary conditions (default is None).
Notes
For each substep, the ramped items (and boundaries) are updated with the values of
the ramp and the Newton-Raphson method is evaluated, see generate_states().
If the Newton-Raphson method of a substep raises an error, plugins may recover the
substep, e.g. a CutbackPlugin subdivides the substep into smaller
increments.
stepnumber (int or None, optional) – The (zero-based) index of the step within the job (default is None).
time (int or None, optional) – The (zero-based) index of the first substep of the step within the job
(default is None).
**kwargs (dict) – Keyword arguments for newtonraphson(). The keyword argument
x0, the field container with the unknowns, is required. An optional
EventDispatcherdispatcher is used to trigger the
hooks of the plugins.
Yields:
felupe.SubstepState – The state of each completed substep with the result of the
Newton-Raphson method state.result.
Notes
The unknowns x0 are linked to the result of each completed substep, i.e.
they are the starting point of the next substep.
If a dispatcher is given, the hook before_substep is triggered before
each substep. If the Newton-Raphson method of a substep raises an error, the
hook after_failed_substep is triggered and plugins may recover the substep,
see SubstepState. If the substep is not recovered, the error
is raised. The Context of these hooks holds the step,
the items, the unknowns x0 and the callable res=solve(values), which
updates the ramped items with given values, evaluates the Newton-Raphson
method and links the unknowns x0 to the result.
A list of plugins with hooks to be used during evaluation. Available hooks are
before_job, after_job, before_step, after_step and
after_substep, the hooks of a substep before_substep and
after_failed_substep as well as the hooks of the Newton-Raphson method
before_newton, before_iteration, before_linear_solve,
after_linear_solve, after_iteration and after_newton, see
Plugin. Each hook takes the context and the current state as
arguments. All hooks are optional. Default is None, which is equivalent to an
empty list. Simple callable plugins are dispatched at the after_substep
hook. E.g., a backtracking line search is enabled by
Job(steps,plugins=[LinesearchPlugin()]) and failed substeps are subdivided
by Job(steps,plugins=[CutbackPlugin()]).
Changed in version 12.0.0: plugins is a keyword-only argument. The arguments callback and
**kwargs (for the callback) are removed, a callable plugin replaces the
callback, see the notes below.
The event dispatcher with the plugins of the job. The built-in plugins of an
evaluation, i.e. the ProgressPlugin and the
XDMFWriterPlugin, are not added to this dispatcher. Instead,
evaluate() creates a new dispatcher for each evaluation with
the plugins of the job and the built-in plugins.
A callable plugin is called after each completed substep (in the hook
after_substep) with the context and the state of the substep. It replaces the
callback (removed in 12.0.0): the step number and the substep number are
available as state.stepnumber and state.substepnumber and the result of
the substep as context.substep (or state.result). Keyword-arguments are
passed to the callback by a closure, e.g. a lambda function.
defcallback(stepnumber,substepnumber,substep,**kwargs):...# removed in 12.0.0# job = fem.Job(steps, callback=callback, a=1)# use a callable plugin insteadjob=fem.Job(steps,plugins=[lambdacontext,state:callback(state.stepnumber,state.substepnumber,context.substep,a=1)],)
Both are called with the same arguments. The removed callback was called before
the hook after_substep of all plugins. A callable plugin is called in the order
of the list of plugins, but always before the built-in plugins of
evaluate(). Hence, it is called in the same order if it is the
first plugin in the list.
filename (str or None, optional) – The filename of the XDMF result file. Must include the file extension
my_result.xdmf. If None, no result file is written during evaluation.
Default is None.
mesh (Mesh or None, optional) – A mesh which is used for the XDMF time series writer. If None, it is taken
from the field of the first item of the first step if no keyword argument
x0 is given. If None and x0=field, the mesh is taken from the x0
field container. Default is None.
point_data (dict or None, optional) – Additional dict of point-data for the meshio XDMF time series writer.
cell_data (dict or None, optional) – Additional dict of cell-data for the meshio XDMF time series writer.
point_data_default (bool, optional) – Flag to write default point-data to the XDMF result file. This includes
"Displacement". Default is True.
cell_data_default (bool, optional) – Flag to write default cell-data to the XDMF result file. This includes
"PrincipalValuesofLogarithmicStrain", "LogarithmicStrain" and
"DeformationGradient". Default is True.
verbose (bool or int or None, optional) – Verbosity level to control how messages are printed during evaluation. If
1 or True and tqdm is installed, a progress bar is shown. If tqdm is
missing or verbose is 2, more detailed text-based messages are printed.
Default is None. If None, verbosity is set to True. If None and the
environmental variable FELUPE_VERBOSE is set and its value is not true,
then logging is turned off.
parallel (bool, optional) – Flag to evaluate the contractions of numpy.einsum() during assembly
in chunks of cells by a pool of threads. This may add additional overhead
to small-sized problems. Default is False.
tqdm (str, optional) – If verbose is True, choose a backend for tqdm (“tqdm”, "auto" or
"notebook". Default is "tqdm".
**kwargs (dict) – Optional keyword arguments for generate(). If
parallel=True, it is added as kwargs["parallel"]=True to the dict
of additional keyword arguments. If x0 is present in kwargs.keys(),
it is used as the mesh for the XDMF time series writer.
A job with a list of steps and a method to evaluate them. Force-displacement
curve data is tracked during evaluation for a given Boundary by
a built-in CharacteristicCurvePlugin.
Parameters:
steps (list of Step) – A list with steps, where each step subsequently depends on the solution of the
previous step.
boundary (Boundary) – The boundary condition, whose displacements and reaction forces are tracked.
Changed in version 12.0.0: plugins is a keyword-only argument. The arguments callback and
**kwargs (for the callback) are removed, a callable plugin replaces the
callback, see the notes of Job.
filename (str or None, optional) – The filename of the animation file. Default is “animation.gif”. Supported
formats are GIF and MP4 (or any other format supported by PyVista). If None, no
animation file will be written. Default is “animation.gif”.
framerate (int, optional) – The framerate of the animation. Default is 5.
quality (int, optional) – The quality of the movie. Default is 5. This is only used for movie formats,
not for GIFs.
zoom_camera (float, optional) – The zoom factor for the camera. Default is 1.0.
reset_camera (bool, optional) – Whether to reset the camera before each frame. Default is True.
show_text (bool, optional) – Whether to show text on the plot. Default is True.
take_screenshots (bool or None, optional) – Whether to take screenshots for all substeps per step. If True, the screenshots
will be saved in the “figures” folder. Default is False.
**kwargs (dict, optional) – Additional keyword arguments to pass to the plot method of the items.
Notes
This plugin should be used with off_screen=True. While it is possible to show
the plotter during the job evaluation, it may flicker. The frames are always drawn
by the plotting backend of PyVista, independent of the current plotting backend.
This method is called after the evaluation of a job, also if the evaluation
failed (e.g. to close result files). Then, the error is available as
state.error and it is raised after all plugins are called.
context (felupe.Context) – The context object with the job, the step and the result of the substep
context.substep.
state (felupe.SubstepState) – The state of the substep (the same object as in the hooks
before_substep and after_failed_substep), which is also a
JobState with the step number, the substep number and the
time.
context (felupe.Context) – The context object with the job, the step and the result of the substep
context.substep.
state (felupe.SubstepState) – The state of the substep (the same object as in the hooks
before_substep and after_failed_substep), which is also a
JobState with the step number, the substep number and the
time.
Plot force-displacement characteristic curves on a pre-evaluated job,
tracked on a given Boundary.
Parameters:
x (list of ndarray or None, optional) – A list with arrays of displacement data. If None, the displacement is taken
from the first field of the field container from each completed substep. The
displacement data is then taken from the first point of the tracked
Boundary. Default is None.
y (list of ndarray or None, optional) – A list with arrays of reaction force data. If None, the force is taken
from the NewtonResult of each completed substep.
Default is None.
xaxis (int, optional) – The axis for the displacement data (default is 0).
yaxis (int, optional) – The axis for the reaction force data (default is 0).
xlabel (str or None, optional) – The label of the x-axis (default is None).
ylabel (str or None, optional) – The label of the y-axis (default is None).
xscale (float, optional) – A scaling factor for the displacement data (default is 1.0).
yscale (float, optional) – A scaling factor the reaction force data (default is 1.0).
xoffset (float, optional) – An offset for the displacement data (default is 0.0).
yoffset (float, optional) – An offset for the reaction force data (default is 0.0).
gradient (bool, optional) – A flag to plot the gradient of the y-data. Uses
numpy.gradient(edge_order=2). The gradient data is set to np.nan for
absolute values greater than the mean value plus two times the standard
deviation. Default is False.
swapaxes (bool, optional) – A flag to flip the plot (x, y) to (y, x). Also changes the labels.
Return force-displacement characteristic curves on a pre-evaluated job,
tracked on a given Boundary as arrays.
Parameters:
x (list of ndarray or None, optional) – A list with arrays of displacement data. If None, the displacement is taken
from the first field of the field container from each completed substep. The
displacement data is then taken from the first point of the tracked
Boundary. Default is None.
y (list of ndarray or None, optional) – A list with arrays of reaction force data. If None, the force is taken
from the NewtonResult of each completed substep.
Default is None.
xaxis (int, optional) – The axis for the displacement data (default is 0).
yaxis (int, optional) – The axis for the reaction force data (default is 0).
xscale (float, optional) – A scaling factor for the displacement data (default is 1.0).
yscale (float, optional) – A scaling factor the reaction force data (default is 1.0).
xoffset (float, optional) – An offset for the displacement data (default is 0.0).
yoffset (float, optional) – An offset for the reaction force data (default is 0.0).
gradient (bool, optional) – A flag to plot the gradient of the y-data. Uses
numpy.gradient(edge_order=2). The gradient data is set to np.nan for
absolute values greater than the mean value plus two times the standard
deviation. Default is False.
items (slice, ndarray or None) – Indices or a range of data points to plot. If None, all data points are
plotted (default is None).
A cutback of the increment of failed substeps. If the Newton-Raphson method
of a substep fails, the substep is subdivided into smaller increments.
Parameters:
factor (float, optional) – The factor \(0 < f < 1\) by which the increment is reduced after a failed
attempt (default is 0.5).
max_cutbacks (int, optional) – The maximum number of successive cutbacks of the increment (default is 10),
i.e. the smallest increment of a substep is
\(\Delta t_{\min} = f^{\text{max\_cutbacks}}\) (e.g.
\(0.5^{10} \approx 10^{-3}\)). Only reductions below the smallest
increment reached so far are limited. A failed attempt with an increased
increment (see growth) and the following reduction do not count.
growth (float, optional) – The factor \(g \ge 1\) by which the increment is increased after a
converged increment (default is 2.0), limited by the remaining part of the
substep. With growth=1.0, the increment is kept constant.
exceptions (type or tuple of type, optional) – The errors of the Newton-Raphson method which lead to a cutback (default is
(NewtonConvergenceError,ArithmeticError,numpy.linalg.LinAlgError,RuntimeError)). Errors of other types are raised without a cutback, e.g. a
ValueError of mismatching shapes of arrays. The default types include
the NewtonConvergenceError of newtonraphson()
if the maximum number of iterations is reached or if the solution contains NaN
values and of a failed LinesearchPlugin, floating-point errors
(e.g. of numpy.errstate(invalid="raise")), errors of numpy.linalg,
e.g. of a singular matrix, as well as runtime errors of the sparse solvers,
e.g. the RuntimeError of SuperLUSolver
(default) and scipy.sparse.linalg.spsolve() if the factorization of a
nearly singular matrix fails. The subclasses NotImplementedError and
RecursionError of RuntimeError are programming errors, which
are raised without a cutback (unless they are given explicitly). An exactly
singular matrix does not raise an error. Instead,
SuperLUSolver and scipy.sparse.linalg.spsolve()
return NaN values (which leads to a NewtonConvergenceError)
and pypardiso.spsolve() returns a perturbed solution.
The load factors of the converged increments for each substep, e.g.
[1.0] for a substep without a cutback or [0.5,1.0] for a substep
which was subdivided into two increments. The list of a substep which was not
recovered ends with a load factor lower than one (or is empty).
The number of cutbacks for each substep, i.e. the number of reductions of the
increment after failed attempts. This includes the reductions after failed
attempts with increased increments. Hence, it may be larger than
max_cutbacks.
The plugin requires a Job (or the hooks of
generate_states()). Before each substep, a checkpoint of the
unknowns and of the (history-dependent) state of the items is created, see
checkpoint(). If the Newton-Raphson method of a substep raises one of the
given exceptions, the checkpoint is restored and the substep is subdivided into
increments with load factors \(t \in (0, 1]\), starting with the reduced
increment \(\Delta t = f\). The values of the ramp \(\boldsymbol{v}(t)\)
of an increment are linearly interpolated between the values of the previous
substep \(\boldsymbol{v}_0\) and the values of the current substep
\(\boldsymbol{v}_1\), see Eq. (26).
After a converged increment, the unknowns are linked to its result by
context.solve(), a new checkpoint is created, the load factor is
increased \(t \leftarrow t + \Delta t\) and the next increment is
\(\Delta t \leftarrow \min(g\ \Delta t, 1 - t)\). After a failed attempt, the
checkpoint of the last converged increment is restored and the increment is reduced,
\(\Delta t \leftarrow f\ \Delta t\). If the reduced increment would be smaller
than the smallest increment \(\Delta t_{\min} = f^{\text{max\_cutbacks}}\), a
NewtonConvergenceError is raised, which is caused by the error of
the last attempt.
Then, the unknowns and the items are restored to the last converged increment. The
last increment of a substep always uses the values of the ramp of the substep
(without interpolation).
The limit applies to the size of the increment, not to the number of failed
attempts. An increased increment which fails is reduced again without counting
towards max_cutbacks, as long as the reduced increment is not smaller than
\(\Delta t_{\min}\). Each converged increment (except the last one) is at least
\(\Delta t_{\min}\), hence the subdivision of a substep terminates. With
\(g > 1\), an increased increment may fail repeatedly, which costs one
additional (failed) evaluation of the Newton-Raphson method per attempt. Use
growth=1.0 if failed attempts are expensive.
The increments are internal to the substep, i.e. only the result of the last
increment is handed back to the Step and the hooks
after_substep of other plugins (e.g. writers of result files) are only called
once per substep. However, the hooks of the Newton-Raphson method are called for
each increment.
State of the items: A checkpoint consists of the values of the unknowns and
of the checkpoints of all items (and ramped items) which provide the methods
checkpoint() and restore(checkpoint), e.g.
SolidBody.checkpoint() and
SolidBodyNearlyIncompressible.checkpoint(). This includes the internal
fields (pressure and volume ratio) of a
SolidBodyNearlyIncompressible, which are updated in each
evaluation of the Newton-Raphson method, as well as the time of a
TimeStep, the state of the frictional contact of a
ContactRigidPlane and the state variables of the rotation of a
MultiPointConstraint. The state variables of material models are
only updated after a converged increment. Hence, the increments of a subdivided
substep are also increments of the loading path of history-dependent materials,
e.g. for viscoelasticity or plasticity. A custom item with a state which is
modified during the Newton iterations has to provide the methods checkpoint()
and restore(checkpoint).
Note
The time increment of a rate-dependent material model, e.g. the parameter
dtime of finite_strain_viscoelastic(), is not
part of the ramp. Hence, it is not scaled by the cutback, i.e. each increment
of a subdivided substep uses the full time increment of the material. A time
which is part of the ramp, like the time of a
TimeStep, is interpolated.
Values of the previous substep: The values of the ramp of the previous
substep are taken from the substeps which were already evaluated with this
plugin. Hence, the first substep of a job can only be subdivided if the ramped
items (or boundaries) were already updated by a previous job with this plugin.
This is usually not required, because the first value of a ramp typically equals
the initial state, e.g. fem.math.linsteps([0,1],num=5). A step without a
ramp can not be subdivided.
Note
A cutback may be combined with a LinesearchPlugin,
Job(steps,plugins=[LinesearchPlugin(),CutbackPlugin()]). Then, a failed
line search leads to a cutback.
Examples
A coarse cube is compressed by 70% in a single substep. The first Newton
increment leads to inadmissible deformation gradients and to NaN values in the
stresses.
Restore a checkpoint of the unknowns and of the items of a substep.
Parameters:
context (felupe.Context) – The context of a substep with the unknowns x0, the items and the step.
checkpoint (dict) – A dict with the copied values of the unknowns "x0" and a list of the
items (and ramped items) with their checkpoints "items".
Notes
The checkpoints of the items are restored first. Then, the values of the
unknowns are restored in-place and the fields of the items are linked to the
unknowns.
A compact live dashboard of a Job in a Jupyter widget.
The dashboard is shown in the output of the cell which evaluates the job, e.g. in
JupyterLab, Jupyter Notebook or the interactive window of VS Code. It shows the
deformed model of the latest converged substep, coloured by the norm of the
values of the first field (displacements, temperature, …), the progress of the job
including cutbacks, the properties of the model, the convergence of the
Newton-Raphson method and performance statistics.
Parameters:
title (str or None, optional) – The title of the dashboard (default is None).
interval (float, optional) – The minimum time in seconds between two updates of the solver figures during
a substep (default is 0.1). The end of each substep is always shown.
filename (str or None, optional) – The filename of a live HTML file of the dashboard, e.g. "job.html" (default
is None). The file is updated during the job and the page in the web browser
updates itself, see the notes. Without a Jupyter frontend, the page is opened
in the web browser.
file_interval (float, optional) – The minimum time in seconds between two updates of the live HTML file
(default is 2.0). The file is only updated if the state of the job has changed.
The dashboard requires the optional dependency anywidget, which is installed by pipinstallfelupe[dashboard].
The widget is created and displayed in the hook before_job. Each evaluation of
a job creates a new widget, i.e. the outputs of previous cells keep the state of
their job. The state of the widget is updated while the cell is running, because
the messages from the kernel to the frontend are sent immediately. All controls
of the dashboard (the scale of the deformation, the mesh lines, the view) are
evaluated in the frontend, i.e. they also work while the job is running.
The model is drawn from the regions of the items, e.g. of several solid bodies on
the meshes of a MeshContainer, by the triangulated outer surface
of triangulate_surface(). There is no list of item types:
every item with a field container item.field contributes the mesh of the
region of its first field, except
boundary regions (e.g. of a SolidBodyPressure or of a heat
transfer), whose meshes hold the cells of the faces,
meshes without a supported cell type (e.g. the vertex mesh of the field of a
MeshContainer in a PointLoad),
meshes (or identical cells) which are already drawn (e.g. of a
SolidBodyForce on the region of a solid body) and
meshes with other points than the first mesh.
Items without a field, e.g. a TimeStep, are skipped.
Faces at the interface of two bodies with merged points are not drawn. The values
are taken from the first field of the unknowns x0 of the job, i.e.
job.evaluate(x0=field) shows the field of all bodies.
Without a Jupyter frontend, e.g. in a script which is run in the terminal or in the
IPython terminal (which has no kernel and can not display widgets), a warning is
raised once (unless a filename is given) and the dashboard is not displayed.
Hence, the same script with #%%-cells may be run in the interactive window of
VS Code (with the dashboard) and in the terminal (without the dashboard). The
state of the job is collected anyway (with a small overhead, mainly for the surface
of the mesh at the start of the job), i.e. a static snapshot() of the
dashboard is available after the job. A frontend without support for widgets, e.g.
a QtConsole, shows a short text instead.
With a filename, e.g. "job.html", a live HTML file of the dashboard is
written, also without a Jupyter frontend (and without anywidget). Next to the page,
three scripts are written: job.geometry.js (once for each job),
job.state.js (at most every file_interval seconds, if the state of the job
has changed) and job.version.js. Each file is replaced atomically. The page in
the web browser polls the version and updates itself without a reload, i.e. the
view (rotation, zoom, scale) is kept. A page of a local file can not fetch other
files, but it can load scripts, i.e. no server is required. Without a Jupyter
frontend, the page is opened in the web browser by the first job of the plugin.
The page follows the next jobs of the plugin and it shows the final state of the
last job.
A static snapshot() of the dashboard after the job is a self-contained HTML
page (without the scripts of the live HTML file). It is shown in the output of a
cell of a notebook and in the examples of the documentation, which are executed by
sphinx-gallery without a Jupyter kernel (the snapshot is the last expression of a
code block and "capture_repr" includes "_repr_html_"), or it is saved as a
HTML file.
The model with banded contours of the norm of the first field of the
unknowns for the latest converged substep, deformed by this field if
it has mesh.dim components. Only the first field is drawn, the
other fields may be defined on other meshes. The model is drawn by
the WebGL viewer of the plotting backend "webgl". The faces of
quadratic and Lagrange cells are triangulated by all their points
(e.g. by the mid-edge points), line cells are drawn as lines. The
default view of a 3d-model is the default view of the plots of
FElupe, e.g. of SolidBody.plot(), with
the z-axis upwards (the button iso), a 2d-model is viewed in the
xy-plane. The view is kept for the next substeps.
Load path
One cell for each substep, converged, converged with cutbacks (with
marks at the load factors of its increments) or failed.
Solver
Residual norm, tolerance, attempt and iteration, the residual norms of
the attempts of the current substep, iterations, cutbacks and failed
attempts.
Model
The points, cells and the cell type of the mesh, the finite element and
the quadrature of the region and the degrees of freedom (total and
active).
Performance
Wall time of the assembly, the linear solve, the residual and update
and the rest, time per iteration and peak memory of the process.
The times are measured between the hooks of newtonraphson(): the
assembly between before_iteration and before_linear_solve, the linear
solve between before_linear_solve and after_linear_solve and the
residual and update (including a line search) between after_linear_solve and
after_iteration.
The plugin is not callable on purpose. List it before a
CutbackPlugin to show the error messages of failed attempts. The
attempts of a cutback are observed in any order, because they trigger the hooks of
newtonraphson() again.
This method is called after the evaluation of a job, also if the evaluation
failed (e.g. to close result files). Then, the error is available as
state.error and it is raised after all plugins are called.
This method is called after the linear solver inside a Newton-Raphson
iteration. A plugin may modify the update of the unknowns in this hook, see
IterationState.
context (felupe.Context) – The context object with the job, the step and the result of the substep
context.substep.
state (felupe.SubstepState) – The state of the substep (the same object as in the hooks
before_substep and after_failed_substep), which is also a
JobState with the step number, the substep number and the
time.
Return a static snapshot of the dashboard of the last job.
The snapshot is a self-contained HTML page with the state of the dashboard at
the time of the snapshot, e.g. the final state after the job. It is shown in
the output of a cell of a notebook and in an example of the documentation
(built by sphinx-gallery), if it is the last expression of the cell. The model
may be rotated, zoomed and scaled, but the snapshot is not updated.
Returns:
The snapshot with the HTML page snapshot.html, a method to save the
page as a HTML file snapshot.save("job.html") and a rich representation
for notebooks.
A backtracking line search for the Newton-Raphson method.
Parameters:
admissible (bool, optional) – A flag to reject trials with non-positive determinants of the deformation
gradients, see Eq. (28) (default is True).
residual (bool, optional) – A flag to reject trials without a sufficient decrease of the norm of the
residuals, see Eq. (29) (default is True).
c (float, optional) – The parameter of the sufficient-decrease condition of the residuals (default is
1e-4).
max_halvings (int, optional) – The maximum number of halvings of the step length (default is 10). The smallest
step length is \(\alpha = 2^{-\text{max\_halvings}}\).
criteria (list of callable or None, optional) – A list of additional acceptance criteria, called after the built-in criteria.
A criterion has the function signature criterion(trial)->bool, where
trial is a LinesearchTrial. Default is None.
The line search is performed in the after_linear_solve hook of
newtonraphson(). Starting with a step length of \(\alpha = 1\),
the Newton increment \(d\boldsymbol{x}\) is scaled and the trial unknowns are
evaluated, see Eq. (27).
The step length is halved, \(\alpha \leftarrow \alpha / 2\), until all
acceptance criteria are fulfilled. If the maximum number of halvings is exceeded, a
NewtonConvergenceError is raised. The acceptance criteria are
evaluated in the order of the list criteria and the evaluation stops at
the first rejection.
Admissibility (admissible=True): The determinants of the deformation
gradients at all quadrature points of all cells of all items must be positive, see
Eq. (28).
The deformation gradient is evaluated by the first extracted field of the field
container of each item. Hence, mixed-field formulations as well as plane-strain and
axisymmetric fields are supported. Items without a deformation gradient are
skipped. This criterion is evaluated first because it does not require an assembly
of the residuals.
Sufficient decrease of the residuals (residual=True): The norm of the
residuals of the active degrees of freedom \(\boldsymbol{r}_1\) must decrease
sufficiently, see Eq. (29). This is an Armijo-type condition
for the merit function \(\frac{1}{2} ||\boldsymbol{r}_1||^2\).
If the Newton increment changes the prescribed degrees of freedom
\(d\boldsymbol{x}_0\) (e.g. in the first iteration of a new substep), the
residuals of the last iteration are not a valid reference because they belong to
the old boundary conditions. Hence, the remaining part of the increment of the
prescribed degrees of freedom is added by its linearization with the (partitioned)
Jacobian \(\boldsymbol{K}_{10}\) of the last iteration, see Eq.
(30).
The Newton increment is a descent direction of this merit function. Without
prescribed increments, Eq. (30) simplifies to
\(\boldsymbol{r}_1(\alpha) = \boldsymbol{f}_1(\boldsymbol{x}(\alpha))\).
Trials with non-finite residuals are always rejected and a trial which already
satisfies the convergence criterion of the Newton-Raphson method is always
accepted by this criterion.
The accepted trial is handed back to the Newton-Raphson method, see
IterationState, and its residuals are re-used, i.e. no
additional assembly is required for the accepted step. The accepted trial is always
the last evaluated trial. Hence, the (temporary) state variables of the items belong
to the accepted trial. A given update function of the Newton-Raphson method is
called with the scaled increment, update(x_n,alpha*dx), and must return a
new object. The scaled increment is passed to check and callback.
Note
The line search is not optimal for a
SolidBodyNearlyIncompressible. Its internal fields, the
pressure and the volume ratio, are statically condensed and updated by the full
Newton increment in each evaluation. They are neither scaled by the step length
nor included in the assembled residuals (they cancel out), but they are included
in the tangent stiffness matrix. Hence, the Newton increment of this three-field
formulation does not match the residual criterion of the line search, which may
fail for large load increments. The admissibility criterion is not affected. For
a line search with (nearly) incompressible materials, a mixed-field formulation
with the pressure and the volume ratio as fields of the field container is
recommended. Then, all fields are scaled by the step length and all residuals
are checked.
A coarse cube is compressed by 70% in a single step. Without a line search, the
first Newton increment leads to inadmissible deformation gradients and to NaN
values in the stresses.
Return True if the determinants of the deformation gradients of all items,
evaluated for the trial unknowns, are positive, see Eq.
(28). Does not assemble the residuals.
A trial of a line search, passed to the acceptance criteria of a
LinesearchPlugin. All parameters are available as attributes.
Parameters:
context (felupe.tools.Context) – The context of the Newton-Raphson method with the items, the degrees of freedom
and the callables fun, update and check.
state (felupe.tools.IterationState) – The state of the current Newton iteration with the unknowns state.x, the
values of the objective function state.fun of the last accepted iteration,
the Jacobian state.jac and the full Newton increment state.dx.
x (felupe.FieldContainer or ndarray) – The trial unknowns, x=update(state.x,alpha*state.dx).
dx (ndarray) – The (scaled) increment of the trial, dx=alpha*state.dx.
halving (int) – The number of halvings of the step length.
df0 (ndarray or None, optional) – The linearized change of the objective function due to the increment of the
prescribed degrees of freedom, \(\boldsymbol{K}\ d\boldsymbol{x}_0\), or
None if the prescribed degrees of freedom are not changed (default is None).
Notes
The objective function of the trial is only evaluated on demand, i.e. on the first
access of the attribute fun. The result is cached. Hence, criteria which do
not need the residuals (like the admissibility of the deformation) should not access
fun and should be placed first in the list of criteria.
A job plugin to output the progress of a job evaluation in the terminal.
Parameters:
verbose (bool or int or None, optional) – Verbosity level to control how messages are printed during evaluation. If
1 or True and tqdm is installed, a progress bar is shown. If tqdm is
missing or verbose is 2, more detailed text-based messages are printed.
Default is None. If None, verbosity is set to True. If None and the
environmental variable FELUPE_VERBOSE is set and its value is not true,
then logging is turned off.
tqdm (str, optional) – If verbose is True, choose a backend for tqdm (“tqdm”, "auto" or
"notebook". Default is "tqdm".
Notes
Requires tqdm for an interactive progress bar if verbose=True.
This method is called after the evaluation of a job, also if the evaluation
failed (e.g. to close result files). Then, the error is available as
state.error and it is raised after all plugins are called.
This method is called after the linear solver inside a Newton-Raphson
iteration. A plugin may modify the update of the unknowns in this hook, see
IterationState.
context (felupe.Context) – The context object with the job, the step and the result of the substep
context.substep.
state (felupe.SubstepState) – The state of the substep (the same object as in the hooks
before_substep and after_failed_substep), which is also a
JobState with the step number, the substep number and the
time.
This method is called after the evaluation of a job, also if the evaluation
failed (e.g. to close result files). Then, the error is available as
state.error and it is raised after all plugins are called.
context (felupe.Context) – The context object with the job, the step and the result of the substep
context.substep.
state (felupe.SubstepState) – The state of the substep (the same object as in the hooks
before_substep and after_failed_substep), which is also a
JobState with the step number, the substep number and the
time.
All methods (hooks) are optional and will be called at the appropriate time during
the simulation. The context and state objects are passed to each method, allowing
a plugin to access and / or modify a simulation as needed.
The Context object holds information about the current job,
step or substep. In the hooks of the Newton-Raphson method, it holds the items, the
degrees of freedom and the callables of newtonraphson(). In the hooks
of a substep, it holds the items, the unknowns and a callable to solve the substep
for given values of the ramp, see generate_states(). state
depends on the method and can be used to access the current state, i.e.
JobState, SubstepState (in the hooks of a
substep, including after_substep) or IterationState.
The hooks are called in the following order during the evaluation of a
Job. The hook after_failed_substep is only called if the
Newton-Raphson method of a substep raised an error.
A plugin may also be a callable plugin(context,state), e.g. a function, which
is only called after each completed substep (in the hook after_substep). It
replaces the callback of a Job (removed in 12.0.0), see the
notes of Job.
This method is called after the evaluation of a job, also if the evaluation
failed (e.g. to close result files). Then, the error is available as
state.error and it is raised after all plugins are called.
This method is called after the linear solver inside a Newton-Raphson
iteration. A plugin may modify the update of the unknowns in this hook, see
IterationState.
context (felupe.Context) – The context object with the job, the step and the result of the substep
context.substep.
state (felupe.SubstepState) – The state of the substep (the same object as in the hooks
before_substep and after_failed_substep), which is also a
JobState with the step number, the substep number and the
time.
A class to dispatch events to plugins during evaluation.
Parameters:
plugins (list or None, optional) – The list of plugins. A callable plugin, e.g. a function, is called in the hook
after_substep. Otherwise, the methods of a plugin with the names of the
hooks are called.
A class to keep track of the context of a Job during evaluation.
Parameters:
job (felupe.Job or None, optional) – The job object.
step (felupe.Step or None, optional) – The step object.
substep (felupe.tools.NewtonResult or None, optional) – The result of the completed substep. The field container of the substep is
available as substep.x.
items (list or None, optional) – The list of items of the Newton-Raphson method or of a step (default is None).
Only available in the hooks of newtonraphson() and in the hooks
of a substep, see generate_states().
dof1 (ndarray or None, optional) – The active degrees of freedom of the Newton-Raphson method (default is None).
Only available in the hooks of newtonraphson().
dof0 (ndarray or None, optional) – The prescribed degrees of freedom of the Newton-Raphson method (default is
None). Only available in the hooks of newtonraphson().
ext0 (ndarray or None, optional) – The external values of the prescribed degrees of freedom of the Newton-Raphson
method (default is None). Only available in the hooks of
newtonraphson().
fun (callable or None, optional) – A callable f=fun(x) which evaluates the objective function (the
residuals) for given unknowns x. For a list of items, the vectors of all
items are assembled and the fields of the items are linked to x.
Additional arguments of the Newton-Raphson method are already bound. Default is
None. Only available in the hooks of newtonraphson().
update (callable or None, optional) – The callable x=update(x,dx) of the Newton-Raphson method which updates
the unknowns (default is None). Only available in the hooks of
newtonraphson().
check (callable or None, optional) – A callable xnorm,fnorm,success=check(dx,x,f) which checks the
convergence of the Newton-Raphson method for given unknowns x with the
values of the objective function f (default is None). The state variables
of the items are not updated, this is done by newtonraphson()
after a converged iteration. Only available in the hooks of
newtonraphson().
x0 (felupe.FieldContainer or None, optional) – The field container with the unknowns of a step, which is the starting point
of the Newton-Raphson method of a substep (default is None). Only available in
the hooks of a substep, see generate_states().
solve (callable or None, optional) – A callable res=solve(values) which updates the ramped items (and
boundaries) of a step with a dict of values, updates the load case and
evaluates the Newton-Raphson method, starting from the unknowns x0. It
returns a NewtonResult and errors of the Newton-Raphson
method are raised. On success, the unknowns x0 are linked to the result,
i.e. the result is the starting point of the next evaluation. Default is None.
Only available in the hooks of a substep, see
generate_states().
A class to keep track of the state of a Job during evaluation.
Parameters:
stepnumber (int or None, optional) – The (zero-based) index of the step (default is None).
substepnumber (int or None, optional) – The (zero-based) index of the substep within the step (default is None).
time (int or None, optional) – The (zero-based) index of the substep within the job, e.g. the time of the
XDMF result file (default is None).
error (Exception or None, optional) – The error which was raised during evaluation (default is None). In the hook
after_job, this is the error which stopped the evaluation of the job.
Notes
The hook after_job is also triggered if the evaluation of the job fails, e.g.
to close result files. Then, the error is available as state.error and it is
raised after all plugins are called.
A class to keep track of the state of a substep during evaluation.
Parameters:
stepnumber (int or None, optional) – The (zero-based) index of the step within the job (default is None).
substepnumber (int or None, optional) – The (zero-based) index of the substep within the step (default is None).
time (int or None, optional) – The (zero-based) index of the substep within the job, e.g. the time of the
XDMF result file (default is None).
error (Exception or None, optional) – The error which was raised by the Newton-Raphson method of the substep
(default is None).
values (dict or None, optional) – The values of the ramp of the substep, i.e. a dict with the ramped
Boundary conditions or items as keys (default is None).
result (felupe.tools.NewtonResult or None, optional) – The result of the Newton-Raphson method of the substep (default is None).
load_factors (list of float or None, optional) – The load factors \(t \in (0, 1]\) of the converged increments of a
subdivided substep, e.g. of a CutbackPlugin (default is None).
None means that the substep is not subdivided.
Notes
One state is created for each substep by generate_states() and
its attributes are updated in-place. The same state is passed to the hooks
before_substep, after_failed_substep and after_substep. As a
JobState, it holds the step number, the substep number and the
time.
Attributes of the state in the hooks of a substep.#
Hook
result
error
before_substep
None
None
after_failed_substep
None
the raised error
after_substep
the result
None or the error of a recovered substep
If the Newton-Raphson method of a substep raises an error (which is an instance of
Exception), the hook after_failed_substep is triggered. A plugin may
recover the substep in this hook, e.g. by the callable solve of the
Context. Then, the plugin has to set the result of the
substep state.result, i.e. the NewtonResult for the
values of the ramp of the substep. The unknowns x0 must be linked to the result,
which is done by solve. Otherwise, if the result is still None after all
plugins are called, the error state.error is raised. A plugin may replace the
error, e.g. by a more descriptive error.
A class to keep track of the state of an iteration during evaluation.
Parameters:
iteration (int or None, optional) – The (zero-based) index of the current iteration (default is None).
fnorm (float or None, optional) – The norm of the objective function of the current iteration (default is None).
xnorm (float or None, optional) – The norm of the increment of the current iteration (default is None).
success (bool or None, optional) – A flag if the current iteration has converged (default is None).
tol (float or None, optional) – The tolerance of the Newton-Raphson method (default is None). If no tolerance
is given to newtonraphson(), the default tolerance depends on the
data types of the linear equation system and of the unknowns. It is set after
the assembly of the Jacobian in the first iteration, i.e. it is None in the
hooks before_newton and before_iteration of the first iteration.
error (bool or None, optional) – A flag if an error occured in the current iteration (default is None).
x (felupe.FieldContainer or ndarray or None, optional) – The unknowns (default is None). Before the update of an iteration, these are
the unknowns of the last accepted iteration \(x_n\). After the update, these
are the updated unknowns \(x\).
dx (ndarray or None, optional) – The increment of the unknowns of the current iteration (default is None).
fun (ndarray or None, optional) – The values of the objective function (the residuals), evaluated at the unknowns
x (default is None).
jac (sparse matrix or ndarray or None, optional) – The Jacobian of the objective function of the current iteration, evaluated at
the unknowns of the last accepted iteration \(x_n\) (default is None).
alpha (float or None, optional) – The step length which scales the Newton increment of the current iteration,
e.g. of a line search (default is None). None means that the full Newton
increment is applied.
updated (bool, optional) – A flag if the unknowns (and the values of the objective function) are already
updated in the current iteration (default is False).
Notes
One state is created by newtonraphson() and its attributes are
updated in-place during the iterations. Hence, a plugin may keep a reference to the
state and attributes set by a plugin persist until they are updated by the
Newton-Raphson method. The attributes alpha and updated are reset in the
beginning of each iteration.
Attributes of the state in the hooks of an iteration.#
Hook
x
fun
jac
dx
updated
before_iteration
\(x_n\)
\(f(x_n)\)
previous
previous
False
before_linear_solve
\(x_n\)
\(f(x_n)\)
\(K(x_n)\)
previous
False
after_linear_solve
\(x_n\)
\(f(x_n)\)
\(K(x_n)\)
\(dx\)
False
after_iteration
\(x\)
\(f(x)\)
\(K(x_n)\)
\(dx\)
True
A plugin may modify the update of the unknowns in the after_linear_solve hook.
Either the increment dx is replaced, e.g. by a scaled increment, which is then
used by the Newton-Raphson method to update the unknowns x=update(x_n,dx) and
to evaluate the objective function f(x). Or the plugin performs the update on
its own, e.g. by the callables update and fun of the
Context. Then, the plugin has to set the updated unknowns
x, the values of the objective function fun evaluated at the updated
unknowns, the applied increment dx and the flag updated=True. The
Newton-Raphson method re-uses the values of the objective function and no
additional assembly is performed. If the objective function is evaluated for more
than one trial, the accepted trial must be evaluated last, because the (temporary)
state variables of the items belong to the last evaluation.
Note
The evaluation of the objective function for a list of items links the fields
of the items to the evaluated unknowns. If the unknowns of the last accepted
iteration \(x_n\) are the field container of an item (e.g. in the first
iteration of a job), the value arrays of \(x_n\) are replaced by the value
arrays of the evaluated trial. A plugin which evaluates more than one trial
must restore the value arrays of \(x_n\) before the next trial is created.
If a plugin does not perform the update, the value arrays of \(x_n\) are
restored by the Newton-Raphson method.
skip (3-tuple of bool, optional) – A tuple with boolean values for each axis to skip. If True, the respective axis
is not connected. Not supported with a rotation-point. Default is
(False, False, False).
multiplier (float, optional) – A multiplier to penalize the relative displacements between the center-point and
the points. Default is 1e3.
rotationpoint (int or None, optional) – The index of an additional point, whose degrees of freedom are the rotations
(in rad) of the points about the center-point, see the notes below. Its
coordinates are not used, i.e. it may be located at the center-point. If None,
the rotations are locked. Default is None.
The results of the last evaluation. With a rotation-point, these include the
rotation matrix results.rotation with shape (3, 3), the moment
results.moment with shape (3,) and the (converged) state variables
results.statevars with the accumulated rotation vector and the rotation
matrix of the last converged substep, shape (12,).
A MultiPointConstraint is supported as an item in a
Step. It provides the assemble-methods
MultiPointConstraint.assemble.vector()
and MultiPointConstraint.assemble.matrix().
The points \(\boldsymbol{x}_i\) are connected to the center-point
\(\boldsymbol{x}_c\) by the penalty potential in Eq. (31), with
the undeformed arms \(\boldsymbol{A}_i = \boldsymbol{X}_i - \boldsymbol{X}_c\)
and the rotation matrix \(\boldsymbol{R}\). Without a rotation-point, the
rotation matrix is the identity, i.e. the points are moved by the displacements of
the center-point and the rotations are locked.
With a rotation-point, the rotation matrix is parametrized incrementally by the
exponential map [1]_, see Eq. (32), where the rotation-vector
\(\boldsymbol{\psi}\) are the values of the displacement field at the
rotation-point. The rotation-vector
\(\boldsymbol{\psi}_n\) and the rotation matrix \(\boldsymbol{R}_n\) of the
last converged substep are state variables, which are updated after each converged
substep.
Hence, the values of the rotation-point accumulate the (spatial) increments of the
rotation. For a rotation about a fixed axis \(\boldsymbol{a}\), these are the
rotation-vector \(\boldsymbol{\psi} = \varphi\ \boldsymbol{a}\), also for
angles beyond \(2\pi\). For rotations about varying axes, the values depend on
the path of the rotation and the rotation matrix is available as
results.rotation. The parametrization is singular only for increments
\(\| \Delta \boldsymbol{\psi} \| = 2\pi\), see [2]_ for a discussion of
vector-like parametrizations of finite rotations. However, the increments of the
rotation must be smaller than \(\pi\) (and should be much smaller), otherwise a
revolution of the rotation-point may be skipped by the connected points.
The moment of the forces of the constraint, which act on the points, w.r.t. the
deformed center-point is given in Eq. (33) and it is stored in
results.moment. The residuals of the rotation-point are the derivatives of the
potential w.r.t. \(\boldsymbol{\psi}\), i.e. the moment transformed by the
tangent operator \(\boldsymbol{J}\) of the exponential map. These are equal to
the moment for \(\Delta \boldsymbol{\psi} = \boldsymbol{0}\) and differ by a
term of the order of the increment \(\| \Delta \boldsymbol{\psi} \|\)
otherwise. For a rotation about a fixed axis, the axial components are equal.
For 2d-meshes, the first component of the rotation-point is the angle of the
rotation about the \(z\)-axis and the second component is locked by the
penalty multiplier. If the rotation-point is located at the center-point, both
points must be selected by a mask (or by their indices), e.g. for a
Boundary, because a selection by the coordinates would include both
points.
Note
A PointLoad at the rotation-point is work-conjugate to the
rotation-vector \(\boldsymbol{\psi}\). Hence, the moment
\(\boldsymbol{m}\) differs from the applied load by a term of the order of
the increment of the rotation, except for the axial component of a rotation
about a fixed axis.
Examples
This example shows how to use a MultiPointConstraint. An
additional center-point is added to a mesh.
A MultiPointConstraint defines the multi-point constraint which
connects the displacement degrees of freedom of the center-point with the dofs of
points located at \(x=1\).
The mesh is fixed on the left end face and a ramped PointLoad is
applied on the center-point of the MultiPointConstraint. All items
are added to a Step and a Job is evaluated.
With a rotation-point, the points are also rotated about the center-point. A
center-point and a rotation-point are added at the center of the right end face of
a beam. Both points are excluded from the connected points of the end face.
The left end face and the center-point are fixed. The end face is twisted by a full
revolution about the \(x\)-axis, i.e. the first component of the rotation-point
is ramped, while the rotations about the other axes are free. The center-point and
the rotation-point are located at the same coordinates, hence they are selected by
masks.
After a full revolution, the rotation matrix is the identity, while the accumulated
rotation of the rotation-point is \(2\pi\). The moment w.r.t. the center-point
is available in the results.
skip (3-tuple of bool, optional) – A tuple with boolean values for each axis to skip. If True, the respective axis
is not connected. Default is (False, False, False).
multiplier (float, optional) – A multiplier to penalize the relative displacements between the center-point and
the points in contact. Default is 1e6.
Notes
A MultiPointContact is supported as an item in a
Step. It provides the assemble-methods
MultiPointContact.assemble.vector()
and MultiPointContact.assemble.matrix().
Examples
This example shows how to use a MultiPointContact. An additional
center-point is added to a mesh.
A MultiPointContact defines the multi-point contact which
connects the displacement degrees of freedom of the center-point with the dofs of
points located at \(x=1\) if they are in contact. Only the \(x\)-component
is considered in this example.
The mesh is fixed on the left end face and a ramped Boundary is
applied on the center-point of the MultiPointContact. All items
are added to a Step and a Job is evaluated.
A constraint for the displacements of points in a (fixed) Cartesian coordinate
system.
Parameters:
field (FieldContainer) – A field container with the displacement field as first field.
points ((n,) ndarray of int or bool) – An array with indices (or a mask) of the points to be constrained.
rotation (array_like or None, optional) – The rotation matrix \(\boldsymbol{Q} = \boldsymbol{e}_i \otimes
\boldsymbol{E}_i\), which maps the global base vectors \(\boldsymbol{E}_i\)
to the base vectors \(\boldsymbol{e}_i = \boldsymbol{Q}
\boldsymbol{E}_i\) of the coordinate system, with shape (3, 3) or with shape
(2, 2) for 2d-meshes, see rotation_matrix(). The base vectors
are the columns of the matrix, i.e. given base vectors are stacked by
np.column_stack([e1,e2,e3]). The columns are normalized, they must be
orthogonal and right-handed (\(\det(\boldsymbol{Q}) = 1\)). If None, the
global base vectors are used. Default is None.
displacement (array_like, optional) – The prescribed displacements \((u_1, u_2, u_3)\) in the directions of the
base vectors for all points or per point with shape (n, 3). May be ramped in a
Step, see update(). Default is (0, 0, 0).
skip (tuple of bool, optional) – Flags to skip the directions of the base vectors. Default is
(False, False, False).
multiplier (float, optional) – The penalty stiffness \(k\) per point and direction. Default is 1e3.
A CartesianConstraint is supported as an item in a
Step. The coordinate system is fixed in space, i.e. its base
vectors \(\boldsymbol{e}_i\) do not rotate with the deformation. The
constraint is enforced by a penalty method with the potential in
Eq. (34), summed up for all points and all directions which
are not skipped.
The gaps are linear in the displacements \(\boldsymbol{u}\) of a point, hence,
the residual vector and the (constant) stiffness matrix of a point are given in
Eq. (35).
If all directions are constrained, the stiffness matrix is \(k \boldsymbol{1}\)
and the coordinate system only transforms the prescribed displacements. Then, a
Boundary with the values
\(\boldsymbol{u} = \sum_i u_i\, \boldsymbol{e}_i\) is exact and should be
preferred. A Cartesian constraint is useful for skipped directions, e.g. for
supports on inclined planes, where the points slide in a plane (or along a line)
which is not aligned to the global axes.
Examples
A cube is rotated by 30° around the \(y\)-axis. The base vectors of the
coordinate system are the global base vectors rotated like the mesh, i.e. the
columns of the rotation matrix.
The bottom face rests on an inclined plane, i.e. it is constrained in the normal
direction of the plane only and the points slide on the plane. The top face is
moved down in global \(z\)-direction by a plate, which is fixed in \(x\)-
and \(y\)-direction.
displacement (array_like) – The prescribed displacements in the three directions of the coordinate
system, either one vector for all points or one vector per point with
shape (n, 3). For 2d-meshes, also vectors with two components are
supported.
Notes
This method is called by a Step for each substep if the
constraint is ramped, e.g. by ramp={constraint:table}.
A constraint for the displacements of points in cylindrical coordinates.
Parameters:
field (FieldContainer) – A field container with the displacement field as first field.
points ((n,) ndarray of int or bool) – An array with indices (or a mask) of the points to be constrained.
center (array_like, optional) – A point on the axis. Default is (0, 0, 0).
axis (array_like, optional) – The direction of the axis, perpendicular to the plane for 2d-meshes. Default is
(0, 0, 1).
displacement (array_like, optional) – The prescribed displacements \((u_r, u_\theta, u_z)\) for all points or per
point with shape (n, 3), where \(u_\theta\) is the arc length on the
undeformed radius. May be ramped in a Step, see
update(). Default is (0, 0, 0).
skip (tuple of bool, optional) – Flags to skip the radial, the circumferential and the axial direction. Default
is (False, False, False).
multiplier (float, optional) – The penalty stiffness \(k\) per point and direction. Default is 1e3.
A CylindricalConstraint is supported as an item in a
Step. For each point, the undeformed radius, the axial coordinate
and the cylindrical base vectors are evaluated w.r.t. the center-point
\(\boldsymbol{X}_0\) and the normalized axis \(\boldsymbol{a}\), see
Eq. (36).
The gaps are evaluated in the deformed configuration
\(\boldsymbol{x} = \boldsymbol{X} + \boldsymbol{u}\) with the base vectors
rotated by the angle \(\varphi = u_\theta / R\), see Eq. (38).
If the circumferential direction is skipped, the radial gap is the exact distance to
the axis, i.e. the points slide on the cylinder like in a rigid sleeve.
The residual vector and the stiffness matrix of a point are given in
Eq. (39). The only non-zero second derivative is the one
of the exact radial gap with the deformed radius \(\rho\) and the deformed
radial direction \(\boldsymbol{n}\).
The outer surface is placed in a rigid sleeve, i.e. it is constrained in radial
direction only. The end face at \(x=0\) is fixed and the end face at
\(x=3\) is twisted by 90°, where the circumferential displacement is the arc
length on the undeformed radius of each point.
displacement (array_like) – The prescribed displacements in the three directions of the coordinate
system, either one vector for all points or one vector per point with
shape (n, 3). For 2d-meshes, also vectors with two components are
supported.
Notes
This method is called by a Step for each substep if the
constraint is ramped, e.g. by ramp={constraint:table}.
multiplier (float, optional) – A scale factor for the multiplier to penalize the relative displacements between
the center-point and the points in contact. Default is 1.0. The final multiplier
is scaled times a base multiplier, based on the mean normal stiffness, if items
are given.
multiplier_tangential (float or None, optional) – A scale factor for the multiplier to penalize the relative tangential
displacements between the center-point and the points in contact. Default is
0.1. The final multiplier is scaled times a base multiplier, based on the mean
tangential stiffness, if items are given.
items (list or None, optional) – A list of items to be considered for the evaluation of the mean stiffness-based
multipliers. If None, the multipliers are not based on the mean stiffness.
Default is None.
multiplier_update (str, optional) – The update of the mean stiffness-based multipliers, either "increment"
(once per increment, based on the stiffness of the last converged increment),
"iteration" (in each evaluation, i.e. in each Newton-iteration, without
linearization) or "once" (only on the first evaluation). Default is
"increment". Without items, the multipliers are constant.
symmetric (bool, optional) – A flag to return the symmetric part of the stiffness matrix. The consistent
stiffness matrix of frictional contact is not symmetric. Default is False.
elastic_slip (float or None, optional) – The allowable elastic slip \(\gamma\) (a length) of sticking points. If
given, the tangential multiplier is proportional to the normal force,
\(\lambda_t = \mu\ f_n / \gamma\), i.e. a sticking point starts to slide
at an elastic slip of \(\gamma\), independent of the contact pressure.
The scale factor multiplier_tangential is not used. Typical values are 0.5 %
to 1 % of a characteristic element length of the contact surface. For an
infinite friction coefficient, \(\mu=1\) is used for the tangential
multiplier. If None, the tangential multiplier is constant. Default is None.
The contact formulation is based on a penalty method. The multiplier should be
chosen sufficiently large to enforce the contact constraints, but not too large
to cause numerical issues. Best practice is to provide items, which are
connected to the contact points. This will enable mean stiffness-based
multipliers.
The contact activation is based on the gap between the center-point and the points
in potential contact. The gap is evaluated in the deformed configuration in the
direction of the plane normal. If the gap is negative, the contact is active, see
Eq. (40).
The tangential contact friction forces are evaluated according to a Coulomb friction
law with an elastic (penalty) stick and a return mapping, similar to
elasto-plasticity. The state variables are the gap vectors
\(\Delta \boldsymbol{x}_n\), the reference (stick) gap vectors
\(\Delta \boldsymbol{x}^{ref}_n\) and the contact flags of the last converged
increment. These are only updated after a converged increment, i.e. the forces and
the stiffness matrix are functions of the displacements within an increment. For
points which are already in contact at the beginning of the increment, the
(trial) elastic slip is given in Eq. (42).
For points which come into contact within the increment, the reference gap vector
is located at the (linearly interpolated) point of first contact, where the gap is
zero, see Eq. (43). This avoids friction forces from the
tangential movement before the contact is established, also for large increments.
With an allowable elastic slip \(\gamma\) (elastic_slip), the tangential
multiplier is not constant but proportional to the normal force, see Eq.
(45). Hence, a point sticks for an elastic slip
\(|\boldsymbol{e}| \leq \gamma\), independent of the contact pressure, similar
to the penalty friction of commercial codes.
In case of sticking contact, the tangential forces are equal to the trial forces,
see Eq. (46). With an allowable elastic slip, the
derivative of the tangential multiplier is added to the stiffness matrix,
\(-\mu\ \lambda_n / \gamma\ \boldsymbol{e} \otimes \boldsymbol{n}\).
The consistent tangential stiffness matrix for sliding contact is given in Eq.
(48). The second term couples the tangential
forces to the normal force and is not symmetric.
With symmetric=True, the symmetric part of the stiffness matrix is returned.
If items are given, the multipliers are scaled by the mean normal and the mean
tangential stiffness of the diagonal blocks of the stiffness matrices of the items,
evaluated at all points in potential contact, see Eq.
(49). Hence, the multipliers do not depend on the number of
active contact points. With the default multiplier_update="increment", the
multipliers are evaluated on the first evaluation within an increment and are kept
constant during the Newton-iterations.
A ContactRigidPlane defines the contact, which connects the
displacement degrees of freedom of the center-point with the dofs of points located
at \(x=1\) if they are in contact. Only the \(x\)-component is considered in
this example.
The mesh is fixed on the left end face and a ramped Boundary is
applied on the center-point of the ContactRigidPlane. All items
are added to a Step and a Job is evaluated.
A dict with copies of the state variables of the last converged increment
(the gap vectors, the reference gap vectors of the tangential (frictional)
contact and the mask of active contact points) and the multipliers.
The normal and the tangential multipliers. If items are given, the scale
factors are multiplied by the mean normal and the mean tangential stiffness
of the diagonal blocks of the stiffness matrices of the items, evaluated at
all points in potential contact.
axis (ndarray or None, optional) – The direction of the axis of the cylinder. Required for 3d-meshes. For
2d-meshes, the axis is the out-of-plane direction, i.e. the cylinder is a
circle. Default is None.
inside (bool, optional) – If False, the points are located outside of the cylinder, e.g. for a
cylindrical indenter or a roller. If True, the points are located inside of the
cylinder, e.g. for a rigid tube. Default is False.
multiplier (float, optional) – A scale factor for the multiplier to penalize the relative displacements between
the center-point and the points in contact. Default is 1.0. The final multiplier
is scaled times a base multiplier, based on the mean normal stiffness, if items
are given.
multiplier_tangential (float or None, optional) – A scale factor for the multiplier to penalize the relative tangential
displacements between the center-point and the points in contact. Default is
0.1. The final multiplier is scaled times a base multiplier, based on the mean
tangential stiffness, if items are given.
items (list or None, optional) – A list of items to be considered for the evaluation of the mean stiffness-based
multipliers. If None, the multipliers are not based on the mean stiffness.
Default is None.
multiplier_update (str, optional) – The update of the mean stiffness-based multipliers, either "increment"
(once per increment, based on the stiffness of the last converged increment),
"iteration" (in each evaluation, i.e. in each Newton-iteration, without
linearization) or "once" (only on the first evaluation). Default is
"increment". Without items, the multipliers are constant.
symmetric (bool, optional) – A flag to return the symmetric part of the stiffness matrix. The consistent
stiffness matrix of frictional contact is not symmetric. Default is False.
elastic_slip (float or None, optional) – The allowable elastic slip \(\gamma\) (a length) of sticking points. If
given, the tangential multiplier is proportional to the normal force,
\(\lambda_t = \mu\ f_n / \gamma\). If None, the tangential multiplier is
constant. Default is None. See ContactRigidPlane for details.
curvature (str or None, optional) – The gaps for the curvature term of the normal stiffness, either
"converged" (the gaps of the last converged increment, zero for points
which come into contact within the increment), "trial" (the gaps of the
trial state, i.e. a consistent linearization) or None (no curvature term).
Default is "converged".
Notes
A ContactRigidCylinder is supported as an item in a
Step. The contact formulation is the same as for a
ContactRigidPlane (penalty-based normal contact, Coulomb friction
with a return mapping from the converged state, stiffness-based multipliers), but
the gaps and the outward normal vectors depend on the positions of the points.
With the projection onto the cross-section of the cylinder, the gaps, the normal
vectors and their derivatives w.r.t. the gap vectors (the curvatures) are given in
Eq. (50), where \(s=1\) for points outside and \(s=-1\) for
points inside of the cylinder.
The consistent normal stiffness includes the curvature term, see Eq.
(51). For points outside of the cylinder, this term is
negative in circumferential direction (the normal force divided by the radius).
For large increments, the gaps of the trial state in the first Newton-iterations
may be much larger than the converged gaps. Then, the negative curvature term may
lead to an indefinite stiffness matrix and the Newton-Raphson method diverges, e.g.
for soft bodies with free side faces. Hence, the curvature term is evaluated with
the gaps of the last converged increment by default (curvature="converged"),
i.e. with the normal forces of the last converged increment. This is not a
consistent linearization, but the curvature term is bounded by the converged
normal forces. The consistent linearization is used with curvature="trial".
The elastic slip is measured in the current tangent plane. Its derivative includes
the derivative of the tangential projection, see Eq. (52). The
reference gap vectors are updated by the return mapping after each converged
increment, i.e. the elastic slip is bounded and a large sliding path along the
circumference is captured by the updates of the reference gap vectors.
The cylinder does not rotate, i.e. only the translational degrees of freedom of the
center-point are coupled.
Examples
This example shows how to use a ContactRigidCylinder. A rubber
block is indented by a rigid cylinder, which is dragged along the top face
afterwards. An additional center-point on the axis of the cylinder is added to the
mesh.
The ContactRigidCylinder connects the center-point with the points
of the top face, if they are in contact. The axis of the cylinder is parallel to
the \(y\)-axis. The allowable elastic slip is about 3 % of the element length.
The mesh is fixed on the bottom face. The center-point is moved downwards first and
horizontally afterwards. For large increments, the contact status of the points
and the stick-slip states may alternate between the Newton-iterations. Then, a
CutbackPlugin reduces the increment of failed substeps.
A dict with copies of the state variables of the last converged increment
(the gap vectors, the reference gap vectors of the tangential (frictional)
contact and the mask of active contact points) and the multipliers.
The normal and the tangential multipliers. If items are given, the scale
factors are multiplied by the mean normal and the mean tangential stiffness
of the diagonal blocks of the stiffness matrices of the items, evaluated at
all points in potential contact.
Plot the rigid cylinder (a circle for 2d-meshes) with its center-point.
Parameters:
plotter (pyvista.Plotter or None, optional) – An existing plotter. Default is None.
deformed (bool, optional) – A flag to plot the cylinder at the deformed center-point. Default is True.
size (float or None, optional) – The length of the cylinder (3d only). If None, the length is 1.05 times the
largest dimension of the mesh. Default is None.
resolution (int, optional) – The number of points in circumferential direction. Default is 120.
show_edges (bool, optional) – A flag to show the edges of the cylinder surface (3d only). Default is
False.
color (str, optional) – The color of the cylinder. Default is “black”.
opacity (float, optional) – The opacity of the cylinder. Default is 0.5.
line_width (float or None, optional) – The line width of the circle (2d only) and the axis. Default is None.
show_point (bool, optional) – A flag to show the center-point. Default is True.
show_line (bool, optional) – A flag to show the axis of the cylinder (3d only). Default is True.
sym (tuple of bool, optional) – Clip the cylinder at the symmetry planes of the given axes. Default is
(False, False, False).
**kwargs (dict, optional) – Additional keyword arguments for the meshes of the plotter.
An item contributes a sparse vector and a sparse matrix to the system of equations
of the Newton-Raphson method, e.g. a solid body, a load or a constraint. Every
object with the attributes field, assemble and results is an item, i.e.
an item doesn’t have to be derived from this class. The attributes are checked by
isinstance(obj,Item).
The field container of the item. Before each evaluation of the vector, the
fields of the item are linked to the unknowns of the Newton-Raphson method by
FieldContainer.link().
The methods to assemble the vector and the matrix of the item, see
Assemble. Both may be smaller than the system of
equations, their shapes are increased to the shape of the system.
assemble.vector(field,parallel=False) returns the sparse vector (the
residuals) for the given (linked) field container.
assemble.matrix(parallel=False) returns the sparse matrix (the
linearization of the vector). In each iteration, the matrix is evaluated
after the vector for the same field container, i.e. the results of the
evaluation of the vector may be re-used.
assemble.multiplier is None or a scale factor for the vector and the
matrix.
The results of the item, see Results. An item with
state variables stores the trial state variables of the last evaluation in
results._statevars. After a converged iteration, the Newton-Raphson method
calls results.update_statevars(), which accepts the trial state variables
as the state variables results.statevars of the converged solution.
An item may provide optional methods, which are only required for some features.
update(value): the item is ramped in a Step, e.g. the
values of a PointLoad. UpdateItem
ramps further parameters of an item.
checkpoint() and restore(checkpoint): the state of the item, which is
modified by the iterations of the Newton-Raphson method, is restored by the
CutbackPlugin, e.g. the internal fields of a
SolidBodyNearlyIncompressible.
results.force: the assembled vector, which is used by the
CharacteristicCurve to evaluate the reaction forces.
assemble.mass(): the mass matrix for a FreeVibration.
A State with internal cell-wise constant dual fields for (nearly) incompressible
solid bodies.
Notes
The internal fields \(p\) and \(\bar{J}\) are treated as internal fields, directly derived
from the displacement field. Hence, these fields are not exported to the global degrees of freedom.
Parameters:
field (FieldContainer) – A field container with the displacement field.
multiplier (float, optional) – A scale factor for the multiplier to penalize the relative displacements between
the center-point and the points in contact. Default is 1.0.
multiplier_tangential (float or None, optional) – A scale factor for the multiplier to penalize the relative tangential
displacements between the center-point and the points in contact. Default is
0.1.
items (list or None, optional) – A list of items to be considered for the evaluation of the mean stiffness-based
multipliers. Default is None.
multiplier_update (str, optional) – The update of the mean stiffness-based multipliers, either "increment",
"iteration" or "once". Default is "increment".
symmetric (bool, optional) – A flag to return the symmetric part of the stiffness matrix. Default is False.
elastic_slip (float or None, optional) – The allowable elastic slip of sticking points. Default is None.
curvature (str or None, optional) – The gaps for the curvature term of the normal stiffness, either
"converged", "trial" or None. Default is "converged".
Notes
The geometry of the rigid surface is defined by the method _kinematics(dx) of a
subclass. For given gap vectors \(\Delta \boldsymbol{x}\) between the points and
the center-point, it returns the gaps \(g\), the outward normal vectors
\(\boldsymbol{n} = \partial g / \partial \Delta \boldsymbol{x}\) and the
derivatives of the normal vectors w.r.t. the gap vectors (the curvatures)
\(\boldsymbol{H} = \partial \boldsymbol{n} / \partial \Delta \boldsymbol{x}\),
or None for a flat surface. The rigid surface does not rotate, i.e. only the
translational degrees of freedom of the center-point are coupled.
The base class provides the penalty-based normal contact, the Coulomb friction with
the return mapping from the converged state, the stiffness-based multipliers, the
checkpoints and the assembly of the sparse vector and matrix. With curvatures, the
stiffness matrix includes the derivatives of the normal vectors, see
ContactRigidCylinder. The parameters are explained in more detail
in ContactRigidPlane and ContactRigidCylinder.
A subclass, e.g. for a new shape of the rigid surface, only has to implement
_kinematics(dx). The attributes, which are used by _kinematics(dx), have to
be set before super().__init__() is called, because the initial contact state
is evaluated there.
Examples
A custom contact with a rigid sphere (a rigid circle for 2d-meshes) is created by
the gaps, the normal vectors and the curvatures of the sphere.
>>> importnumpyasnp>>> importfelupeasfem>>>>>> classContactRigidSphere(fem.mechanics.ContactRigidBase):... "A node-to-surface contact with a rigid sphere."...... def__init__(self,field,points,centerpoint,radius,**kwargs):... self.radius=radius# required by _kinematics(), set it first... super().__init__(field,points,centerpoint,**kwargs)...... def_kinematics(self,dx):... distance=np.linalg.norm(dx,axis=1)... normal=dx/distance.reshape(-1,1)... nn=np.einsum("ai,aj->aij",normal,normal)... curvature=(np.eye(dx.shape[1])-nn)/distance.reshape(-1,1,1)... returndistance-self.radius,normal,curvature
A block is indented by the rigid sphere. An additional center-point is added to the
mesh, which is moved downwards.
A dict with copies of the state variables of the last converged increment
(the gap vectors, the reference gap vectors of the tangential (frictional)
contact and the mask of active contact points) and the multipliers.
The normal and the tangential multipliers. If items are given, the scale
factors are multiplied by the mean normal and the mean tangential stiffness
of the diagonal blocks of the stiffness matrices of the items, evaluated at
all points in potential contact.