Heaviside #444
Unanswered
martinsgronli
asked this question in
Q&A
Heaviside
#444
Replies: 1 comment
-
The support of the heaviside step function is unfortunately very buggy, but I agree that it should be better. I'll turn this suggestion into a proper issue and hope to find time to implement it reasonably soon. In the meantime, you could emulate the step function with any sigmoidal function, e.g., you could use a sufficiently steep hyperbolic tangent. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Is there a way to use the heaviside function in the PDE expression?
I want to do something like:
eq = PDE({"T": f"(1 * heaviside(T - 273, 0.5) + 2 * heaviside(273 - T, 0.5)) * laplace(T)", bc = [bc_x, bc_y]) eq.solve(field, t_end, dt)
It looks like I need to register the heaviside function as a new operator, but I am not sure how to do this.
I am asking because I want to choose a thermal conductivity of 1 when the temperature T > 273 and 2 when T < 273 while solving the 1D heat equation. Instead of using the heaviside function, I have also tried to write the f string in the first line with a condition for the temperature. However, it looks like I cannot access the temperature inside such a condition.
Beta Was this translation helpful? Give feedback.
All reactions