69class FvBaseDiscretizationFemAdapt :
public FvBaseDiscretization<TypeTag>
72 using ParentType = FvBaseDiscretization<TypeTag>;
81 using DiscreteFunction = Dune::Fem::ISTLBlockVectorDiscreteFunction<DiscreteFunctionSpace, PrimaryVariables>;
84 using ProblemRestrictProlongOperator =
typename Problem::RestrictProlongOperator;
87 using DiscreteFunctionRestrictProlong = Dune::Fem::RestrictProlongDefault<DiscreteFunction>;
89 = Dune::Fem::RestrictProlongTuple<DiscreteFunctionRestrictProlong, ProblemRestrictProlongOperator>;
92 using AdaptationManager = Dune::Fem::AdaptationManager<Grid, RestrictProlong>;
95 template<
class Serializer>
98 template<
class SolutionType>
99 static void serializeOp(Serializer& serializer,
103 serializer(sol->blockVector());
108 explicit FvBaseDiscretizationFemAdapt(Simulator& simulator)
109 : ParentType(simulator)
110 , space_(simulator.vanguard().gridPart())
112 if (this->enableGridAdaptation_ && !Dune::Fem::Capabilities::isLocallyAdaptive<Grid>::v) {
113 throw std::invalid_argument(
"Grid adaptation enabled, but chosen Grid is not capable"
117 for (
unsigned timeIdx = 0; timeIdx < historySize; ++timeIdx) {
118 this->solution_[timeIdx] = std::make_unique<DiscreteFunction>(
"solution", space_);
126 if (this->enableGridAdaptation_) {
128 if (this->simulator_.problem().markForGridAdaptation()) {
130 adaptationManager().adapt();
134 this->elementMapper_.update(this->gridView_);
135 this->vertexMapper_.update(this->gridView_);
147 this->simulator_.problem().gridChanged();
150 for (
auto& module : this->outputModules_) {
151 module->allocBuffers();
157 AdaptationManager& adaptationManager()
159 if (!adaptationManager_) {
163 std::make_unique<RestrictProlong>(DiscreteFunctionRestrictProlong(*(this->solution_[0])),
164 this->simulator_.problem().restrictProlongOperator());
166 std::make_unique<AdaptationManager>(this->simulator_.vanguard().grid(), *restrictProlong_);
168 return *adaptationManager_;
172 DiscreteFunctionSpace space_;
173 std::unique_ptr<RestrictProlong> restrictProlong_;
174 std::unique_ptr<AdaptationManager> adaptationManager_;
const SolutionVector & solution(unsigned timeIdx) const
Reference to the solution at a given history index as a block vector.
Definition fvbasediscretization.hh:1224
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240