How to plot residuals in Windows?
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
How to plot residuals in Windows?
Hello,
I would like to compare the convergence of different methods, so plotting the Norm. residual of the file 'listing' should be the most intuitive. And I'am using Windows, Code Saturne 4.0.6.
Best Regards
XING Jian
I would like to compare the convergence of different methods, so plotting the Norm. residual of the file 'listing' should be the most intuitive. And I'am using Windows, Code Saturne 4.0.6.
Best Regards
XING Jian
-
- Posts: 4169
- Joined: Mon Feb 20, 2012 3:25 pm
Re: How to plot residuals in Windows?
Hello,
In version 4.0, you need to extract the residuals from the "listing" file, or extract them from internal variables in cs_user_extra_operations and output them to a file.
In version 5.0, they are already output in a specific residuals.csv file.
Regard,
Yvan
In version 4.0, you need to extract the residuals from the "listing" file, or extract them from internal variables in cs_user_extra_operations and output them to a file.
In version 5.0, they are already output in a specific residuals.csv file.
Regard,
Yvan
Re: How to plot residuals in Windows?
Hello Yvan,
I Am grateful for your response.
Here is my xml.file and my listing, why the change of residuals are very small, but the derive is very large?
Especially the omega, its residual is small enough, but its derive is too large. Can i treat it as a convergence?
And the density, viscosity and conductivity will change with temperature, but not with time, the temperature should be stabilized in the end, in this case, I should use steady flow or unsteady flow?
In the whole system, the highest Reynolds number is 7000, so I choose k-w SST but not k-e, am I right?
In the mesh, 200 thousand cells are tetrahedral, and 400 thousand cells are prismy, normally, in the part Gradient calculation method of Global parameters, I should use 'Least squares method over partial extended cell neighborhood', but Once I do like this, the calculation will fail, and there is 'floating point exception' in the file of error. So I can only use 'Least squares method over extended cell neighborhood'.
At last, I have question about Reference time step, if I use a large value like 0.1 or 0.01, the calculation will be divergent, if I use a small value like 0.0001 or 0.00001, but it will be not convergent like this... And if I change to steady flow, when I use 0.00001, there will have 'floating point exception', now I am using 0.0001, it's not convergent neither.
Please help me, thank you.
The file listing is too large that I can't upload all, so I copy a part of it.
Best Regards
XING Jian
I Am grateful for your response.
Here is my xml.file and my listing, why the change of residuals are very small, but the derive is very large?
Especially the omega, its residual is small enough, but its derive is too large. Can i treat it as a convergence?
And the density, viscosity and conductivity will change with temperature, but not with time, the temperature should be stabilized in the end, in this case, I should use steady flow or unsteady flow?
In the whole system, the highest Reynolds number is 7000, so I choose k-w SST but not k-e, am I right?
In the mesh, 200 thousand cells are tetrahedral, and 400 thousand cells are prismy, normally, in the part Gradient calculation method of Global parameters, I should use 'Least squares method over partial extended cell neighborhood', but Once I do like this, the calculation will fail, and there is 'floating point exception' in the file of error. So I can only use 'Least squares method over extended cell neighborhood'.
At last, I have question about Reference time step, if I use a large value like 0.1 or 0.01, the calculation will be divergent, if I use a small value like 0.0001 or 0.00001, but it will be not convergent like this... And if I change to steady flow, when I use 0.00001, there will have 'floating point exception', now I am using 0.0001, it's not convergent neither.
Please help me, thank you.
The file listing is too large that I can't upload all, so I copy a part of it.
Best Regards
XING Jian
- Attachments
-
- listing.txt
- (321.04 KiB) Downloaded 331 times
-
- 1_Unsteady_Simplec.xml
- (11 KiB) Downloaded 339 times
-
- Posts: 4169
- Joined: Mon Feb 20, 2012 3:25 pm
Re: How to plot residuals in Windows?
Hello,
It is quite frequent that computations fluctuate slightly around a mean value even when "converged". Some computational options such as adding more upwinding to the solution scheme tend to stabilize it, at the expense of precision and fidelity, so I would not recommend those.
The best is probably to use probes in addition to residuals. Some addtional recommendations may be found here: http://code-saturne.org/cms/sites/defau ... meters.pdf.
Best regards,
Yvan
It is quite frequent that computations fluctuate slightly around a mean value even when "converged". Some computational options such as adding more upwinding to the solution scheme tend to stabilize it, at the expense of precision and fidelity, so I would not recommend those.
The best is probably to use probes in addition to residuals. Some addtional recommendations may be found here: http://code-saturne.org/cms/sites/defau ... meters.pdf.
Best regards,
Yvan
Re: How to plot residuals in Windows?
Hello Yvan,
Thank you for your response.
I have set up 14 monitoring points where I am interested. Here are the Pressure, Temperature, and Velocity(X,Y,Z), I have set up the density of air is constant. Pressure and Temperature are very steady.
But Velocity is very unstable. I have calculated 25,000 iterations. Can i say it converges?
Best Regards
XING Jian
Thank you for your response.
I have set up 14 monitoring points where I am interested. Here are the Pressure, Temperature, and Velocity(X,Y,Z), I have set up the density of air is constant. Pressure and Temperature are very steady.
But Velocity is very unstable. I have calculated 25,000 iterations. Can i say it converges?
Best Regards
XING Jian
Re: How to plot residuals in Windows?
Here are Velocity Y and Velocity Z:
XING Jian
Best RegardsXING Jian
-
- Posts: 4169
- Joined: Mon Feb 20, 2012 3:25 pm
Re: How to plot residuals in Windows?
Hello,
The code does seem to fluctuate (with large fluctuations) around a median value.
You may output time averages (see postprocessing options) to obtain average value, but there may be an issue with your mesh quality or time step. What does your "listing" look like ?
Regards,
Yvan
The code does seem to fluctuate (with large fluctuations) around a median value.
You may output time averages (see postprocessing options) to obtain average value, but there may be an issue with your mesh quality or time step. What does your "listing" look like ?
Regards,
Yvan
Re: How to plot residuals in Windows?
Hello Yvan,
Thank you so much, you helped me a lot.
In fact, I want to simulate a dry nozzle, like this: Hot air is sprayed onto the cardboard through the inlet and nozzle. I want to observe their heat exchange and heat distribution.
I calculated the maximum Reynolds number is only 7000, not high Reynolds number, so I did not use k-e model, I chose the k-w SST model. So I have done boundary layer for all the boundary conditions of the mesh(The left and right sides are Periodic Boundaries, so I did not do the boundary layer), Y + is always less than 1. Here is the mesh: Because I want to observe the results after the stabilization, so I chose a steady flow.
And in order to get the convergence result, all the parameters of the air (density, viscosity ...) are constant, and I also use the first order upwind.
The mesh has 600,000 cells, 200,000 cells are tetrahedrons, 400,000 cells are prisms, so I chose the 'Least squares method over extended cell neighborhood' algorithm.
I tried a lot of reference time step: 0.0001,0.00001,0.000001, but no matter how long the calculation, the results are not convergence. The residuals are very small, but the derive is very large,like:
So I realized that there might always be unstable vortices on both sides of the nozzle, like this:
And it would never converge, and I would focus on the velocity of the nozzle and the distribution of heat and velocity above the cardboard. Once they are stable, I think the whole system is stable. After all the other places I do not care.
So I have set up the monitoring points where I am interested, Just as I uploaded the picture before, the temperature and pressure are very stable, but the velocity is still unstable, no matter how much I calculate. Fortunately, the flow of inlet and outlet have always been balanced.
Thank you for your help, really grateful.
Best Regards
XING Jian
Thank you so much, you helped me a lot.
In fact, I want to simulate a dry nozzle, like this: Hot air is sprayed onto the cardboard through the inlet and nozzle. I want to observe their heat exchange and heat distribution.
I calculated the maximum Reynolds number is only 7000, not high Reynolds number, so I did not use k-e model, I chose the k-w SST model. So I have done boundary layer for all the boundary conditions of the mesh(The left and right sides are Periodic Boundaries, so I did not do the boundary layer), Y + is always less than 1. Here is the mesh: Because I want to observe the results after the stabilization, so I chose a steady flow.
And in order to get the convergence result, all the parameters of the air (density, viscosity ...) are constant, and I also use the first order upwind.
The mesh has 600,000 cells, 200,000 cells are tetrahedrons, 400,000 cells are prisms, so I chose the 'Least squares method over extended cell neighborhood' algorithm.
I tried a lot of reference time step: 0.0001,0.00001,0.000001, but no matter how long the calculation, the results are not convergence. The residuals are very small, but the derive is very large,like:
Code: Select all
TIME STEP NUMBER 24950:
Variable Rhs norm N_iter Norm. residual derive Time residual
-----------------------------------------------------------------------------
c Velocity 0.70119E-01 20 0.19053E-01 0.84829E+02 0.19170E+03
c Velocity[X] 0.29942E+02
c Velocity[Y] 0.15829E+02
c Velocity[Z] 0.39057E+02
c Pressure 0.43680E-04 171 0.14566E-02 0.10286E+00 0.66475E+02
c k 0.12518E-01 29 0.32353E-03 0.83928E+01 0.18412E+03
c omega 0.55393E+08 1 0.12960E-07 0.57549E+09 0.79241E+00
c TempK 0.24970E+04 7 0.41930E-03 0.10416E+03 0.49443E+01
After 50 time step, time step is 0.000001
TIME STEP NUMBER 250000:
Variable Rhs norm N_iter Norm. residual derive Time residual
-----------------------------------------------------------------------------
c Velocity 0.67870E-01 24 0.18901E-01 0.74759E+02 0.18846E+03
c Velocity[X] 0.31756E+02
c Velocity[Y] 0.13426E+02
c Velocity[Z] 0.29577E+02
c Pressure 0.43646E-04 193 0.13174E-02 0.10876E+00 0.90523E+02
c k 0.14408E-01 33 0.44491E-03 0.10443E+02 0.16768E+03
c omega 0.55393E+08 1 0.12462E-07 0.49886E+09 0.70740E+00
c TempK 0.24497E+04 7 0.43402E-03 0.11081E+03 0.49060E+01
So I have set up the monitoring points where I am interested, Just as I uploaded the picture before, the temperature and pressure are very stable, but the velocity is still unstable, no matter how much I calculate. Fortunately, the flow of inlet and outlet have always been balanced.
Thank you for your help, really grateful.
Best Regards
XING Jian
Last edited by xingjian on Thu Jun 08, 2017 9:23 am, edited 1 time in total.
Re: How to plot residuals in Windows?
Hello Yvan,
Here is listing, it is too large, so I compressed it into Zip.
Thank you so much.
Best Regards
XING Jian
Here is listing, it is too large, so I compressed it into Zip.
Thank you so much.
Best Regards
XING Jian
- Attachments
-
- listing.zip
- (626.98 KiB) Downloaded 321 times
-
- Posts: 4169
- Joined: Mon Feb 20, 2012 3:25 pm
Re: How to plot residuals in Windows?
Hello,
The CFL number is OK, as it should be, since you are using a local time step ("steady" computation).
The finite volume scheme with incompressible model ensure the input and ouput flow match to within the linear solver precision. But not that the results don't fluctuate a bit...
What does your mesh look like ? A mediocre quality mesh (or simply some tetrahedra or similar cells) may be a bit less stable.
Also, it could be interesting to restart you computation with an unsteady flow option. You need to adjust the time step, but I would trywith 1 e-4 or 5 e-5 if the CFL is to large based on the local time step average in your steady calculation. Then check if the computation stabilizes better.
Regards,
Yvan
The CFL number is OK, as it should be, since you are using a local time step ("steady" computation).
The finite volume scheme with incompressible model ensure the input and ouput flow match to within the linear solver precision. But not that the results don't fluctuate a bit...
What does your mesh look like ? A mediocre quality mesh (or simply some tetrahedra or similar cells) may be a bit less stable.
Also, it could be interesting to restart you computation with an unsteady flow option. You need to adjust the time step, but I would trywith 1 e-4 or 5 e-5 if the CFL is to large based on the local time step average in your steady calculation. Then check if the computation stabilizes better.
Regards,
Yvan