Skip to content
Snippets Groups Projects
Commit 9dc91b72 authored by Jonathan Youett's avatar Jonathan Youett
Browse files

Allow multiple Dirichlet boundaries with different values

parent d0523b41
No related branches found
No related tags found
No related merge requests found
......@@ -84,17 +84,27 @@ int main (int argc, char *argv[]) try
#endif
}
// Read coarse Dirichlet boundary values
BitSetVector<dim> coarseDirichletNodes;
VectorType coarseDirichletValues;
DirichletBCAssembler<GridType>::assembleDirichletBC(*grid, parameterSet,
coarseDirichletNodes, coarseDirichletValues,
path);
const double scaling = parameterSet.get<double>("scaling");
coarseDirichletValues *= scaling;
// Read coarse Dirichlet boundary condition
BitSetVector<dim> coarseDirichletNodes(grid->size(dim),false);
VectorType coarseDirichletValues(grid->size(dim));
coarseDirichletValues = 0;
for (int i = 0; i < gridConfig.get<int>("nDirichletConditions"); ++i) {
const auto& dirConfig = gridConfig.sub(formatString("dirichlet%d",i));
BitSetVector<dim> dirichletNodes;
VectorType dirichletValues;
DirichletBCAssembler<GridType>::assembleDirichletBC(*grid, dirConfig,
dirichletNodes, dirichletValues, path);
auto scaling = dirConfig.get<double>("dvScaling", 1);
// combine with previous ones
coarseDirichletValues.axpy(scaling, dirichletValues);
for (size_t j = 0; j < dirichletNodes.size(); ++j)
for (int k = 0; k < dim; ++k)
if (dirichletNodes[j][k])
coarseDirichletNodes[j][k] = true;
}
// //////////////////////
// Uniform refine grid
// /////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment