Skip to content
Snippets Groups Projects
Commit 66faabf3 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[examples] Add skeleton for nested iteration to adaptive example

parent 231e843a
No related branches found
No related tags found
1 merge request!258Add constraints support for dune-functions basis
Pipeline #77067 failed
......@@ -262,6 +262,9 @@ int main (int argc, char *argv[]) try
// Discretize -> solve -> estimate -> mark -> refine
using Vector = Dune::BlockVector<double>;
auto sol_initial = Vector();
std::size_t refinementStep = 0;
while(true)
{
......@@ -344,8 +347,13 @@ int main (int argc, char *argv[]) try
// Initialize solution vector
// *********************************************
Dune::Functions::istlVectorBackend(sol).resize(basis);
Dune::Functions::istlVectorBackend(sol) = 0;
// For simplicity use zero as initial value.
// Here we could use an adapted solution from
// the previous grid as initial value.
Dune::Functions::istlVectorBackend(sol_initial).resize(basis);
Dune::Functions::istlVectorBackend(sol_initial) = 0;
sol = sol_initial;
// *********************************************
// Solve linear system
......@@ -441,6 +449,7 @@ int main (int argc, char *argv[]) try
// *********************************************
{
auto u_initial = bindToCoefficients(trialFunction(basis), sol_initial);
auto d = bindToCoefficients(trialFunction(extensionBasis), defect);
#if DUNE_VERSION_GT(DUNE_VTK, 2, 9)
using Dune::Vtk::LagrangeDataCollector;
......@@ -448,6 +457,7 @@ int main (int argc, char *argv[]) try
using Dune::VTK::FieldInfo;
auto vtkWriter = UnstructuredGridWriter(LagrangeDataCollector(basis.gridView(), extensionOrder));
vtkWriter.addPointData(u, FieldInfo("sol", FieldInfo::Type::scalar, 1));
vtkWriter.addPointData(u_initial, FieldInfo("sol_initial", FieldInfo::Type::scalar, 1));
vtkWriter.addPointData(d, FieldInfo("defect", FieldInfo::Type::scalar, 1));
vtkWriter.write(Dune::formatString("poisson-adaptive-%03d", refinementStep));
#else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment