-
Notifications
You must be signed in to change notification settings - Fork 240
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
[WIP] Generate and remove particles with uniform box #3103
base: main
Are you sure you want to change the base?
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 see what you want to do in this PR, and I like the functionality, but I think the way you currently implement it is somewhat confusing, and will break things for some users. E.g. what if you want to generate particles in a certain box domain and want to look at where they are going over time? They would just disappear in the current code. I think you can more or less keep the code in place, but instead of abusing the box generator as a trigger to limit particles, you should create a new load balancing strategy
called limit particles to box
. You could then add new input parameters to the World
class that define this box and remove the changes to the box
generator altogether. Do you think that would make sense?
@@ -68,6 +68,12 @@ namespace aspect | |||
void | |||
parse_parameters (ParameterHandler &prm); | |||
|
|||
/** | |||
* Function to send min/max dimensions of uniform box/ |
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.
* Function to send min/max dimensions of uniform box/ | |
* Function to get min/max dimensions of uniform box. |
* particles that enter the cell will be removed. | ||
*/ | ||
bool cell_in_domain = true; | ||
if (dynamic_cast<const Generator::UniformBox<dim> *>(generator.get()) != nullptr) |
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.
We try to not use dynamic_cast
any more. You can instead do the following:
if (dynamic_cast<const Generator::UniformBox<dim> *>(generator.get()) != nullptr) | |
if (plugins::plugin_type_matches<const Generator::UniformBox<dim>>(generator.get())) |
std::array< Point<dim>, GeometryInfo<dim>::vertices_per_cell> new_vertices; | ||
new_vertices = this->get_mapping().get_vertices(cell); | ||
|
||
const Generator::UniformBox<dim> *box |
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.
Same here:
const Generator::UniformBox<dim> *box | |
const Generator::UniformBox<dim> &box = plugins::get_plugin_as_type<const Generator::UniformBox<dim>>(generator.get()); |
@gassmoeller. This builds on #3013 by allowing particles to be continuously generated inside the uniform box, and removes any particles that leave the box.