Question about the example mesh1D.py #949
-
I have some questions in examples/diffusion/mesh1D.py about using The example uses a while loop ( To better show my confusion, I wrote a code for comparison in the attachment. In this code, phi[0] stores the values that are calculated by using the while loop. And phi[1] stores the values that are calculated by setting the sweeping value of 5 per step. I used a total step number of 1000 which is a relatively large number. (I can see that the plot of phi[1] is indeed identical to the plot of the steady-state result in the example which shows the consistency between the steady-state result and transient-state result.) I am very confused as to why the while loop does not work for the transient-state case. I thought the while loop only makes the results more accurate. Can anyone point out where I got it wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You need to reset the residual to something big at the beginning of every sweep loop, otherwise the res1 = 1e+10
while res1 > 1e-6:
res1 = eq_t1.sweep(var=phi[0],
dt=timeStepDuration) |
Beta Was this translation helpful? Give feedback.
You need to reset the residual to something big at the beginning of every sweep loop, otherwise the
while
exits without doing anything: