Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions docs/source/tutorials/adhesion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ We can build a normal adhesion potential object and compute the adhesion potenti
const double Y = 1e3;
const double eps_c = 0.5;

const ipc::NormalAdhesionPotential A_n(dhat_p, dhat_a, Y, eps_c)
const ipc::NormalAdhesionPotential A_n(dhat_p, dhat_a, Y, eps_c);
double adhesion_potential = A_n(normal_collisions, collision_mesh, vertices);

.. md-tab-item:: Python
Expand Down Expand Up @@ -132,7 +132,7 @@ We can build a tangential adhesion potential object and compute the adhesion pot

eps_a = 0.01
A_t = ipctk.TangentialAdhesionPotential(eps_a)
adhesion_potential = A_t(tangential_collisions, collision_mesh, displacement);
adhesion_potential = A_t(tangential_collisions, collision_mesh, displacement)

Derivatives
^^^^^^^^^^^
Expand Down Expand Up @@ -177,17 +177,15 @@ Similar to the friction model (see, `friction <advanced_friction.html#separate-c

ipc::TangentialCollisions tangential_collisions;
tangential_collisions.build(
collision_mesh, vertices, collisions, B, barrier_stiffness,
mu_s, mu_k);
collision_mesh, vertices, collisions, A_n, mu_s, mu_k);

.. md-tab-item:: Python

.. code-block:: python

tangential_collisions = ipctk.TangentialCollisions()
tangential_collisions.build(
collision_mesh, vertices, collisions, B, barrier_stiffness,
mu_s, mu_k)
collision_mesh, vertices, collisions, A_n, mu_s, mu_k)

The tangential adhesion force mollifier is then multiplied by the smooth coefficient of tangential adhesion:

Expand Down
20 changes: 15 additions & 5 deletions docs/source/tutorials/convergent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,47 @@ Convergent Formulation

In addition to the original implementation of :cite:t:`Li2020IPC`, we also implement the convergent formulation of :cite:t:`Li2023Convergent`.

Fully enabling the convergent formulation requires to set three things: ``use_area_weighting`` and ``collision_set_type`` in ``Collisions`` (before calling ``build``) and ``use_physical_barrier`` in ``BarrierPotential``.
Fully enabling the convergent formulation requires to set three things: ``use_area_weighting`` and ``collision_set_type`` in ``NormalCollisions`` (before calling ``build``) and ``use_physical_barrier`` in ``BarrierPotential``.

.. md-tab-set::

.. md-tab-item:: C++

.. code-block:: c++

ipc::NormalCollisions collisions;
collisions.set_use_area_weighting(true);
collisions.set_collision_set_type(
ipc::NormalCollisions::CollisionSetType::IMPROVED_MAX_APPROX);
collisions.build(collision_mesh, vertices, dhat);

ipc::BarrierPotential barrier_potential(dhat, stiffness);
barrier_potential.set_use_physical_barrier(true);
double b = barrier_potential(collisions, mesh, vertices);
double b = barrier_potential(collisions, collision_mesh, vertices);

.. md-tab-item:: Python

.. code-block:: python

collisions = ipctk.NormalCollisions()
collisions.use_area_weighting = True
collisions.collision_set_type = \
ipctk.NormalCollisions.CollisionSetType.IMPROVED_MAX_APPROX
collisions.build(collision_mesh, vertices, dhat)

barrier_potential = ipctk.BarrierPotential(dhat, stiffness)
barrier_potential.use_physical_barrier = True
b = barrier_potential(collisions, mesh, vertices);
b = barrier_potential(collisions, collision_mesh, vertices)

.. important::
The members ``use_area_weighting`` and ``collision_set_type`` should be set before calling ``build`` for them to take effect. By default, they are ``false`` and ``IPC``.

.. tip::
``use_physical_barrier`` can also be set when constructing the potential:
``ipc::BarrierPotential(dhat, stiffness, /*use_physical_barrier=*/true)`` in
C++ or ``ipctk.BarrierPotential(dhat, stiffness, use_physical_barrier=True)``
in Python.

Technical Details
-----------------

Expand Down Expand Up @@ -68,7 +78,7 @@ Applying mesh vertices as nodes (and quadrature points), we numerically integrat
where :math:`w_{\bar{x}}` are the quadrature weights, each given by one-third of the sum of the areas (in material space) of the boundary triangles incident to :math:`\bar{x}`.

.. tip::
The area weighted quadrature is enabled by setting ``use_area_weighting`` to ``true`` in ``Collisions``.
The area weighted quadrature is enabled by setting ``use_area_weighting`` to ``true`` in ``NormalCollisions``.

We next need to smoothly approximate the max operator in the barrier potentials. However, common approaches such as an :math:`L^p`-norm or LogSumExp would decrease sparsity in subsequent numerical solves by increasing the stencil size per collision evaluation. We instead leverage the locality of our barrier function to approximate the max operator by removing duplicate distance pairs. Our resulting approximators for a triangulated surface is

Expand All @@ -86,7 +96,7 @@ where :math:`V_{\text{int}} \subseteq V` is the subset of internal surface nodes
Comparison of the improved max approximator (right) to and exact max (left) and the direct summation (middle). For obtuse angles, the improved max approximator is tight, while for acute angles it might overestimate the max in concave regions.

.. tip::
The improved max approximator is enabled by setting ``collision_set_type`` to ``IMPROVED_MAX_APPROX`` in ``Collisions``.
The improved max approximator is enabled by setting ``collision_set_type`` to ``IMPROVED_MAX_APPROX`` in ``NormalCollisions``.

The corresponding discrete barrier potential is then simply

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/gcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ As :math:`\alpha + \beta` decreases, the support of the Heaviside function shrin

Additional internal parameters that may affect behavior:

- **Adaptive dhat ratio** (default ``0.5``): Controls the ratio :math:`\epsilon(x) / d_c(x, f_0)` in the adaptive barrier localization. Can be set via ``SmoothContactParameters::set_adaptive_dhat_ratio()``.
- **Adaptive dhat ratio** (default ``0.5``): Controls the ratio :math:`\epsilon(x) / d_c(x, f_0)` in the adaptive barrier localization. Set it via ``SmoothContactParameters::set_adaptive_dhat_ratio()`` in C++ or the ``SmoothContactParameters.adaptive_dhat_ratio`` property in Python.
- **Element measure** :math:`L`: For vertices, this is set to the average edge length around the vertex; for edges, to the edge length; for faces, :math:`L` is not needed. This determines the strength of the potential for low-dimensional contact (edge–edge, edge–vertex, vertex–vertex).

Friction
Expand Down
Loading
Loading