How to implement the following Heaviside function:


173
views
0
6 months ago by
\( H=\left\{\begin{matrix}
0, \,\,\,\,\, if \,\,\,\,\, \phi \le -\epsilon\\
\frac{1}{2} \left(1 + \frac{\phi}{\epsilon} + \frac{sin(\frac{\pi\phi}{\epsilon})}{\pi} \right ), \,\,\,\,\, if \,\,\,\,\, -\epsilon\le\phi \le \epsilon\\
1, \,\,\,\,\, if \,\,\,\,\, \phi \ge\epsilon
\end{matrix}\right.\)

Thanks for your time.
Community: FEniCS Project

1 Answer


1
6 months ago by
Use a
Conditional‚Äč

structure.
https://fenicsproject.org/qa/8175/conditional-expression-ufl-condition-as-boolean/
Since you need a greater than, and less than conditional, I'd suggest you nest one inside the other.

Please login to add an answer/comment or follow this question.

Similar posts:
Search »