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.

Analytic Function - low Resolution?

Please login with a confirmed email address before reporting spam

Hi everyone

Under "definitions" I added a Rectangle Function "rect1". Its lower limit is 0, its upper limit is 1.5E-9.

Then, also under "definitions", I created an Analytic Function and put as expression "rect1(t)".

When I plot this, it shows 1 from t = 0 until t = 1E-4 even though it should only be 1 until 1.5E-9.

So it seems that there is a resolution limited to 1E-4. Is that right? If yes, how can I create such short pulses? In the end it should be a periodic signal with pulse length 1.5E-9s and frequency of 20Hz.

Thanks in advance for your hints/help!

Best regards

p.s. I am using the Heat Transfer in solids interface.

Gabriel

8 Replies Last Post Dec 20, 2016, 8:30 a.m. EST
Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 5, 2016, 11:14 a.m. EST

When I plot this, it shows 1 from t = 0 until t = 1E-4 even though it should only be 1 until 1.5E-9.


What you see is a sampling effect: If you make a preview plot of a 1D function, then the function is evaluated in 10000 points. There is no guarantee that the preview plot resolves all details of the function.

Note that this also applies when you are solving the model: You have to configure the solver so that it takes extremely short time steps where your pulse is active; the solver doesn't know how the functions in the model behave, and it doesn't make any attempts at resolving their time scales.
[QUOTE] When I plot this, it shows 1 from t = 0 until t = 1E-4 even though it should only be 1 until 1.5E-9. [/QUOTE] What you see is a sampling effect: If you make a preview plot of a 1D function, then the function is evaluated in 10000 points. There is no guarantee that the preview plot resolves all details of the function. Note that this also applies when you are solving the model: You have to configure the solver so that it takes extremely short time steps where your pulse is active; the solver doesn't know how the functions in the model behave, and it doesn't make any attempts at resolving their time scales.

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 12, 2016, 4:02 a.m. EST
Hi Gunnar

Thank you very much for your answer!

So it is not possible to have a higher resolution in the preview plot of a 1D function?

Best regards

Gabriel
Hi Gunnar Thank you very much for your answer! So it is not possible to have a higher resolution in the preview plot of a 1D function? Best regards Gabriel

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 12, 2016, 4:47 a.m. EST

So it is not possible to have a higher resolution in the preview plot of a 1D function?


You can increase the resolution by clicking on Create Plot instead of Plot and modifying the data set that is created by Create Plot.

[QUOTE] So it is not possible to have a higher resolution in the preview plot of a 1D function? [/QUOTE] You can increase the resolution by clicking on Create Plot instead of Plot and modifying the data set that is created by Create Plot.

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 12, 2016, 6:55 a.m. EST
Thank you very much for the hint. But it seems that the limit of the resolution in the plot is 1'000'000.

Also in the Study Settings where the range of the time can be chosen it seems that the smallest possible step is not sufficient for nanoseconds.

How could I solve this? Is it possible to run a simulation over 0.5s or 1s with resolution of 0.1ns?

Thanks in advance Gunnar!

Gabriel
Thank you very much for the hint. But it seems that the limit of the resolution in the plot is 1'000'000. Also in the Study Settings where the range of the time can be chosen it seems that the smallest possible step is not sufficient for nanoseconds. How could I solve this? Is it possible to run a simulation over 0.5s or 1s with resolution of 0.1ns? Thanks in advance Gunnar! Gabriel

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 12, 2016, 8:19 a.m. EST
Hi,

Yes, you can control the Times list for a time-dependent simulation to find a very short pulse by entering, for example,

range(0,1e8,4e8) range(5e8,1,5e8+9) range(5e8+10,1e7,1e9)

with ns (nanoseconds) as the time unit (see the attached screenshot, study_settings.png).

