FillingConstraint
The `FillingConstraint` is part of the SofaTestPlugin module and inherits from `BaseOpenSurfaceConstraint`. It serves to apply surface constraints in simulations, particularly focusing on pressure and flow dynamics related to hemodynamic coefficients. This constraint is used to model filling phases where input pressure (`P_in`) and a hemodynamic coefficient (`K_in`) between pressure and flow are essential parameters. The component interacts with other SOFA components through its API, primarily by implementing the `getConstraintResolution` method inherited from the base class. It also relies on the context's time and delta-time to compute relevant values during initialization. Users can configure this constraint using two data fields: `P_in`, representing input pressure at a given time step (`t+dt`), and `K_in`, denoting the hemodynamic coefficient between pressure and flow. The component is initialized through its `init` method, which sets up necessary parameters and conditions for subsequent operations.
- abstract
- The `FillingConstraint` applies surface constraints in simulations focusing on pressure and flow dynamics during filling phases by solving for the Lagrange multiplier with input pressure and hemodynamic coefficients.
- sheet
- # FillingConstraint ## Overview The `FillingConstraint` is part of the SofaTestPlugin module, inheriting from `BaseOpenSurfaceConstraint`. It models surface constraints in simulations related to pressure and flow dynamics during filling phases. ## Mathematical Model The `FillingConstraint` applies a surface constraint by solving for the Lagrange multiplier ($\lambda$) using the following equation: egin{align*} W \cdot \lambda &= d_{target} - d_{free} \\ &= \Delta t \cdot K_{in} \cdot (\lambda - P_{in}) - d_{free} \\ \Rightarrow \quad \lambda &= \frac{\Delta t \cdot K_{in} \cdot P_{in} + d_{free}}{\Delta t \cdot K_{in} - W} ag{1}\label{eq:lagrange_multiplier} ag{2}\label{eq:solve_lambda} ag{3}\label{eq:final_lambda} Where: - $W$ is a weight factor. - $\Delta t$ is the time step (obtained from context). - $d_{target}$ represents the target displacement. - $d_{free}$ is the free displacement component due to external forces or other constraints. ## Parameters and Data The significant data fields exposed by the `FillingConstraint` are: - **P_in**: Input pressure at time $t + \Delta t$ (type: Real). - **K_in**: Hemodynamic coefficient between pressure and flow (type: Real).
- description
- The `FillingConstraint` is part of the SofaTestPlugin module and inherits from `BaseOpenSurfaceConstraint`. It serves to apply surface constraints in simulations, particularly focusing on pressure and flow dynamics related to hemodynamic coefficients. This constraint is used to model filling phases where input pressure (`P_in`) and a hemodynamic coefficient (`K_in`) between pressure and flow are essential parameters. The component interacts with other SOFA components through its API, primarily by implementing the `getConstraintResolution` method inherited from the base class. It also relies on the context's time and delta-time to compute relevant values during initialization. Users can configure this constraint using two data fields: `P_in`, representing input pressure at a given time step (`t+dt`), and `K_in`, denoting the hemodynamic coefficient between pressure and flow. The component is initialized through its `init` method, which sets up necessary parameters and conditions for subsequent operations.
- maths
- <maths_md_description> The `FillingConstraint` is designed to apply surface constraints in simulations, particularly focusing on pressure and flow dynamics related to hemodynamic coefficients. It models filling phases where the input pressure (`P_in`) and a hemodynamic coefficient (`K_in`) between pressure and flow are essential parameters. ### Key Parameters - **Input Pressure ($P_{in}$)**: Represents the input pressure at time $t + \Delta t$. - **Hemodynamic Coefficient ($K_{in}$)**: Denotes the hemodynamic coefficient that relates changes in pressure to flow. ### Mathematical Formulation The `FillingConstraint` applies a surface constraint by solving for the Lagrange multiplier ($\lambda$) using the following equation: egin{align*} W \cdot \lambda &= d_{target} - d_{free} \\ &= \Delta t \cdot K_{in} \cdot (\lambda - P_{in}) - d_{free} \\ \Rightarrow \quad \lambda &= \frac{\Delta t \cdot K_{in} \cdot P_{in} + d_{free}}{\Delta t \cdot K_{in} - W} ag{1}\label{eq:lagrange_multiplier} ag{2}\label{eq:solve_lambda} ag{3}\label{eq:final_lambda} Where: - $W$ is a weight factor. - $\Delta t$ is the time step (obtained from context). - $d_{target}$ represents the target displacement. - $d_{free}$ is the free displacement component due to external forces or other constraints. ### Initialization and Setup The `init` method sets up necessary parameters and conditions for subsequent operations. Specifically, it initializes the following: - `m_hemo_container.time`: Current simulation time. - `m_hemo_container.dt`: Time step (`\Delta t`). - `m_hemo_container.Qtarget`: Target flow rate (though this is currently set but not used in the equations). ### Constraint Resolution The method `getConstraintResolution` adds the corresponding `FillingConstraintResolution` instance to the constraint resolution algorithms. This involves: - Creating an instance of `FillingConstraintResolution`, passing it necessary data containers. - Adding the newly created instance to the result vector (`resTab`). ### Constraint Resolution Implementation The `resolution` method in the `FillingConstraintResolution` class computes $\lambda$ using equation \eqref{eq:final_lambda}. The key steps are: 1. Retrieve necessary parameters from data containers. 2. Solve for $\lambda$ as per equation \eqref{eq:final_lambda}. 3. Assign the computed value of $\lambda$ to `lambda[line]`. ### Summary The `FillingConstraint` effectively models the filling phase dynamics by solving a linear constraint equation involving input pressure and hemodynamic coefficients, ensuring that the simulation accurately reflects the intended behavior in this context. </maths_md_description>
{
"name": "FillingConstraint",
"main": {
"name": "FillingConstraint",
"namespace": "sofa::component::constraintset",
"module": "SofaTestPlugin",
"include": "constraint/phases/FillingConstraint.h",
"doc": "Surf Constraint",
"inherits": [
"BaseOpenSurfaceConstraint"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_Pin",
"type": "Real",
"xmlname": "P_in",
"help": "Input pressure at time t+dt"
},
{
"name": "d_Kin",
"type": "Real",
"xmlname": "K_in",
"help": "Hemodynamic coefficient between pressure and flow"
}
],
"links": [],
"methods": [
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getConstraintResolution",
"return_type": "void",
"params": [
{
"name": "cParams",
"type": "const ConstraintParams *"
},
{
"name": "resTab",
"type": "int &"
},
{
"name": "offset",
"type": "unsigned int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
]
},
"desc": {
"description": "The `FillingConstraint` is part of the SofaTestPlugin module and inherits from `BaseOpenSurfaceConstraint`. It serves to apply surface constraints in simulations, particularly focusing on pressure and flow dynamics related to hemodynamic coefficients. This constraint is used to model filling phases where input pressure (`P_in`) and a hemodynamic coefficient (`K_in`) between pressure and flow are essential parameters.\n\nThe component interacts with other SOFA components through its API, primarily by implementing the `getConstraintResolution` method inherited from the base class. It also relies on the context's time and delta-time to compute relevant values during initialization.\n\nUsers can configure this constraint using two data fields: `P_in`, representing input pressure at a given time step (`t+dt`), and `K_in`, denoting the hemodynamic coefficient between pressure and flow. The component is initialized through its `init` method, which sets up necessary parameters and conditions for subsequent operations."
},
"maths": {
"maths": "<maths_md_description>\n\nThe `FillingConstraint` is designed to apply surface constraints in simulations, particularly focusing on pressure and flow dynamics related to hemodynamic coefficients. It models filling phases where the input pressure (`P_in`) and a hemodynamic coefficient (`K_in`) between pressure and flow are essential parameters.\n\n### Key Parameters\n- **Input Pressure ($P_{in}$)**: Represents the input pressure at time $t + \\Delta t$.\n- **Hemodynamic Coefficient ($K_{in}$)**: Denotes the hemodynamic coefficient that relates changes in pressure to flow.\n\n### Mathematical Formulation\nThe `FillingConstraint` applies a surface constraint by solving for the Lagrange multiplier ($\\lambda$) using the following equation:\n\n\begin{align*}\n W \\cdot \\lambda &= d_{target} - d_{free} \\\\\n &= \\Delta t \\cdot K_{in} \\cdot (\\lambda - P_{in}) - d_{free} \\\\\n \\Rightarrow \\quad \\lambda &= \\frac{\\Delta t \\cdot K_{in} \\cdot P_{in} + d_{free}}{\\Delta t \\cdot K_{in} - W}\n\tag{1}\\label{eq:lagrange_multiplier}\n\tag{2}\\label{eq:solve_lambda}\n\tag{3}\\label{eq:final_lambda}\n\nWhere:\n- $W$ is a weight factor.\n- $\\Delta t$ is the time step (obtained from context).\n- $d_{target}$ represents the target displacement.\n- $d_{free}$ is the free displacement component due to external forces or other constraints.\n\n### Initialization and Setup\nThe `init` method sets up necessary parameters and conditions for subsequent operations. Specifically, it initializes the following:\n- `m_hemo_container.time`: Current simulation time.\n- `m_hemo_container.dt`: Time step (`\\Delta t`).\n- `m_hemo_container.Qtarget`: Target flow rate (though this is currently set but not used in the equations).\n\n### Constraint Resolution\nThe method `getConstraintResolution` adds the corresponding `FillingConstraintResolution` instance to the constraint resolution algorithms. This involves:\n- Creating an instance of `FillingConstraintResolution`, passing it necessary data containers.\n- Adding the newly created instance to the result vector (`resTab`).\n\n### Constraint Resolution Implementation\nThe `resolution` method in the `FillingConstraintResolution` class computes $\\lambda$ using equation \\eqref{eq:final_lambda}. The key steps are:\n1. Retrieve necessary parameters from data containers.\n2. Solve for $\\lambda$ as per equation \\eqref{eq:final_lambda}.\n3. Assign the computed value of $\\lambda$ to `lambda[line]`.\n\n### Summary\nThe `FillingConstraint` effectively models the filling phase dynamics by solving a linear constraint equation involving input pressure and hemodynamic coefficients, ensuring that the simulation accurately reflects the intended behavior in this context.\n</maths_md_description>"
},
"summary": {
"abstract": "The `FillingConstraint` applies surface constraints in simulations focusing on pressure and flow dynamics during filling phases by solving for the Lagrange multiplier with input pressure and hemodynamic coefficients.",
"sheet": "# FillingConstraint\n\n## Overview\n\nThe `FillingConstraint` is part of the SofaTestPlugin module, inheriting from `BaseOpenSurfaceConstraint`. It models surface constraints in simulations related to pressure and flow dynamics during filling phases.\n\n## Mathematical Model\n\nThe `FillingConstraint` applies a surface constraint by solving for the Lagrange multiplier ($\\lambda$) using the following equation:\n\n\begin{align*}\n W \\cdot \\lambda &= d_{target} - d_{free} \\\\\n &= \\Delta t \\cdot K_{in} \\cdot (\\lambda - P_{in}) - d_{free} \\\\\n \\Rightarrow \\quad \\lambda &= \\frac{\\Delta t \\cdot K_{in} \\cdot P_{in} + d_{free}}{\\Delta t \\cdot K_{in} - W}\n\tag{1}\\label{eq:lagrange_multiplier}\n\tag{2}\\label{eq:solve_lambda}\n\tag{3}\\label{eq:final_lambda}\n\nWhere:\n- $W$ is a weight factor.\n- $\\Delta t$ is the time step (obtained from context).\n- $d_{target}$ represents the target displacement.\n- $d_{free}$ is the free displacement component due to external forces or other constraints.\n\n## Parameters and Data\n\nThe significant data fields exposed by the `FillingConstraint` are:\n\n- **P_in**: Input pressure at time $t + \\Delta t$ (type: Real).\n- **K_in**: Hemodynamic coefficient between pressure and flow (type: Real)."
}
}