Field setBoundary and applyBoundary use options#3365
Conversation
When a boundary value uses options then these were only parsed on processors with boundaries. This uses a dummy boundary region to force all processors to parse options. This should fix the problem that means unused options checking needs to be disabled in many transport simulations.
| // This ensures that options are parsed/used on all processors | ||
| BoundaryRegionXIn dummy_region{"dummy_region", 0, 1, fieldmesh}; | ||
| auto* bndry = bfact->create(condition, &dummy_region); | ||
| delete bndry; |
There was a problem hiding this comment.
warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
delete bndry;
^Additional context
src/field/field3d.cxx:404: variable declared here
auto* bndry = bfact->create(condition, &dummy_region);
^| // This ensures that options are parsed/used on all processors | ||
| BoundaryRegionXIn dummy_region{"dummy_region", 0, 1, mesh}; | ||
| auto* bndry = bfact->createFromOptions(name, &dummy_region); | ||
| delete bndry; |
There was a problem hiding this comment.
warning: deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
delete bndry;
^Additional context
src/field/field_data.cxx:153: variable declared here
auto* bndry = bfact->createFromOptions(name, &dummy_region);
^|
Should that be handled by setting the options as conditionally used? |
Hi @dschwoerer ! The issue is that some processors have no boundaries so options are not used on those processors. One possibility would be to have the unused options code coordinate across processors. This is nontrivial because some processors could use one set of options and another set of processors use a different set of options. |
We might want to have the conditionally used part to do that recursive anyway, but that is probably a bit more involved.
Then the right thing would be to only fail if something is not used anywhere. The current approach feels more like a workaround, then a fix. It would be much nicer to have the state synced to all procs. But that is indeed a bit more complicated, but should be doable. It is only done twice in the simulation, and it should not be a huge amount of data that we have to communicate, even if we just send the whole list that is used on one proc to all other procs. |
|
Hi @dschwoerer Yes I agree that the right solution is to coordinate across processors, and only raise an exception if an option is not used on any processor. I'll close this PR and create an issue. |
When a boundary value uses options then these were only parsed on processors with boundaries. This uses a dummy boundary region to force all processors to parse options.
This should fix the problem that means unused options checking needs to be disabled in many transport simulations.