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.

How does COMSOL recognizes t when you write it in a function?

Please login with a confirmed email address before reporting spam

Hello everyone

İve been trying to learn and simulate heat transfer in comsol for the past 2 weeks and i have a problem i cant seem to figure out why.
İve put a drichlet boundary condition on a surface that has a function for r.İn the function there is suppose to be a time parameter.İ wrote 't' to the respective place to calculate surface temperature as a function of time,but when i compare it to a other model that made with another software it doest give the same results.İ mean i know it isnt suppose to give the exact same result because different softwares solve differently but it doesnt even resemble the other one.i think COMSOL doesnt recognize t as time when you wrote it in a boundary condition(in a function)am i wrong?İf im right how do i do it?
Another thing is that when i run the simulation for 10 years and pick 5 th year results and compare it to the 5th year results run for 5 year simulation theyre completely different arent they suppose to be the same thing,the parameter that changes is time and i both select for 5th year they should be the same.İ know im doing something wrong but i couldnt figure it out....

P.S i've put comparisons of the results for the same year in the attached file


5 Replies Last Post 04.08.2015, 06:53 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 03.08.2015, 07:10 GMT-4
The default unit for time is second. How do you introduce the time unit (years?) in your function? Perhaps it would be better to define an analytic function and call it in the BC. In the function definition units are explicitly stated.

In another thread here the same question of having different result depending on the length of the simulation was presented. The reply was that it depends on the time stepping. Do you have exactly the same step lengths in 5 year and 10 year simulations?
The default unit for time is second. How do you introduce the time unit (years?) in your function? Perhaps it would be better to define an analytic function and call it in the BC. In the function definition units are explicitly stated. In another thread here the same question of having different result depending on the length of the simulation was presented. The reply was that it depends on the time stepping. Do you have exactly the same step lengths in 5 year and 10 year simulations?

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 03.08.2015, 07:19 GMT-4
İ introduced it in seconds.It was like this -------->range(0,1849.5,10*59355128.1384) (this is for 10 years)

1849.5 is half an (martian)hour
59355128.1384 is a (martian)year in seconds

after i did this i opened a 1d plot group and a line graph and after that from 1 d plot group>data i selected the respective results for the 5th year

when i run the simulation for 5 years and chose the 5th year there are different results...So yeah i have exactly the same time step on bot of them.

P.S i didnt understand when you said ' it would be better to define an analytic function and call it in the BC.'
İ introduced it in seconds.It was like this -------->range(0,1849.5,10*59355128.1384) (this is for 10 years) 1849.5 is half an (martian)hour 59355128.1384 is a (martian)year in seconds after i did this i opened a 1d plot group and a line graph and after that from 1 d plot group>data i selected the respective results for the 5th year when i run the simulation for 5 years and chose the 5th year there are different results...So yeah i have exactly the same time step on bot of them. P.S i didnt understand when you said ' it would be better to define an analytic function and call it in the BC.'

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 03.08.2015, 09:21 GMT-4
Okey i ran some test and i found out that comsol does recognizes 't' as time.

So now the only problem is having different result depending on the length of the simulation presented.Its shouldnt be like this i always used the same time steps but it isnt giving me the same result its just not logical when you write the respective time in the function it should give the same result regardless of the length of the simulation...
Okey i ran some test and i found out that comsol does recognizes 't' as time. So now the only problem is having different result depending on the length of the simulation presented.Its shouldnt be like this i always used the same time steps but it isnt giving me the same result its just not logical when you write the respective time in the function it should give the same result regardless of the length of the simulation...

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 03.08.2015, 13:32 GMT-4
One more suggestion:

In the Solver Configurations, Time Stepping, Steps taken by solver: is it Free or Strict? This means that although your time stepping looks the same, the solver decides itself what to use if you have not defined Strict.

Under Component --> Definitions you can define, e.g. an analytic function that describes your boundary condition as a function of time. There you have to write explicitly down the units of the function and the argument. Let's say that the function is called 'an1' and it argument is t in yr (= years) and the function is in degC (centigrades). Then, in the boundary condition you can simply write an1(t).

One more suggestion: In the Solver Configurations, Time Stepping, Steps taken by solver: is it Free or Strict? This means that although your time stepping looks the same, the solver decides itself what to use if you have not defined Strict. Under Component --> Definitions you can define, e.g. an analytic function that describes your boundary condition as a function of time. There you have to write explicitly down the units of the function and the argument. Let's say that the function is called 'an1' and it argument is t in yr (= years) and the function is in degC (centigrades). Then, in the boundary condition you can simply write an1(t).

Please login with a confirmed email address before reporting spam

Posted: 9 years ago 04.08.2015, 06:53 GMT-4
Okey making it selecting time steps strict solved my problem so even if you take same time steps it doesnt take the same time steps and it gives you wrong results just to make the calculation faster(i assume that this is because of that)i dont know which one is more important making the solving process in the most optimum way or giving the results user wants...i have so many questions...

But thanks anyway you saved my work right now i've spent 1 more week for this and it was just about changing a little something thank you so much you helped me a lot :)
Okey making it selecting time steps strict solved my problem so even if you take same time steps it doesnt take the same time steps and it gives you wrong results just to make the calculation faster(i assume that this is because of that)i dont know which one is more important making the solving process in the most optimum way or giving the results user wants...i have so many questions... But thanks anyway you saved my work right now i've spent 1 more week for this and it was just about changing a little something thank you so much you helped me a lot :)

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.