Skip to content

Commit

Permalink
Address Alex's review:
Browse files Browse the repository at this point in the history
- prevent OOB access when initializing stateful material properties on boundary
  • Loading branch information
GiudGiud committed Feb 12, 2025
1 parent f93945a commit 8b07406
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions framework/src/bcs/IntegratedBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "SystemBase.h"
#include "MooseVariableFE.h"
#include "MooseVariableScalar.h"
#include "MaterialPropertyStorage.h"

#include "libmesh/quadrature.h"

Expand Down Expand Up @@ -88,6 +89,14 @@ IntegratedBC::IntegratedBC(const InputParameters & parameters)
}

_has_diag_save_in = _diag_save_in.size() > 0;

// Stateful properties on the boundary will trigger OOB evaluations from re-initing variables out
// of the domain
if (_skip_execution_outside_variable_domain &&
_fe_problem.getBndMaterialPropertyStorage().hasStatefulProperties())
paramError("skip_execution_outside_variable_domain",
"Stateful boundary material properties are not supported when executing boundary "
"conditions outsive the variable domain");
}

void
Expand Down
7 changes: 5 additions & 2 deletions framework/src/meshmodifiers/ElementSubdomainModifierBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "ElementSubdomainModifierBase.h"
#include "DisplacedProblem.h"
#include "MaterialWarehouse.h"

#include "libmesh/parallel_algebra.h"
#include "libmesh/parallel.h"
Expand Down Expand Up @@ -215,12 +216,14 @@ ElementSubdomainModifierBase::modify(

// Initialize solution and stateful material properties
applyIC(/*displaced=*/false);
initElementStatefulProps(/*displaced=*/false);
if (_fe_problem.getMaterialWarehouse().hasActiveObjects(0))
initElementStatefulProps(/*displaced=*/false);

if (_displaced_mesh)
{
applyIC(/*displaced=*/true);
initElementStatefulProps(/*displaced=*/true);
if (_fe_problem.getMaterialWarehouse().hasActiveObjects(0))
initElementStatefulProps(/*displaced=*/true);
}
}

Expand Down

0 comments on commit 8b07406

Please sign in to comment.