Skip to content
Snippets Groups Projects
Commit 434513bf authored by Elias Pipping's avatar Elias Pipping
Browse files

[Cleanup] Bug fix: Do not mix old and new BC

During the first fixed point iteration, velocityIterate and the old
velocity are identical except for the new BC: velocityIterate has
already had them imposed.

To simplify the control flow, kill v completely.

Note that since we always make two fixed point iterations and this issue
only occurs during the first step, this change only affects
computational results as (a reduction of) noise
parent 4d25738a
No related branches found
No related tags found
No related merge requests found
...@@ -352,7 +352,6 @@ int main(int argc, char *argv[]) { ...@@ -352,7 +352,6 @@ int main(int argc, char *argv[]) {
parset.get<double>("boundary.friction.L"), parset.get<double>("boundary.friction.L"),
parset.get<double>("boundary.friction.V0")); parset.get<double>("boundary.friction.V0"));
Vector v = v_initial;
Vector v_m(leafVertexCount); Vector v_m(leafVertexCount);
ScalarVector alpha(leafVertexCount); ScalarVector alpha(leafVertexCount);
...@@ -413,7 +412,7 @@ int main(int argc, char *argv[]) { ...@@ -413,7 +412,7 @@ int main(int argc, char *argv[]) {
for (size_t stateFPI = 1; stateFPI <= maximumStateFPI; ++stateFPI) { for (size_t stateFPI = 1; stateFPI <= maximumStateFPI; ++stateFPI) {
timeSteppingScheme->extractOldVelocity(v_m); timeSteppingScheme->extractOldVelocity(v_m);
v_m *= 1.0 - lambda; v_m *= 1.0 - lambda;
Arithmetic::addProduct(v_m, lambda, v); Arithmetic::addProduct(v_m, lambda, velocityIterate);
stateUpdater->solve(v_m); stateUpdater->solve(v_m);
stateUpdater->extractAlpha(alpha); stateUpdater->extractAlpha(alpha);
...@@ -421,21 +420,21 @@ int main(int argc, char *argv[]) { ...@@ -421,21 +420,21 @@ int main(int argc, char *argv[]) {
solveVelocityProblem(velocityIterate, alpha); solveVelocityProblem(velocityIterate, alpha);
timeSteppingScheme->postProcess(velocityIterate); timeSteppingScheme->postProcess(velocityIterate);
timeSteppingScheme->extractDisplacement(u); timeSteppingScheme->extractDisplacement(u);
timeSteppingScheme->extractVelocity(v);
iterationWriter << iterationCounter << " "; iterationWriter << iterationCounter << " ";
if (printProgress) if (printProgress)
std::cout << '.' << std::flush; std::cout << '.' << std::flush;
if (stateFPI > 1) { if (stateFPI > 1) {
double const velocityCorrection = AMNorm.diff(v_saved, v); double const velocityCorrection =
AMNorm.diff(v_saved, velocityIterate);
if (velocityCorrection < fixedPointTolerance) if (velocityCorrection < fixedPointTolerance)
break; break;
} }
if (stateFPI == maximumStateFPI) if (stateFPI == maximumStateFPI)
DUNE_THROW(Dune::Exception, "FPI failed to converge"); DUNE_THROW(Dune::Exception, "FPI failed to converge");
v_saved = v; v_saved = velocityIterate;
} }
if (printProgress) if (printProgress)
std::cout << std::endl; std::cout << std::endl;
......
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