Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Djneu
Copy link

@Djneu Djneu commented May 30, 2019

@gassmoeller. This builds on #3013 by allowing particles to be continuously generated inside the uniform box, and removes any particles that leave the box.

Copy link
Member

@gassmoeller gassmoeller left a 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/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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)
Copy link
Member

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:

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
const Generator::UniformBox<dim> *box
const Generator::UniformBox<dim> &box = plugins::get_plugin_as_type<const Generator::UniformBox<dim>>(generator.get());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants