From cd2e23f656f1f2e8fbaee5626f5b2f3a7f0a4383 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Tue, 14 Aug 2007 15:12:57 +0000 Subject: [PATCH] compute error of initial iterate [[Imported from SVN: r1512]] --- rod3d.cc | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/rod3d.cc b/rod3d.cc index d9ecdbbc..3e197208 100644 --- a/rod3d.cc +++ b/rod3d.cc @@ -100,6 +100,9 @@ int main (int argc, char *argv[]) try x.back().q = Quaternion<double>(axis, M_PI*angle/180); + // backup for error measurement later + SolutionType initialIterate = x; + std::cout << "Left boundary orientation:" << std::endl; std::cout << "director 0: " << x[0].q.director(0) << std::endl; std::cout << "director 1: " << x[0].q.director(1) << std::endl; @@ -159,10 +162,6 @@ int main (int argc, char *argv[]) try writeRod(x, resultPath + "rod3d.result"); BlockVector<FieldVector<double, 6> > strain(x.size()-1); rodAssembler.getStrain(x,strain); - //std::cout << strain << std::endl; - //exit(0); - - //writeRod(x, "rod3d.strain"); // ////////////////////////////////////////////////////////// // Recompute and compare against exact solution @@ -183,24 +182,16 @@ int main (int argc, char *argv[]) try double error = std::numeric_limits<double>::max(); - double oldError = 0; SolutionType intermediateSolution(x.size()); // Create statistics file std::ofstream statisticsFile((resultPath + "trStatistics").c_str()); - // Compute error of the initial 3d solution - - // This should really be exactSol-initialSol, but we're starting - // from zero anyways - //oldError += computeEnergyNormSquared(exactSol3d, *hessian3d); - -#warning Rod error still missing - - oldError = std::sqrt(oldError); - - + // Compute error of the initial iterate + typedef BlockVector<FieldVector<double,6> > RodDifferenceType; + RodDifferenceType rodDifference = computeRodDifference(exactSolution, initialIterate); + double oldError = std::sqrt(computeEnergyNormSquared(rodDifference, hessian)); int i; for (i=0; i<maxTrustRegionSteps; i++) { @@ -221,13 +212,11 @@ int main (int argc, char *argv[]) try fclose(fp); - - // ///////////////////////////////////////////////////// // Compute error // ///////////////////////////////////////////////////// - typedef BlockVector<FieldVector<double,6> > RodDifferenceType; - RodDifferenceType rodDifference = computeRodDifference(exactSolution, intermediateSolution); + + rodDifference = computeRodDifference(exactSolution, intermediateSolution); error = std::sqrt(computeEnergyNormSquared(rodDifference, hessian)); -- GitLab