You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many physical systems, boundary conditions are not always defined at fixed points such as intitial or terminal ends of the domain. Instead, we may encounter scenarios where constraints are imposed on the maximum or minimum values that the solution must attain somewhere within the domain. In such cases, we can use the `maxsol` and `minsol` functions provided by BoundaryValueDiffEq.jl to specify such extremum boundary conditions.
4
+
5
+
Let's walk through this functionality with an intuitive example. We still revisit the simple pendulum example here, but this time, suppose we need to impose the maximum and minimum value to our boundary conditions, specified as:
6
+
7
+
```math
8
+
\max{u}=ub\\
9
+
\min{u}=lb
10
+
```
11
+
12
+
where `lb=-4.8161991710010925` and `ub=5.0496477654230745`. So the states must conform that the maximum value of the state should be `lb` while the minimum value of the state should be `ub`. To solve such problems, we can simply use the `maxsol` and `minsol` functions when defining the boundary value problem in BoundaryValueDiffEq.jl.
13
+
14
+
```@example inequality
15
+
using BoundaryValueDiffEq, Plots
16
+
tspan = (0.0, pi / 2)
17
+
function simplependulum!(du, u, p, t)
18
+
θ = u[1]
19
+
dθ = u[2]
20
+
du[1] = dθ
21
+
du[2] = -9.81 * sin(θ)
22
+
end
23
+
function bc!(residual, u, p, t)
24
+
residual[1] = maxsol(u, (0.0, pi / 2)) - 5.0496477654230745
25
+
residual[2] = minsol(u, (0.0, pi / 2)) + 4.8161991710010925
0 commit comments