From ca13b523b6ab3c5af0efd59082cbbd511a088a8a Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Mon, 18 Dec 2017 17:23:28 +0100 Subject: [PATCH] [navierstokes][test] Adapt test_angeli to changes --- test/freeflow/staggered/angelitestproblem.hh | 35 +++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/test/freeflow/staggered/angelitestproblem.hh b/test/freeflow/staggered/angelitestproblem.hh index 816b62c756..6f62b4c04f 100644 --- a/test/freeflow/staggered/angelitestproblem.hh +++ b/test/freeflow/staggered/angelitestproblem.hh @@ -37,13 +37,6 @@ namespace Dumux template <class TypeTag> class AngeliTestProblem; -namespace Capabilities -{ - template<class TypeTag> - struct isStationary<AngeliTestProblem<TypeTag>> - { static const bool value = false; }; -} - namespace Properties { NEW_TYPE_TAG(AngeliTestProblem, INHERITS_FROM(StaggeredFreeFlowModel, NavierStokes)); @@ -286,10 +279,10 @@ public: // treat cell-center dofs const auto dofIdxCellCenter = scv.dofIndex(); const auto& posCellCenter = scv.dofPosition(); - const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[cellCenterIdx]; - const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter]; - sumError[cellCenterIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); - sumReference[cellCenterIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); + const auto analyticalSolutionCellCenter = dirichletAtPos(posCellCenter)[pressureIdx]; + const auto numericalSolutionCellCenter = curSol[cellCenterIdx][dofIdxCellCenter][pressureIdx]; + sumError[pressureIdx] += squaredDiff_(analyticalSolutionCellCenter, numericalSolutionCellCenter) * scv.volume(); + sumReference[pressureIdx] += analyticalSolutionCellCenter * analyticalSolutionCellCenter * scv.volume(); totalVolume += scv.volume(); // treat face dofs @@ -297,7 +290,7 @@ public: { const int dofIdxFace = scvf.dofIndex(); const int dirIdx = scvf.directionIndex(); - const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[faceIdx][dirIdx]; + const auto analyticalSolutionFace = dirichletAtPos(scvf.center())[Indices::velocity(dirIdx)]; const auto numericalSolutionFace = curSol[faceIdx][dofIdxFace][momentumBalanceIdx]; directionIndex[dofIdxFace] = dirIdx; errorVelocity[dofIdxFace] = squaredDiff_(analyticalSolutionFace, numericalSolutionFace); @@ -309,8 +302,8 @@ public: } // get the absolute and relative discrete L2-error for cell-center dofs - l2NormAbs[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / totalVolume); - l2NormRel[cellCenterIdx] = std::sqrt(sumError[cellCenterIdx] / sumReference[cellCenterIdx]); + l2NormAbs[pressureIdx] = std::sqrt(sumError[pressureIdx] / totalVolume); + l2NormRel[pressureIdx] = std::sqrt(sumError[pressureIdx] / sumReference[pressureIdx]); // get the absolute and relative discrete L2-error for face dofs for(int i = 0; i < numFaceDofs; ++i) @@ -319,14 +312,14 @@ public: const auto error = errorVelocity[i]; const auto ref = velocityReference[i]; const auto volume = staggeredVolume[i]; - sumError[faceIdx][dirIdx] += error * volume; - sumReference[faceIdx][dirIdx] += ref * volume; + sumError[Indices::velocity(dirIdx)] += error * volume; + sumReference[Indices::velocity(dirIdx)] += ref * volume; } for(int dirIdx = 0; dirIdx < dimWorld; ++dirIdx) { - l2NormAbs[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / totalVolume); - l2NormRel[faceIdx][dirIdx] = std::sqrt(sumError[faceIdx][dirIdx] / sumReference[faceIdx][dirIdx]); + l2NormAbs[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / totalVolume); + l2NormRel[Indices::velocity(dirIdx)] = std::sqrt(sumError[Indices::velocity(dirIdx)] / sumReference[Indices::velocity(dirIdx)]); } return std::make_pair(l2NormAbs, l2NormRel); } @@ -392,11 +385,13 @@ public: const auto faceDofPosition = scvf.center(); const auto dirIdx = scvf.directionIndex(); const auto analyticalSolutionAtFace = analyticalSolution(faceDofPosition, time()); - analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[faceIdx][dirIdx]; + analyticalVelocityOnFace_[faceDofIdx][dirIdx] = analyticalSolutionAtFace[Indices::velocity(dirIdx)]; } analyticalPressure_[ccDofIdx] = analyticalSolutionAtCc[pressureIdx]; - analyticalVelocity_[ccDofIdx] = analyticalSolutionAtCc[faceIdx]; + + for(int dirIdx = 0; dirIdx < dim; ++dirIdx) + analyticalVelocity_[ccDofIdx][dirIdx] = analyticalSolutionAtCc[Indices::velocity(dirIdx)]; } } } -- GitLab