Reading values from file per timestep

Numerical methods and mathematical models of Elmer
Post Reply
hennig
Posts: 9
Joined: 12 Jun 2021, 20:51
Antispam: Yes

Reading values from file per timestep

Post by hennig »

Hello,

I'm working on a transient heat transfer simulation with a variable body force (joule loss in cables), depending on variable temperature and on a time dependent electric current. For that purpose I declared a MATC function "heatsource" in the SIF-file. It receives the temperature as an argument and the values of the time dependend current are read from a file "current.txt" and imported into the function. The reading from file is done with the MATC functions 'fopen' and 'fgets'.

The simulation runs with no error messages but the results do not show the expected temperature curve, following the current provided in "current.txt". Hence, my approach of reading the values from the file, does not appear to be correct.

Can somebody give me an advice, how I can implement the reading from file per timestep properly?

Best regards

- Carsten
Attachments
current.txt
(34 Bytes) Downloaded 100 times
case_varR.sif
(6.44 KiB) Downloaded 101 times
5x3xNAYY_fine.msh
(484.09 KiB) Downloaded 93 times
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Reading values from file per timestep

Post by kevinarden »

If current is a variable of time should it be
Heat Source = Variable time
Real MATC "heatsource(tx)"

and since the time step and intervals are known you could just use a table in the sif without reading a file
Heat Source = Variable Time
Real
1 0
2 10
3 30
4 50
5 90
6 135
7 90
8 50
9 30
10 10
11 0
12 0
end
hennig
Posts: 9
Joined: 12 Jun 2021, 20:51
Antispam: Yes

Re: Reading values from file per timestep

Post by hennig »

Dear Kenvinarden,

Thank you for proposal. I works but I'm wondering, how I can consider the temperature dependency of the joule loss in this case.

BR Carsten
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Reading values from file per timestep

Post by raback »

Hi Carsten,

I guess that in order to estimate how temperature affects Joule losses you should solve the Joule losses with temperature dependent electric conductivity and iterate the two equations until convergence. The MagnetoDynamics(3D & 2D separately) solvers should be able to do this.

-Peter
hennig
Posts: 9
Joined: 12 Jun 2021, 20:51
Antispam: Yes

Re: Reading values from file per timestep

Post by hennig »

Dear Peter,

First of all thank you very much for your feedback.

After some unsuccessful attempts with "MagnetoDynamics2D" I decided to use the "StatCurrentSolver" for my case. For this I first extended my model from a 2D to a 3D model.

In a second step I made two comparative calculations, the first with only "Heat Solver" and a manually calculated joule loss as body force, based on current (326 A), cross section (150 mm²), spec. electric resistance (0.03706e-6 Ohm m²/m) and mass of the conductor (150e-6 m² * 1 m * 2700 kg/m³).

The second calculation was done with "Heat Solver" and "StatCurrentSolver", basing on a constant electric conductivity of 1 /(0.03706e-6 Ohm m) and a controlled current of 326 A and the same mesh.

I expected similar results but in fact the heating with "StatCurrentSolver" was significantly lower. While the first calculation shows a warming up to a maximum of 343 K, the second calculation only leads to 312 K. To search for the cause, I gradually increased the controlled current until I reached a temperature of 343 K with the second calculation as well. This was the case with a controlled current of approx. 1.38 * 326 A. When I look at the detailed results of this calculation, I see a volume current of about 2.177e6. A/m³. If I multiply this with the volume of my conductor, I get more or less the current of the 326 A that I originally aimed for. There obviously is a mismatch between the 'current control' value and the actual volume current results.

I suspect that my understanding of 'current control' is wrong and I hope somebody can give a more detailed explanation.

Best regards

- Carsten

PS I unfortunately could not attach the .msh because of file size
Attachments
case_1st_sim.sif
(4.08 KiB) Downloaded 97 times
case _2nd_sim.sif
(4.04 KiB) Downloaded 86 times
hennig
Posts: 9
Joined: 12 Jun 2021, 20:51
Antispam: Yes

Re: Reading values from file per timestep

Post by hennig »

Dear Elmer community,

After overcoming a few hurdles, I was able to get my model to work. Now I am sharing it in case it is of interest to someone else as well.

The case is the calculation of the thermal heating of three parallel electric cables buried in soil and loaded with equal transient currents. A 24 h profile of the electric currents is saved in loadprofile.txt. The model considers the temperature dependency of the cable conductors electric conductivity and of the thermal resistivity of the soil.

The case is calculated with the modules StaticCurrentConduction and Heat Equation.

BR Carsten
Attachments
case.sif
(4.59 KiB) Downloaded 81 times
loadprofile.txt
(297 Bytes) Downloaded 73 times
case.msh.gz
(849.73 KiB) Downloaded 70 times
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Reading values from file per timestep

Post by raback »

Hi hennig,

Great that you got your problem solved with Elmer! Thank you for sharing it with others working with similar problems. Any next steps or is the end of your assignment?

-Peter
hennig
Posts: 9
Joined: 12 Jun 2021, 20:51
Antispam: Yes

Re: Reading values from file per timestep

Post by hennig »

Hi Peter,

Thank you very much again for your support. For now, the problems of this special use case are solved, but I,m working on other cases related to the heating of electric cables in air.

I will also share the model once it is up and running.

BR Carsten
Post Reply