Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Heaviside function Comsol
Posted Jul 14, 2015, 8:47 a.m. EDT 10 Replies
Please login with a confirmed email address before reporting spam
I am solving the heat transfer function, with an initial condition,.
In my simulation the initial variable is called Ninit, and I want to define it with a heaviside function,
Ninit = 0.4*Heaviside(0.04 - x^2 - y^2),
I am attaching the plot of the initial condition.
Can anyone tell me how to add this in comsol?
Attachments:
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
0.25*(flc1hs(x^2,-0.5)+flc1hs(y^2,-0.5)) and I am getting this as the initial condition (initial_comsol.jpg).
I want to achieve something like this, (initial_malab.jpg)
Attachments:
Please login with a confirmed email address before reporting spam
0.4*flc1hs(0.04 - x^2 - y^2, 0.01)?
Please login with a confirmed email address before reporting spam
Attachments:
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Attachments:
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I tried flc2hs, and I'm getting a similar result. I changed the second parameter to 0.001 and it is the same,
It is like this only for the initial step. at 0.1s onward white boundary is gone
Please login with a confirmed email address before reporting spam
for instance (x^2 + y^2 > 0.4) will return 1 when true and 0 when false.
Please login with a confirmed email address before reporting spam
I get the feeling that this may be a case of the situation that's been discussed in this Discussion Forum before (I cannot find the thread right now) where the user tries to impose a very rapid variation of a quantity at the nodes of a single quadratic element, not realizing that this can cause the quantity to overshoot or undershoot in between the nodes.
E.g. if you imagine a 1D quadratic element covering [-2;2] and you impose at the 3 nodes u(-2)=1, u(0)=0 and u(2)=0, then u will take negative values in [0;2]. This can be counter-intuitive but it's true. If your plot is set up so that only values of u between 0 and 1 are displayed, then you will naturally get a "hole" in your plot, like what your screenshots above show.
The solution is to use a finer mesh, one that uses more than one element to capture the gradient that you're imposing.
Jeff
Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.
Suggested Content
- FORUM Error in user-defined function
- KNOWLEDGE BASE Undefined Function Call
- BLOG Happy Birthday, Oliver Heaviside
- FORUM Step Function
- KNOWLEDGE BASE Initial guess leads to undefined function value