Open tingyang2004 opened 1 year ago
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.
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.
The three columns of max_dT_Array in the standard output are iteration (its), dt, and dT_max, respectively.
In the code every iteration is using a different initial temperature and temperatureDot. This isn't what you want right?
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.
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.
How do I create and temperatureDot0 for the initial conditions?
The initial values of temperatureDot0 should always be zero. So I suggest
using temperatureDot0.data[:] = 0
in the loop.
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.
At an earlier step, the temperature difference does reduce with reducing dt.
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.
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.
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.
OK, I will do that.
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 Could you re-invite me to the repo - unfortunately the invitation expired. opps
re-invited @julesghub
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:
output: