[cig-commits] r14214 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Tue Mar 3 14:54:15 PST 2009
Author: luis
Date: 2009-03-03 14:54:14 -0800 (Tue, 03 Mar 2009)
New Revision: 14214
Modified:
cs/cigma/trunk/src/Residuals.cpp
cs/cigma/trunk/src/cli_compare_cmd.cpp
cs/cigma/trunk/src/vtk-residuals.cpp
Log:
Fixed problem with scale in the visualization of residuals.
Only need to normalize residuals by the square root of the
corresponding cell volume. We need to do this because locally
we are storing the square root of the term which contributes to
the L2 norm.
Modified: cs/cigma/trunk/src/Residuals.cpp
===================================================================
--- cs/cigma/trunk/src/Residuals.cpp 2009-03-03 22:01:25 UTC (rev 14213)
+++ cs/cigma/trunk/src/Residuals.cpp 2009-03-03 22:54:14 UTC (rev 14214)
@@ -1,4 +1,5 @@
#include "Residuals.h"
+#include "tri_logger.hpp"
#include <iostream>
#include <cassert>
#include <cmath>
@@ -21,6 +22,7 @@
void Residuals::setMesh(shared_ptr<MeshPart> mesh)
{
+ TRI_LOG_STR("Residuals::setMesh()");
this->mesh = mesh;
if (mesh)
Modified: cs/cigma/trunk/src/cli_compare_cmd.cpp
===================================================================
--- cs/cigma/trunk/src/cli_compare_cmd.cpp 2009-03-03 22:01:25 UTC (rev 14213)
+++ cs/cigma/trunk/src/cli_compare_cmd.cpp 2009-03-03 22:54:14 UTC (rev 14214)
@@ -261,8 +261,7 @@
if (!vm.count("quiet"))
{
cout << endl;
- cout << "First function : " << first << endl;
- cout << "Second function : " << second << endl;
+ cout << "Comparing " << first << " and " << second << endl;
cout << endl;
if (op.verbose)
Modified: cs/cigma/trunk/src/vtk-residuals.cpp
===================================================================
--- cs/cigma/trunk/src/vtk-residuals.cpp 2009-03-03 22:01:25 UTC (rev 14213)
+++ cs/cigma/trunk/src/vtk-residuals.cpp 2009-03-03 22:54:14 UTC (rev 14214)
@@ -50,6 +50,7 @@
("input,i", po::value<string>(&inloc), "HDF5 input file for residuals")
("output,o", po::value<string>(&outloc), "VTK output file for residuals")
("divide-by-cell-volumes", "Divide residual by corresponding cell volume")
+ ("divide-by-sqrt-cell-volumes", "Divide residual by square root of cell volume")
("output-log-values", "Write logarithm of final results")
//("square-residuals", "Square residual values before storing")
;
@@ -111,6 +112,13 @@
return 2;
}
+ if (vm.count("divide-by-cell-volumes") && vm.count("divide-by-sqrt-cell-volumes"))
+ {
+ cout << "Error: Conflicting options (--divide-by-cell-volumes and --divide-by-sqrt-cell-volumes)" << endl;
+ return 2;
+ }
+
+
MeshInfo mesh_info;
mesh_info.p_mesh = DataPath(meshloc);
mesh_info.p_nc = DataPath(ncloc);
@@ -187,12 +195,18 @@
if (vm.count("divide-by-cell-volumes"))
{
- valarray<double>& vol = mesh->volume;
- residuals->epsilon /= vol;
+ TRI_LOG_STR(">>> Normalizing residuals by cell volume");
+ residuals->epsilon /= (mesh->volume);
}
+ else if (vm.count("divide-by-sqrt-cell-volumes"))
+ {
+ TRI_LOG_STR(">>> Normalizing residuals by square root of cell volume");
+ residuals->epsilon /= sqrt(mesh->volume);
+ }
if (vm.count("output-log-values"))
{
+ TRI_LOG_STR(">>> Lastly, use a log10 scale on the residuals");
residuals->epsilon = log10(residuals->epsilon);
}
More information about the CIG-COMMITS
mailing list