Quantcast
Channel: Latest Discussions - COMSOL Forums
Viewing all articles
Browse latest Browse all 2194

Initial condition drift when sequencing COMSOL through Matlab

$
0
0
Hello,
I’ll start with my question and then explain the problem which gave rise to it. Is there a way to insure that the initial temperature condition in a transient heat transfer problem is the same as the results given at time = 0? I have noticed in running Comsol that in transient heat transfer problems, the initial condition doesn’t always match the result given at 0 s. The difference is usually negligible. However, I have encountered a situation, where this problem is not negligible.

I am using a Matlab script to make multiple runs of a Comsol 5.1 model for heating in a microwave field. The script divides the total heating time into steps, taking the temperature distribution at the end of the previous step and using it as an initial condition for the next. I change the geometry in the script between steps, but to make sure everything is operating correctly, I tested this approach WITHOUT the geometry change. So, regardless of the number of steps, the results of running Comsol step-wise via Matlab and running Comsol directly, should be the same. To the contrary, I have found that the more steps taken, the more the results diverge. And counterintuitively (at least for me), I saw that the finer the mesh the greater the divergence as well.

The model is run for a total of 30 seconds and the final average, maximum and minimum temperatures of the heated domain are examined. I run the Matlab script with 1, 2, 3 or 10 steps, corresponding to time step intervals of 30, 15, 10 and 3 seconds. Naturally, the results match when the script is run with 1 step. I’ve attached an Excel workbook showing the comparison with other steps. The last tab (30 s temperatures), shows a table of the results. The other tabs show graphs where the Matlab results are individual points, while the Comsol direct results are shown as smooth curves. All three exhibit increasing deviations with increasing step number, though the global average and global minimum temperatures show much smaller deviations than the global maximum temperatures.
Does anyone know of a way to force Comsol to honor initial conditions?
Thanks,
Greg
P.S. In case it’s important, I generate the initial condition for one step by using MPHEVAL in Matlab to evaluate the temperatures in the heating domain from the previous step. I then write the temperatures and corresponding nodal coordinates to an Excel file that the next Comsol step uses as the initial condition via the interpolation function.

Viewing all articles
Browse latest Browse all 2194

Trending Articles