Total dynamic head measurement
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 12
- Joined: Fri Feb 23, 2018 2:28 pm
Total dynamic head measurement
Dear experts,
I'm currently simulating a flow through a centrifugal pump. I would like to compute the difference of total pressure between the outlet and the inlets (in my case there are two inlets).
The total pressure is defined by TotalPressure=Pressure+0.5*density*mag(Velocity)²
Is it possible to compute such a variable directly in Code_Saturne or should I use Paraview ?
Another question : is it possible to compute the average value of variable (e.g. pressure) over a boundary surface (e.g. inlet) ?
Please find enclosed a picture of the pump.
Thank you in advance for your answers,
Valentin
I'm currently simulating a flow through a centrifugal pump. I would like to compute the difference of total pressure between the outlet and the inlets (in my case there are two inlets).
The total pressure is defined by TotalPressure=Pressure+0.5*density*mag(Velocity)²
Is it possible to compute such a variable directly in Code_Saturne or should I use Paraview ?
Another question : is it possible to compute the average value of variable (e.g. pressure) over a boundary surface (e.g. inlet) ?
Please find enclosed a picture of the pump.
Thank you in advance for your answers,
Valentin
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Total dynamic head measurement
Hello,
All of this should be possible using the cs_user_extra_operations function.
I recommend checking the user examples in the Doxygen documentation to find similar postprocessing operations which you could adapt.
Regards,
Yvan
All of this should be possible using the cs_user_extra_operations function.
I recommend checking the user examples in the Doxygen documentation to find similar postprocessing operations which you could adapt.
Regards,
Yvan
-
- Posts: 12
- Joined: Fri Feb 23, 2018 2:28 pm
Re: Total dynamic head measurement
Dear Yvan,
Thank you for your prompt answer, I'll check this out and try to compute it.
Regards,
Valentin
Thank you for your prompt answer, I'll check this out and try to compute it.
Regards,
Valentin
-
- Posts: 12
- Joined: Fri Feb 23, 2018 2:28 pm
Re: Total dynamic head measurement
Dear Yvan,
As you told us we built a file following the cs_user_extra_operations_turbomachinery.c in the example directory.
We only kept the headers and the calculation of turbomachinery head. We then uploaded the file into the SRC folder and ran the calculation through the Code_Saturne GUI.
We face the following error : " .\cs_solver.exe ended before calling init and may have crashed. exit code 0" so we thought that our extra operation file was not good.
Then we went to the RESU Directory and tried to run the process through run_solver.bat. In this case there is no problem and the turbomachinery head is calculated and displayed within the listing file.
We are wondering if this calculation is right or not because of the error in the GUI. Have you ever faced this situation ?
Thanks a lot,
Valentin
As you told us we built a file following the cs_user_extra_operations_turbomachinery.c in the example directory.
We only kept the headers and the calculation of turbomachinery head. We then uploaded the file into the SRC folder and ran the calculation through the Code_Saturne GUI.
We face the following error : " .\cs_solver.exe ended before calling init and may have crashed. exit code 0" so we thought that our extra operation file was not good.
Then we went to the RESU Directory and tried to run the process through run_solver.bat. In this case there is no problem and the turbomachinery head is calculated and displayed within the listing file.
We are wondering if this calculation is right or not because of the error in the GUI. Have you ever faced this situation ?
Thanks a lot,
Valentin
-
- Posts: 12
- Joined: Fri Feb 23, 2018 2:28 pm
Re: Total dynamic head measurement
I found out the reason why the programm was crashing before it started : it was coming from my anti-virus (Avast) which was blocking the calculation. After disabling it, the calculation runs without any problem.
Best regards,
Valentin
Best regards,
Valentin
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Total dynamic head measurement
Hello,
Thanks for the update. In any case, for users consulting this thread, running the "SCRIPTS/runcase" file directly should lead to the same results as running through the GUI, which runs this same file.
So when running through the GUI fails, running the SCRIPTS/runcase.bat may be an alternative.
When a script runs, there are 3 stages:
- initialization (with 2 sub-stages: copy data to RESU, compile/link users functions, and then import the mesh)
- execution
- cleanup
Running the ./run_solver.bat in a RESU directory is only possible if the first stage has been run (otherwise runcase.bat is not even created yet), and runs the second stage
So running the run_solver.bat file directly will not do the cleanup phase (remove cs_solver.exe) at the en of the computation, but otherwise will lead to exactly the same results. This may be a less practical but viable solution if you prefer not to disable your anti-virus (or you cannot have sufficiently fine settings to allow just the execution of Code_Saturne).
Regards,
Yvan
Thanks for the update. In any case, for users consulting this thread, running the "SCRIPTS/runcase" file directly should lead to the same results as running through the GUI, which runs this same file.
So when running through the GUI fails, running the SCRIPTS/runcase.bat may be an alternative.
When a script runs, there are 3 stages:
- initialization (with 2 sub-stages: copy data to RESU, compile/link users functions, and then import the mesh)
- execution
- cleanup
Running the ./run_solver.bat in a RESU directory is only possible if the first stage has been run (otherwise runcase.bat is not even created yet), and runs the second stage
So running the run_solver.bat file directly will not do the cleanup phase (remove cs_solver.exe) at the en of the computation, but otherwise will lead to exactly the same results. This may be a less practical but viable solution if you prefer not to disable your anti-virus (or you cannot have sufficiently fine settings to allow just the execution of Code_Saturne).
Regards,
Yvan
-
- Posts: 12
- Joined: Fri Feb 23, 2018 2:28 pm
Re: Total dynamic head measurement
Hello,
Thank you very much for all those precious informations.
We have managed to print coherent total head results (in regards to the results we obtained on previous ANSYS simulations) into the listing and we would like to extract those numbers into a CSV file for each time step. Do you know if there is a way to do that ?
Should we directly write some C++ code within the extra_user_operation file? Is there a code or a software that could extract from the listing ?
Regards,
Valentin
Thank you very much for all those precious informations.
We have managed to print coherent total head results (in regards to the results we obtained on previous ANSYS simulations) into the listing and we would like to extract those numbers into a CSV file for each time step. Do you know if there is a way to do that ?
Should we directly write some C++ code within the extra_user_operation file? Is there a code or a software that could extract from the listing ?
Regards,
Valentin
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Total dynamic head measurement
Hello,
Where you print data into the listing, you could as well also print it to another file of your choice, which makes extracting data simpler.
Otherwise, based on the "listing", using grep (or Awk or Python in more complex cases) can help you extract things. So in the data you print, adding specific charcter strings on the same lines to make filtering easier is recommended.
Best regards,
Yvan
Where you print data into the listing, you could as well also print it to another file of your choice, which makes extracting data simpler.
Otherwise, based on the "listing", using grep (or Awk or Python in more complex cases) can help you extract things. So in the data you print, adding specific charcter strings on the same lines to make filtering easier is recommended.
Best regards,
Yvan
-
- Posts: 12
- Joined: Fri Feb 23, 2018 2:28 pm
Re: Total dynamic head measurement
Hello,
Thank you for your answers.
Is it within the cs_extra_user_operation file or somewhere esle ?
Please find attached our extra user operation file.
Regards,
Valentin
Thank you for your answers.
We would like to do this precise operation but we are wondering how to do it : which function should we use and where should we write it in order to print these informations in another file (e.g .csv)?"Where you print data into the listing, you could as well also print it to another file of your choice, which makes extracting data simpler."
Is it within the cs_extra_user_operation file or somewhere esle ?
Please find attached our extra user operation file.
Regards,
Valentin
- Attachments
-
- cs_user_extra_operations.c
- (5.11 KiB) Downloaded 268 times
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Total dynamic head measurement
Hello,
Yes, you can do this in your cs_user_extra_operations.c file.
Just open a file of your choice on the first time step:
Then add a fprint statement (similar to your current bft_printf output, your choice of formatting) using the opened file (f); at each time step.
And finally close the file at the end:
Regards,
Yvan
Yes, you can do this in your cs_user_extra_operations.c file.
Just open a file of your choice on the first time step:
Code: Select all
static FILE *f = NULL;
if (cs_glob_time_step->nt_cur == cs_glob_time_step->nt_prev + 1) {
f = fopen("turbomachinery_characteristics.txt", "w");
}
And finally close the file at the end:
Code: Select all
if (cs_glob_time_step->nt_cur == cs_glob_time_step->nt_max) {
fclose(f);
}
Yvan