In the results part, the display resolution is 6 digits, so the time selection in a data set does not display the individual times very clearly when using such short time steps, but the COMSOL Multiphysics software uses 16-digit double precision floating-point values internally, and you can display the actual time steps using full precision by using a Global Evaluation node under Derived Values and evaluating the time t in a Table window where you click the Full Precision button (see the attached screenshot, full_precision.png).

As in other situations where you want to control the actual time steps taken by the solver, use manual time stepping by selecting Strict or Intermediate from the "Steps taken by solver" list.

Best regards,
Magnus Ringh, COMSOL
Hi, Yes, you can control the Times list for a time-dependent simulation to find a very short pulse by entering, for example, range(0,1e8,4e8) range(5e8,1,5e8+9) range(5e8+10,1e7,1e9) with ns (nanoseconds) as the time unit (see the attached screenshot, study_settings.png). In the results part, the display resolution is 6 digits, so the time selection in a data set does not display the individual times very clearly when using such short time steps, but the COMSOL Multiphysics software uses 16-digit double precision floating-point values internally, and you can display the actual time steps using full precision by using a Global Evaluation node under Derived Values and evaluating the time t in a Table window where you click the Full Precision button (see the attached screenshot, full_precision.png). As in other situations where you want to control the actual time steps taken by the solver, use manual time stepping by selecting Strict or Intermediate from the "Steps taken by solver" list. Best regards, Magnus Ringh, COMSOL


Walter Frei COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 12, 2016, 12:17 p.m. EST
Hello Gabriel,
For what you're describing, you will most likely also find this article helpful:
www.comsol.com/blogs/modeling-a-periodic-heat-load/
Best Regards,
Hello Gabriel, For what you're describing, you will most likely also find this article helpful: https://www.comsol.com/blogs/modeling-a-periodic-heat-load/ Best Regards,

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 20, 2016, 7:31 a.m. EST
Hi Magnus Ringh

Thank you very much for your answer! This was very helpful!
Can you quickly explain what this means exactly:

range(0,1e8,4e8) range(5e8,1,5e8+9) range(5e8+10,1e7,1e9)

I guess you cut it into 3 ranges:

The first from 0s to 0.4s with 0.1s steps.
The second from 0.5s to 0.000000009s with 1ns steps.
The third from 0.000000009s to 1s with 0.01s steps.

Is this interpretation right?

Best regards

Gabriel
Hi Magnus Ringh Thank you very much for your answer! This was very helpful! Can you quickly explain what this means exactly: range(0,1e8,4e8) range(5e8,1,5e8+9) range(5e8+10,1e7,1e9) I guess you cut it into 3 ranges: The first from 0s to 0.4s with 0.1s steps. The second from 0.5s to 0.000000009s with 1ns steps. The third from 0.000000009s to 1s with 0.01s steps. Is this interpretation right? Best regards Gabriel

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago Dec 20, 2016, 8:30 a.m. EST
Hi Gabriel,

Yes, COMSOL Multiphysics interprets the list of output times as a concatenated list of (normally, monotonically increasing) times when entered as several expressions in the Times field, so your interpretation is correct, but there are perhaps a couple of typos. The total list of times to output from the simulation will be:

First from 0 s to 0.4 s with 0.1 s steps; then (with an implicit extra 0.1 s step)
from 0.5 s to 0.500000009 s with 1 ns steps; and finally (with an implicit extra 1 ns step)
from 0.500000010 s to 1 s with 0.01 s steps.

Best regards,
Magnus Ringh, COMSOL
Hi Gabriel, Yes, COMSOL Multiphysics interprets the list of output times as a concatenated list of (normally, monotonically increasing) times when entered as several expressions in the Times field, so your interpretation is correct, but there are perhaps a couple of typos. The total list of times to output from the simulation will be: First from 0 s to 0.4 s with 0.1 s steps; then (with an implicit extra 0.1 s step) from 0.5 s to 0.500000009 s with 1 ns steps; and finally (with an implicit extra 1 ns step) from 0.500000010 s to 1 s with 0.01 s steps. Best regards, Magnus Ringh, COMSOL

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.