48template<
class TypeTag>
class IMPET
54 using ElementMapper =
typename SolutionTypes::ElementMapper;
71 problem_.transportModel().initialize();
73 problem_.pressureModel().initialize();
76 problem_.pressureModel().updateMaterialLaws();
78 Dune::dinfo <<
"IMPET: initialization done." << std::endl;
92 void update(
const Scalar t, Scalar& dt, TransportSolutionType& updateVec)
94 if (iterFlag_ == noIter)
97 problem_.pressureModel().update();
100 problem_.transportModel().update(t, dt, updateVec,
true);
104 else if (iterFlag_ == iterToNumIter || iterFlag_ == iterToConverged)
106 bool converg =
false;
111 TransportSolutionType transValueOldIter;
112 problem_.transportModel().getTransportedQuantity(transValueOldIter);
113 TransportSolutionType updateOldIter(transValueOldIter);
115 TransportSolutionType transportedQuantity(transValueOldIter);
116 TransportSolutionType updateHelp(transValueOldIter);
117 TransportSolutionType updateDiff(transValueOldIter);
124 problem_.pressureModel().update();
127 problem_.transportModel().update(t, dt, updateVec,
true);
129 updateHelp = updateVec;
130 problem_.transportModel().getTransportedQuantity(transportedQuantity);
131 transportedQuantity += (updateHelp *= (dt * cFLFactor_));
132 transportedQuantity *= omega_;
133 transValueOldIter *= (1 - omega_);
134 transportedQuantity += transValueOldIter;
135 updateDiff = updateVec;
136 updateDiff -= updateOldIter;
137 transValueOldIter = transportedQuantity;
138 updateOldIter = updateVec;
139 Dune::dinfo <<
" defect = " << dt * updateDiff.two_norm() / transportedQuantity.two_norm();
141 if (iterFlag_ == iterToConverged && dt * updateDiff.two_norm() / transportedQuantity.two_norm() <= maxDefect_)
145 else if (iterFlag_ == iterToNumIter && iter > nIter_)
150 if (iterFlag_ == iterToConverged && transportedQuantity.infinity_norm() > (1 + maxDefect_))
154 if (!converg && iter > nIter_)
157 std::cout <<
"Nonlinear loop in IMPET.update exceeded nIter = " << nIter_ <<
" iterations."
159 std::cout << transportedQuantity.infinity_norm() << std::endl;
163 if (iterFlag_ == iterToConverged)
164 std::cout <<
"Iteration steps: " << iterTot << std::endl;
165 std::cout.setf(std::ios::scientific, std::ios::floatfield);
171 DUNE_THROW(Dune::NotImplemented,
"IMPET: Iterationtype not implemented!");
178 problem_.pressureModel().updateVelocity();
180 problem_.transportModel().update(t, dt, updateVec,
true);
188 template<
class MultiWriter>
191 problem_.pressureModel().addOutputVtkFields(writer);
192 problem_.transportModel().addOutputVtkFields(writer);
202 return problem_.elementMapper();
212 cFLFactor_ = getParam<Scalar>(
"Impet.CFLFactor");
213 iterFlag_ = getParam<int>(
"Impet.IterationFlag", 0);
214 nIter_ = getParam<int>(
"Impet.IterationNumber", 2);
215 maxDefect_ = getParam<Scalar>(
"Impet.MaximumDefect", 1e-5);
216 omega_ = getParam<Scalar>(
"Impet.RelaxationFactor", 1.0);
Base file for properties related to sequential IMPET algorithms.
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property
Definition: propertysystem.hh:141
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
IMplicit Pressure Explicit Transport (IMPET) scheme for the solution of weakly coupled diffusion-tran...
Definition: impet.hh:49
void update(const Scalar t, Scalar &dt, TransportSolutionType &updateVec)
Calculate the update.
Definition: impet.hh:92
typename SolutionTypes::ScalarSolution SolutionType
Definition: impet.hh:65
void initialize()
Set initial solution and initialize parameters.
Definition: impet.hh:68
void updateTransport(const Scalar t, Scalar &dt, TransportSolutionType &updateVec)
Definition: impet.hh:176
const ElementMapper & dofMapper() const
Mapper for the entities where degrees of freedoms are defined.
Definition: impet.hh:200
void addOutputVtkFields(MultiWriter &writer)
Write data files.
Definition: impet.hh:189
IMPET(Problem &problem)
Constructs an IMPET object.
Definition: impet.hh:209