underworld2 icon indicating copy to clipboard operation
underworld2 copied to clipboard

Temperature difference between two steps does not decrease with reducing step interval

Open tingyang2004 opened this issue 2 years ago • 16 comments

Hi all,

I ran into a strange issue when I tried to track the temperature evolution of a continental rifting model. As shown in the script below, I ran the advection-diffusion equation (SUPG) five times with the same velocity and initial temperature fields, as well as the same temperature's time derivative, each time with dt being 0.5 times the previous one. I expected the maximum temperature difference from the initial temperature field to decrease with reducing dt, but the output (elements of max_dT_Array) does not show this trend. Do you know why this happens? Thanks a lot.

Ting

Script to calculate temperature evolution and record maximum temperature difference: image

output: image

tingyang2004 avatar Feb 24 '23 08:02 tingyang2004

Hi Ting, I think the following line is the problem if its == dT_maxIts - 1:

It will only fire when its == 4, which is what your output shows.

julesghub avatar Feb 27 '23 23:02 julesghub

Thanks, Julian. You are right, this coding mistake occurred when I tried to simplify the original script. However, this 'temperature difference does not decrease with reducing step interval' issue persists even when this coding mistake is corrected. See screenshots below.

image

image

tingyang2004 avatar Feb 28 '23 00:02 tingyang2004

The three columns of max_dT_Array in the standard output are iteration (its), dt, and dT_max, respectively.

tingyang2004 avatar Feb 28 '23 00:02 tingyang2004

In the code every iteration is using a different initial temperature and temperatureDot. This isn't what you want right?

julesghub avatar Feb 28 '23 01:02 julesghub

I thought it is the same initial temperature and temperatureDot. Since I used temperatureField.data[:] = T_old.data[:] temperatureDotField.data[:] = Tdot_old.data[:]

to reset the temperature after each iteration.

tingyang2004 avatar Feb 28 '23 01:02 tingyang2004

oh I see. Why don't you create fields temperature0 and temperatureDot0 for the initial conditions. Just to ensure you don't have to write over the numpy arrays.

julesghub avatar Feb 28 '23 04:02 julesghub

How do I create and temperatureDot0 for the initial conditions?

tingyang2004 avatar Feb 28 '23 04:02 tingyang2004

The initial values of temperatureDot0 should always be zero. So I suggest using temperatureDot0.data[:] = 0 in the loop.

julesghub avatar Feb 28 '23 04:02 julesghub

temperature reset in the while loop is changed as below: temperatureField.data[:] = T_old.data[:] temperatureDotField.data[:] = 0.0 #Tdot_old.data[:]

The temperature difference is as below, it does not show any dependence on dt. image

At an earlier step, the temperature difference does reduce with reducing dt. image

tingyang2004 avatar Feb 28 '23 05:02 tingyang2004

Instead of doing T_old = temperatureField.copy() Can you make T_old a new mesh variable, i.e. T_old = mesh.add_variable(....)

I think the copy() is not a 'deep' copy and is potentially causing the issue.

julesghub avatar Feb 28 '23 23:02 julesghub

creating a new mesh variable for T_old does not make any difference. Values of the derived dT_max are exactly the same as before.

tingyang2004 avatar Mar 01 '23 01:03 tingyang2004

Can you upload a version of the model file and I can look at it more closely. The easiest way would be to make a private github repo and invite me to it. Remember to let me know the version of the code you're using.

julesghub avatar Mar 01 '23 04:03 julesghub

OK, I will do that.

tingyang2004 avatar Mar 01 '23 04:03 tingyang2004

Hi Julian, I have invited you to my temporal repository. The swarm file exceeds the 25 Mb limit, so I shared it using my net-disk. You can download it through the link in README.md. Thanks!

tingyang2004 avatar Mar 01 '23 06:03 tingyang2004

@tingyang2004 Could you re-invite me to the repo - unfortunately the invitation expired. opps

julesghub avatar Mar 09 '23 22:03 julesghub

re-invited @julesghub

tingyang2004 avatar Mar 10 '23 00:03 tingyang2004