Closed manukamin closed 1 year ago
Hi Manukamin,
Can you clarify what you are exactly looking for when you say RMS quantities?
If you are looking for the residuals summed over the entire domain, you need to run the simulation with the --report-residuals command line flag. This will write a file into config/JOBNAME-residuals.txt that you can use to judge the overall time convergence of your simulation.
If you want to plot the residuals in each cell using paraview, you need to put the following lines into your .lua script: config.new_flow_format = true config.save_residual_values = true config.flow_format = "eilmer4text"
then run the simulation and post process it with: $ e4shared --post --job=JOBNAME --vtk-xml --tindx-plot=last --plotTag="residual"
If you are looking for the Root-Mean-Squared average of the fluctuating quantities, u' = RMS(mean(u) - u), then that's a more difficult thing to compute and you'll need some custom code for it.
Please let me know if that help.
Hi Nick,
Yes, I meant Root-Mean-Squared quantities. I am interested in looking at higher order statistics for a particular case.
Now, when I switch on time averaging, using the command config.do_flow_average = true, and then run the code, Eilmer tracks all field variables, and therefore I am able to look at mean quantities after post processing. However, if I am interested in looking at say, u_rms, I would calculate it as u_rms = sqrt(mean(U^2)- [mean(U)]^2). This would mean that I would need to track the value of the new custom variable U^2 at all locations and at all time steps, so that I can have this value being written out into the .vtk file after the post-processing step.
So, in summary, I suppose this would come down to the following question : is there an easy way to define custom variables, and have those variables saved into the data file at the end of the run?
Kindly let me know. This will make my life a little easy when I make necessary changes to the source code.
@Whyborn thinks he has a good idea for this.
It is indirectly possible to compute the RMS of a direct or derived quantity in Eilmer. The "easiest" way is to use the Fourier transform, but that comes with some caveats. The in situ DFT is activated using the config options:
DFT_step_interval is how many steps between incrementing the Fourier coefficients, and DFT_n_modes is the number of Fourier modes captured. N x M must be the total number of steps. So we don't have a way of sampling single variables at specific time intervals, unless you also choose a fixed time step.
To actually choose the variables tracked, this is actually done in the celldata.d file. Lines 1105-1109 show the variables that are tracked. The default quantities being tracked by default are pressure, vel.x and vel.y. It is not so trivial to add derived quantities- you will have to create a custom VariableAccess object that computes the desired quantity. Look at the GenCellVariableAccess template for an idea. All you will need is to fill in the get() method, the set() and description() methods aren't necessary.
The format written will depend on which flow format you specify. I use config.new_flow_format=true and config.flow_format = "eilmer4binary", in which case the data is written to a zip archive at CellData/DFT/t****. Each block of data contains the Fourier components for each mode at each frequency i.e. RealPartCell0Mode0 ImagPartCell0Mode0 RealPartCell0Mode1 ImagPartCell0Mode1 ... RealPartCell1Mode0 ImagPartCell1Mode0.
There is then a direct conversion from the Fourier coefficients to the RMS.
tl;dr Yes, it is indirectly possible but not trivial.
Thanks a lot for the suggestion. So, it is good to know that there is a pre-built method to obtain the RMS values, although it is in an indirect fashion.
I see that using the command "e4shared --post --job=back --tindx-plot=last --vtk-xml --plotTag="DFT" reads the Fourier coefficients data stored in the CellData folder, and writes it out into a .vtk file. Am I correct?
Finally, you say that there is a direct conversion from Fourier coefficients to the RMS. Is this present as a part of the source code? If so, can you please provide details of where I can find it?
Yes that is correct. The function isn't part of the code, but you can easily find it online, for example here https://planetmath.org/rmsvalueofthefourierseries1
After the code has run and post processing step is completed to write out the data, I do not see any RMS quantities being written out into the .vtk file. I did not find any option to add these as extra variables using the "add-vars" command either. A quick browse through the source code seemed to suggest that RMS quantities are not being tracked. Am I correct? Or is there a way to make the code write out the RMS quantities, such as u',v',w',T',P' ?