-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flow rates postprocessing #1092
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments regarding formatting.
source/solvers/navier_stokes_base.cc
Outdated
@@ -1424,13 +1437,13 @@ NavierStokesBase<dim, VectorType, DofsType>::postprocess_fd(bool firstIter) | |||
simulation_parameters.post_processing.flow_rate_output_name + | |||
".dat"; | |||
std::ofstream output(filename.c_str()); | |||
flow_rate_table.set_precision("time", 12); | |||
flow_rate_table.set_precision("time", 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is a good idea. For the other variables we use 12 significant digits. Since this is always written to a data file, I think it's a much better idea to keep as many digits as possible. Using scientific notation is a good idea however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I misunderstood. Here is it the one you are printing on the screen or the one your are printing on the data file? For the screen on e I think 4 digit scientific is ok. For the data file one, I think it's not a good idea to print just 4 digits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For log outputted to the terminal you can also youse simulation_control->get_log_precision() which is meant exactly for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will keep the scientific notation but with 12 digits for the data file. For the screen display I'll keep the way it is coded now which uses the get_log_precision() method
source/solvers/navier_stokes_base.cc
Outdated
@@ -1424,13 +1437,13 @@ NavierStokesBase<dim, VectorType, DofsType>::postprocess_fd(bool firstIter) | |||
simulation_parameters.post_processing.flow_rate_output_name + | |||
".dat"; | |||
std::ofstream output(filename.c_str()); | |||
flow_rate_table.set_precision("time", 12); | |||
flow_rate_table.set_precision("time", 4); | |||
for (unsigned int boundary_id = 0; | |||
boundary_id < simulation_parameters.boundary_conditions.size; | |||
++boundary_id) | |||
flow_rate_table.set_precision("flow-rate-" + | |||
std::to_string(boundary_id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Utilities::int_to_string instead
and set the padding manually to 2, because we will never have more than 99 boundary conditions (it makes no sense)
@PierreLaurentinCS please also suggest two other reviewers |
22d153f
to
8373fff
Compare
@PierreLaurentinCS Can you rebase for the changelog? Then I will be able to merge |
4fd57ea
to
ea65307
Compare
Description of the problem The previous flow rate post processing tool would add a line to the .dat file for each defined boundary (in the boundary condition subsection of the .prm file) for every time iteration. This is not the expected output as one would expect a single line to be added for each time step with the flow rates of every boundary. Also, the values of the flow rates were added with a 12 digits precision. Instead, a 4 digits precision in scientific notation was chosen, which seems like a reasonable precision. Description of the solution The value of time is now added outside of the loop on the boundary conditions. Comments At the moment there is no unified output format : with/without scientific notation, different numbers of digits. This could be the work of a future PR. Former-commit-id: 79f3d07
Description of the problem The previous flow rate post processing tool would add a line to the .dat file for each defined boundary (in the boundary condition subsection of the .prm file) for every time iteration. This is not the expected output as one would expect a single line to be added for each time step with the flow rates of every boundary. Also, the values of the flow rates were added with a 12 digits precision. Instead, a 4 digits precision in scientific notation was chosen, which seems like a reasonable precision. Description of the solution The value of time is now added outside of the loop on the boundary conditions. Comments At the moment there is no unified output format : with/without scientific notation, different numbers of digits. This could be the work of a future PR. Former-commit-id: 79f3d07
Description of the problem
.dat
file for each defined boundary (in the boundary condition subsection of the.prm
file) for every time iteration. This is not the expected output as one would expect a single line to be added for each time step with the flow rates of every boundary.Description of the solution
Comments