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.

Imported data from txt file as initial value

Please login with a confirmed email address before reporting spam

Dear all,

I will need to import a thermal data generated by an independent simulation program, as txt file, in COMSOL model. To train myself, I have created a simple 2D COMSOL model (Attached: Import_txt_data.mph) where I solved a thermal distribution in a solid. I exported the thermal data, i.e. the Temperature distribution, in a speard sheet as txt file (Attached: Edep_test_2D.txt). Now, I tried to "re-import" the solution data to the same model (after disabling the previous boundary conditions). To do that, I have created an "interpolation" function, which I passed it (with two arguments) to an "Initial Values 2" as boundary condition. If no other boundary conditions added, I expect that by solving the model as it is, it must result in a thermal distribution identical to the feeded/imported data, right? This is not the case?

Would you please check the attached model and guid me where could be moy mistake?

Regards, Tamer



2 Replies Last Post Feb 20, 2020, 9:07 a.m. EST
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Feb 19, 2020, 4:19 p.m. EST
Updated: 4 years ago Feb 19, 2020, 5:25 p.m. EST

Hello Tamer,

The Initial Values node is used to specify the initial conditions when solving time-dependent problems, or to provide an initial guess to the solver for stationary problems, so it does not do what you think it does.

If you want to practice using an Interpolation function, you could in postprocessing subtract the "re-imported" data from the solution (i.e. plot T-int1(x[1/m],y[1/m])), and you'll get zero within numerical accuracy.

Best,

Jeff

-------------------
Jeff Hiller
Hello Tamer, The Initial Values node is used to specify the initial conditions when solving time-dependent problems, or to provide an initial guess to the solver for stationary problems, so it does not do what you think it does. If you want to practice using an Interpolation function, you could in postprocessing subtract the "re-imported" data from the solution (i.e. plot T-int1(x[1/m],y[1/m])), and you'll get zero within numerical accuracy. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 4 years ago Feb 20, 2020, 9:07 a.m. EST

Hi Jeff,

At first, my problem is solved (thanks so much). I found that I was passing wrong arguments to the interpolition function when it was called at the "Initial Values" node ==> it must be int1(x[1/m], y[1/m])). Moreover, I changed the study case to Time dependent instead of the stationary solver. Now, for short time steps, I can see the development of the solution, and at time=0 s, the thermal distribution of the system is what I expected (identical to the distribution of the intital value.) As for what I thought, it was a wrong expectation/guess from me! For whatever reason that came to my mind at that time, I thought that if I put a closed/isolated system in some "thermal" intital condition (which is the imported T distribution from the txt file, in my case) it gonna stay stable, i.e. preserve its intital condition, forever. I forgot a very simple physics rule, that the "isolated" system will try to reach thermal equilibrium among its volume! So, solving for stationary case is not the right choice then!

Thanks once again, Tamer

Hi Jeff, At first, my problem is solved (thanks so much). I found that I was passing wrong arguments to the interpolition function when it was called at the "Initial Values" node ==> it must be int1(x[1/m], y[1/m])). Moreover, I changed the study case to Time dependent instead of the stationary solver. Now, for short time steps, I can see the development of the solution, and at time=0 s, the thermal distribution of the system is what I expected (identical to the distribution of the intital value.) As for what I thought, it was a wrong expectation/guess from me! For whatever reason that came to my mind at that time, I thought that if I put a closed/isolated system in some "thermal" intital condition (which is the imported T distribution from the txt file, in my case) it gonna stay stable, i.e. preserve its intital condition, forever. I forgot a very simple physics rule, that the "isolated" system will try to reach thermal equilibrium among its volume! So, solving for stationary case is not the right choice then! Thanks once again, Tamer

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.