Skip to content

Commit 762873d

Browse files
committed
Update restrictions documentation in restrictions.md
1 parent 0a14fc6 commit 762873d

File tree

1 file changed

+44
-9
lines changed

1 file changed

+44
-9
lines changed

docs/src/restrictions.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
# Restrictions
22

3-
ExtendableFEM.jl provides functionality to apply various restrictions to your finite element problems through the `AbstractRestriction` type system. Restrictions are used to enforce additional constraints on your solution that cannot be easily expressed through standard boundary conditions or the weak formulation.
3+
ExtendableFEM.jl provides functionality to apply various restrictions to your finite element problems through the `AbstractRestriction` type system. Restrictions enforce additional constraints on your solution that cannot be easily expressed through standard boundary conditions or the weak formulation.
44

55
## Built-in Restrictions
66

7-
### Mean Value Restriction
7+
### Linear Functional Restriction
88

9-
`MeanValueRestriction` allows you to constrain the mean value of a scalar unknown to a specific value. This is particularly useful in problems where solutions are only unique up to a constant.
9+
`LinearFunctionalRestriction` allows you to constrain a linear functional of a finite element unknown to a specific value. This is useful, for example, for enforcing that the solution has mean zero, or that an integral constraint is satisfied.
1010

11+
Documentation:
1112
```@autodocs
1213
Modules = [ExtendableFEM]
13-
Pages = ["common_restrictions/mean_value_restriction.jl"]
14+
Pages = ["common_restrictions/linear_functional_restriction.jl"]
1415
Order = [:type, :function]
1516
```
1617

1718
#### Example Usage
1819
```julia
1920
# Restrict the mean value of unknown u to 0
20-
restriction = MeanValueRestriction(u)
21+
restriction = ZeroMeanValueRestriction(u)
2122

2223
# Restrict the mean value to 1.0 with a specific operator
23-
restriction = MeanValueRestriction(u, value = 1.0, operator = MyCustomOperator)
24+
restriction = MassRestriction(u, value = 1.0, operator = MyCustomOperator)
2425

25-
# apply to the problem
26+
# Assign to the problem
2627
assign_restriction!(PD, restriction)
2728
```
2829

2930
### Coupled DOFs Restriction
3031

31-
`CoupledDofsRestriction` enables coupling between different degrees of freedom (DOFs) in your system. This is particularly useful for implementing periodic boundary conditions or other constraints where DOFs need to be related to each other. See also `CombineDofs` operator, which does the same by maniplulating the system matrix.
32-
However, the application of `CoupledDofsRestriction` much faster for larger systems, since the manipulation of the system matrix, as performed by operators, is very expensive.
32+
`CoupledDofsRestriction` enables coupling between different degrees of freedom (DOFs) in your system. This is particularly useful for implementing periodic boundary conditions or other constraints where DOFs need to be related to each other. Compared to manipulating the system matrix directly via operators (e.g. `CombineDofs`), `CoupledDofsRestriction` is much faster for large systems.
3333

34+
Documentation:
3435
```@autodocs
3536
Modules = [ExtendableFEM]
3637
Pages = ["common_restrictions/coupled_dofs_restriction.jl"]
@@ -44,3 +45,37 @@ coupling_matrix = get_periodic_coupling_matrix(...)
4445
restriction = CoupledDofsRestriction(coupling_matrix)
4546
assign_restriction!(PD, restriction)
4647
```
48+
49+
### Boundary Data Restriction
50+
51+
`BoundaryDataRestriction` enforces prescribed boundary values for a finite element unknown. It can be used for both homogeneous (zero) and non-homogeneous boundary conditions, interpolating the boundary data as needed.
52+
53+
Documentation:
54+
```@autodocs
55+
Modules = [ExtendableFEM]
56+
Pages = ["common_restrictions/boundarydata_restriction.jl"]
57+
Order = [:type, :function]
58+
```
59+
60+
#### Example Usage
61+
```julia
62+
# Homogeneous boundary data (default)
63+
restriction = BoundaryDataRestriction(u)
64+
65+
# Inhomogeneous boundary data using a function
66+
restriction = BoundaryDataRestriction(u, data = (result, qpinfo) -> result .= sin(qpinfo.x[1]))
67+
68+
assign_restriction!(PD, restriction)
69+
```
70+
71+
## AbstractRestriction API
72+
73+
All restrictions are subtypes of `AbstractRestriction`. The following functions are available for interacting with restrictions:
74+
75+
- `assemble!(restriction, solution, SC; kwargs...)`: Assemble the internal matrices and vectors for the restriction.
76+
- `restriction_matrix(restriction)`: Get the restriction matrix.
77+
- `restriction_rhs(restriction)`: Get the right-hand side vector for the restriction.
78+
- `fixed_dofs(restriction)`: Get the list of fixed degrees of freedom affected by the restriction.
79+
- `is_timedependent(restriction)`: Returns whether the restriction is time-dependent.
80+
81+
---

0 commit comments

Comments
 (0)