-
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
Fix bugs: changing time step after restart and tracer tanh model #1343
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.
I have a few comments and doubts regarding these new features
@@ -159,7 +159,7 @@ class TracerScratchData : public PhysicsScratchDataBase | |||
const VectorType ¤t_solution, | |||
const std::vector<VectorType> &previous_solutions, | |||
const Function<dim> *source_function, | |||
const Function<dim> *levelset_function) | |||
Shape<dim> *immersed_solid_shape) |
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.
Shouldn't it be const?
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.
Because we use value_with_cell_guess, no. value_with_cell_guess is not const, which allows us to add entries to a map in a caching mechanism. Without using this mechanism the code runs much too slowly.
I agree that it would be better to use a const function, but I do not see an efficient way to populate the map otherwise; we need to populate the map with the value of the distance for all quadrature points in the mesh. Maybe we could do it once, with a loop over all active cells before reinitializing the scratch? Then we could use value instead, which is const and can use an already populated map
@@ -317,7 +320,7 @@ class TracerScratchData : public PhysicsScratchDataBase | |||
const unsigned int &neigh_face_no, | |||
const unsigned int &neigh_sub_face_no, | |||
const VectorType ¤t_solution, | |||
const Function<dim> *levelset_function) | |||
const Function<dim> *immersed_solid_shape) |
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.
Isn't this a shape? According to the previous changes?
@@ -383,7 +387,7 @@ class TracerScratchData : public PhysicsScratchDataBase | |||
const unsigned int &face_no, | |||
const unsigned int &boundary_index, | |||
const VectorType ¤t_solution, | |||
const Function<dim> *levelset_function) | |||
Shape<dim> *immersed_solid_shape) |
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.
Shouldn't it be const?
Shape<dim> *immersed_solid_shape) | |
const Shape<dim> *immersed_solid_shape) |
source/core/simulation_control.cc
Outdated
// Fix the time step to the new provided value. | ||
// We understand that users providing this value when adaptive time stepping | ||
// is not enabled means a time step change is the desired effect. | ||
if (!adapt) | ||
set_current_time_step(initial_time_step); |
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 don't fully understand why is this useful? Like in what kind of cases...Isn't it "risky" to change the time step in the middle of the simulation when restarting it?
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.
Yes it is risky business, but the way I use it is that I solve NS with small time steps, until the solution is steady, then I solve only tracer with large time steps after a restart (before and after the restart the time step is fixed). I should write this somewhere so it is clearer, thanks for pointing it out
Co-authored-by: Laura Prieto Saavedra <[email protected]>
f4dc07a
to
b5735e6
Compare
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 just have one additional minor comment...
Co-authored-by: Laura Prieto Saavedra <[email protected]>
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.
Much better this way I like it
Description
There were two issues that appeared when using the tracer physics with an immersed solid:
immersed solid tanh
was too costlytime step
after restarting was impossibleSolution
adapt==false
. This behavior is not allowed whenadapt==true
, as then we desire a continuity in time step evolution. When using fixed time step though, users who change the value after a restart apparently aim for this behavior.Testing
All tests still pass.
Documentation
No change needed.
Miscellaneous (will be removed when merged)
Checklist (will be removed when merged)
See this page for more information about the pull request process.
Code related list:
Pull request related list: