24#ifndef DUMUX_ASSEMBLY_INITIAL_SOLUTION_HH
25#define DUMUX_ASSEMBLY_INITIAL_SOLUTION_HH
38template<
class SolutionVector,
class Problem>
41 const auto& gg = problem.gridGeometry();
42 using GridGeometry = std::decay_t<
decltype(gg)>;
47 constexpr int dim = GridGeometry::GridView::dimension;
48 const auto numDofs = gg.vertexMapper().size();
49 const auto numVert = gg.gridView().size(dim);
54 if (numDofs != numVert)
56 std::vector<bool> dofVisited(numDofs,
false);
57 for (
const auto& element : elements(gg.gridView()))
59 for (
int i = 0; i < element.subEntities(dim); ++i)
61 const auto dofIdxGlobal = gg.vertexMapper().subIndex(element, i, dim);
63 if (!dofVisited[dofIdxGlobal])
65 sol[dofIdxGlobal] = problem.initial(element.template subEntity<dim>(i));
66 dofVisited[dofIdxGlobal] =
true;
75 for (
const auto& vertex : vertices(gg.gridView()))
76 sol[gg.vertexMapper().index(vertex)] = problem.initial(vertex);
83 problem.applyInitialSolution(sol);
89 sol.resize(gg.numDofs());
90 for (
const auto& element : elements(gg.gridView()))
91 sol[gg.elementMapper().index(element)] = problem.initial(element);
99template<
class SolutionVector,
class Problem>
The available discretization methods in Dumux.
void assembleInitialSolution(SolutionVector &sol, const Problem &problem)
Set a solution vector to the initial solution provided by the problem.
Definition: initialsolution.hh:39
SolutionVector makeInitialSolution(const Problem &problem)
Create a solution vector filled with the initial solution provided by the problem.
Definition: initialsolution.hh:100
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
constexpr Box box
Definition: method.hh:136
constexpr Staggered staggered
Definition: method.hh:138