Fixed: Corrected the norm output to VTF. It has been wrong since r1501.
git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1505 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
parent
e4bc621c31
commit
aa5c798988
@ -68,9 +68,9 @@
|
|||||||
\arg -DGL2 : Estimate error using discrete global L2 projection
|
\arg -DGL2 : Estimate error using discrete global L2 projection
|
||||||
\arg -CGL2 : Estimate error using continuous global L2 projection
|
\arg -CGL2 : Estimate error using continuous global L2 projection
|
||||||
\arg -SCR : Estimate error using Superconvergent recovery at Greville points
|
\arg -SCR : Estimate error using Superconvergent recovery at Greville points
|
||||||
\arg -VDSA: Generate visualization fields through Variational Diminishing Spline Approximations
|
\arg -VDSA: Estimate error using Variational Diminishing Spline Approximations
|
||||||
\arg -LSQ : Generate visualization fields through Least Square projections
|
\arg -LSQ : Estimate error using through Least Square projections
|
||||||
\arg -QUASI : Generate visualization fields through Quasi interpolation projections
|
\arg -QUASI : Estimate error using Quasi-interpolation projections
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main (int argc, char** argv)
|
int main (int argc, char** argv)
|
||||||
@ -342,23 +342,24 @@ int main (int argc, char** argv)
|
|||||||
if (model->haveAnaSol() && gNorm.size() >= 4)
|
if (model->haveAnaSol() && gNorm.size() >= 4)
|
||||||
std::cout <<"\nExact norm |u| = a(u,u)^0.5 : "<< gNorm(3)
|
std::cout <<"\nExact norm |u| = a(u,u)^0.5 : "<< gNorm(3)
|
||||||
<<"\nExact error a(e,e)^0.5, e=u-u^h : "<< gNorm(4)
|
<<"\nExact error a(e,e)^0.5, e=u-u^h : "<< gNorm(4)
|
||||||
<<"\nExact relative error (%) : "<< gNorm(4)/gNorm(3)*100.0;
|
<<"\nExact relative error (%) : "<< gNorm(4)/gNorm(3)*100.0
|
||||||
|
<< std::endl;
|
||||||
size_t j = model->haveAnaSol() ? 5 : 3;
|
size_t j = model->haveAnaSol() ? 5 : 3;
|
||||||
for (pit = pOpt.begin(); pit != pOpt.end() && j < gNorm.size(); pit++)
|
for (pit = pOpt.begin(); pit != pOpt.end() && j < gNorm.size(); pit++)
|
||||||
{
|
{
|
||||||
std::cout <<"\n>>> Error estimates based on "<< pit->second <<" <<<";
|
std::cout <<"\n>>> Error estimates based on "<< pit->second <<" <<<";
|
||||||
std::cout <<"\nEnergy norm |u^r| = a(u^r,u^r)^0.5 : "<< gNorm(j++);
|
std::cout <<"\nEnergy norm |u^r| = a(u^r,u^r)^0.5 : "<< gNorm(j++);
|
||||||
std::cout <<"\nError norm a(e,e)^0.5, e=u^r-u^h : "<< gNorm(j++);
|
std::cout <<"\nError norm a(e,e)^0.5, e=u^r-u^h : "<< gNorm(j++);
|
||||||
std::cout <<"\n- relative error (% of |u^r|) : "
|
std::cout <<"\n- relative error (% of |u^r|) : "
|
||||||
<< gNorm(j-1)/gNorm(j-2)*100.0;
|
|
||||||
std::cout <<"\nL2-norm, |u^r| : "<< gNorm(j++);
|
|
||||||
std::cout <<"\nL2-Error norm, e=u^r-u^h : "<< gNorm(j++);
|
|
||||||
std::cout <<"\n- relative error (% of |u^r|) : "
|
|
||||||
<< gNorm(j-1)/gNorm(j-2)*100.0;
|
<< gNorm(j-1)/gNorm(j-2)*100.0;
|
||||||
if (model->haveAnaSol() && j++ <= gNorm.size())
|
if (model->haveAnaSol() && j++ <= gNorm.size())
|
||||||
std::cout <<"\nExact error a(e,e)^0.5, e=u-u^r : "<< gNorm(j-1)
|
std::cout <<"\nExact error a(e,e)^0.5, e=u-u^r : "<< gNorm(j-1)
|
||||||
<<"\n- relative error (% of |u|) : "
|
<<"\n- relative error (% of |u|) : "
|
||||||
<< gNorm(j-1)/gNorm(3)*100.0;
|
<< gNorm(j-1)/gNorm(3)*100.0;
|
||||||
|
std::cout <<"\nL2-norm |s^r| =(s^r,s^r)^0.5 : "<< gNorm(j++);
|
||||||
|
std::cout <<"\nL2-error (e,e)^0.5, e=s^r-s^h : "<< gNorm(j++);
|
||||||
|
std::cout <<"\n- relative error (% of |s^r|) : "
|
||||||
|
<< gNorm(j-1)/gNorm(j-2)*100.0;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,8 +471,7 @@ int main (int argc, char** argv)
|
|||||||
return 12;
|
return 12;
|
||||||
|
|
||||||
// Write element norms
|
// Write element norms
|
||||||
if (!model->writeGlvN(eNorm,iStep,nBlock,prefix,
|
if (!model->writeGlvN(eNorm,iStep,nBlock,prefix,5))
|
||||||
model->haveAnaSol() ? 3 : 2))
|
|
||||||
return 13;
|
return 13;
|
||||||
|
|
||||||
model->writeGlvStep(1);
|
model->writeGlvStep(1);
|
||||||
|
@ -234,23 +234,37 @@ bool NormBase::initElementBou (const std::vector<int>& MNPC1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* NormBase::getName (size_t i, const char* prefix)
|
const char* NormBase::getName (size_t& i, bool haveExact, const char* prefix)
|
||||||
{
|
{
|
||||||
static const char* s[9] = {
|
static const char* s[8] = {
|
||||||
"a(u^h,u^h)^0.5",
|
"a(u^h,u^h)^0.5",
|
||||||
"a(u,u)^0.5",
|
"a(u,u)^0.5",
|
||||||
"a(e,e)^0.5, e=u-u^h",
|
"a(e,e)^0.5, e=u-u^h",
|
||||||
"a(u^r,u^r)^0.5",
|
"a(u^r,u^r)^0.5",
|
||||||
"a(e,e)^0.5, e=u^r-u^h",
|
"a(e,e)^0.5, e=u^r-u^h",
|
||||||
"a(e,e)^0.5, e=u-u^r",
|
"a(e,e)^0.5, e=u-u^r",
|
||||||
"a(u^rr,u^rr)^0.5",
|
"L2(s^r)",
|
||||||
"a(e,e)^0.5, e=u^rr-u^h",
|
"L2(e), e=s^r-s^h"
|
||||||
"a(e,e)^0.5, e=u-u^rr"
|
|
||||||
};
|
};
|
||||||
if (!prefix) return s[i];
|
|
||||||
|
if (!haveExact) // Skip norms present only together with exact solutions
|
||||||
|
if (i == 1)
|
||||||
|
i = 3;
|
||||||
|
else if (i == 5)
|
||||||
|
i = 6;
|
||||||
|
|
||||||
|
if (!prefix && i < 8) return s[i];
|
||||||
|
|
||||||
static std::string name;
|
static std::string name;
|
||||||
name = prefix + std::string(" ") + s[i];
|
if (prefix) name = prefix + std::string(" ");
|
||||||
|
if (i < 8)
|
||||||
|
name += s[i];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char comp[16];
|
||||||
|
sprintf(comp,"norm_%lu",i);
|
||||||
|
name += comp;
|
||||||
|
}
|
||||||
|
|
||||||
return name.c_str();
|
return name.c_str();
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ public:
|
|||||||
virtual size_t getNoFields() const { return 0; }
|
virtual size_t getNoFields() const { return 0; }
|
||||||
|
|
||||||
//! \brief Returns the name of a norm quantity.
|
//! \brief Returns the name of a norm quantity.
|
||||||
static const char* getName(size_t, const char* = 0);
|
static const char* getName(size_t&, bool, const char* = 0);
|
||||||
|
|
||||||
//! \brief Returns whether a norm component stores element contributions.
|
//! \brief Returns whether a norm component stores element contributions.
|
||||||
static bool hasElementContributions(size_t i) { return i != 1; }
|
static bool hasElementContributions(size_t i) { return i != 1; }
|
||||||
|
@ -643,10 +643,10 @@ ElasticityNorm::ElasticityNorm (Elasticity& p, STensorFunc* a)
|
|||||||
|
|
||||||
size_t ElasticityNorm::getNoFields () const
|
size_t ElasticityNorm::getNoFields () const
|
||||||
{
|
{
|
||||||
size_t nf = anasol ? 6 : 2;
|
size_t nf = anasol ? 4 : 2;
|
||||||
for (size_t i = 0; i < prjsol.size(); i++)
|
for (size_t i = 0; i < prjsol.size(); i++)
|
||||||
if (!prjsol.empty())
|
if (!prjsol.empty())
|
||||||
nf += anasol ? 5 : 2;
|
nf += anasol ? 5 : 4;
|
||||||
|
|
||||||
return nf;
|
return nf;
|
||||||
}
|
}
|
||||||
@ -718,12 +718,8 @@ bool ElasticityNorm::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
|
|||||||
error = sigmar - sigmah;
|
error = sigmar - sigmah;
|
||||||
pnorm[ip++] += error.dot(Cinv*error)*detJW;
|
pnorm[ip++] += error.dot(Cinv*error)*detJW;
|
||||||
|
|
||||||
// Integrate the L2-norm ||S|| = Int_Omega S:S dV
|
double l2u = sigmar.norm2();
|
||||||
double tmp2 = sigmar.norm2();
|
double l2e = error.norm2();
|
||||||
pnorm[ip++] += tmp2*tmp2*detJW;
|
|
||||||
double tmp = error.norm2();
|
|
||||||
pnorm[ip++] += tmp*tmp*detJW;
|
|
||||||
|
|
||||||
|
|
||||||
if (anasol)
|
if (anasol)
|
||||||
{
|
{
|
||||||
@ -731,6 +727,11 @@ bool ElasticityNorm::evalInt (LocalIntegral& elmInt, const FiniteElement& fe,
|
|||||||
error = sigma - sigmar;
|
error = sigma - sigmar;
|
||||||
pnorm[ip++] += error.dot(Cinv*error)*detJW;
|
pnorm[ip++] += error.dot(Cinv*error)*detJW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Integrate the L2-norm (sigma^r,sigma^r)
|
||||||
|
pnorm[ip++] += l2u*l2u*detJW;
|
||||||
|
// Integrate the error in L2-norm (sigma^r-sigma^h,sigma^r-sigma^h)
|
||||||
|
pnorm[ip++] += l2e*l2e*detJW;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1859,11 +1859,14 @@ bool SIMbase::writeGlvN (const Matrix& norms, int iStep, int& nBlock,
|
|||||||
const char* z = 0;
|
const char* z = 0;
|
||||||
const char** p = &z;
|
const char** p = &z;
|
||||||
for (j = k = 0; k < maxN && !sID[k].empty(); j++, k++)
|
for (j = k = 0; k < maxN && !sID[k].empty(); j++, k++)
|
||||||
if (!myVtf->writeSblk(sID[k],NormBase::getName(j,*p),++idBlock,iStep,true))
|
{
|
||||||
|
const char* normName = NormBase::getName(j,this->haveAnaSol(),*p);
|
||||||
|
if (!myVtf->writeSblk(sID[k],normName,++idBlock,iStep,true))
|
||||||
return false;
|
return false;
|
||||||
else if (prefix && npc > 0)
|
|
||||||
|
if (prefix && npc > 0)
|
||||||
{
|
{
|
||||||
if (k == 2)
|
if (k == (this->haveAnaSol() ? 2 : 0))
|
||||||
p = prefix;
|
p = prefix;
|
||||||
else if (j == 2+npc)
|
else if (j == 2+npc)
|
||||||
{
|
{
|
||||||
@ -1871,6 +1874,7 @@ bool SIMbase::writeGlvN (const Matrix& norms, int iStep, int& nBlock,
|
|||||||
if (*p) p++;
|
if (*p) p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2155,13 +2159,14 @@ bool SIMbase::project (Matrix& ssol, const Vector& psol,
|
|||||||
if (!myModel[i]->evalSolution(values,*myProblem,NULL,'A'))
|
if (!myModel[i]->evalSolution(values,*myProblem,NULL,'A'))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUASI:
|
case QUASI:
|
||||||
if (msgLevel > 1 && i == 0)
|
if (msgLevel > 1 && i == 0)
|
||||||
std::cout <<"\tQuasi interpolation"<< std::endl;
|
std::cout <<"\tQuasi interpolation"<< std::endl;
|
||||||
if (!myModel[i]->evalSolution(values,*myProblem,NULL,'L'))
|
if (!myModel[i]->evalSolution(values,*myProblem,NULL,'L'))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LEASTSQ:
|
case LEASTSQ:
|
||||||
if (msgLevel > 1 && i == 0)
|
if (msgLevel > 1 && i == 0)
|
||||||
std::cout <<"\tLeast squares projection"<< std::endl;
|
std::cout <<"\tLeast squares projection"<< std::endl;
|
||||||
|
@ -352,7 +352,7 @@ void HDF5Writer::writeSIM (int level, const DataEntry& entry,
|
|||||||
for (size_t j=0;j<eNorm.rows();++j) {
|
for (size_t j=0;j<eNorm.rows();++j) {
|
||||||
if (NormBase::hasElementContributions(j)) {
|
if (NormBase::hasElementContributions(j)) {
|
||||||
Vector k;
|
Vector k;
|
||||||
writeArray(group2,NormBase::getName(j),patchEnorm.cols(),
|
writeArray(group2,NormBase::getName(j,sim->haveAnaSol()),patchEnorm.cols(),
|
||||||
patchEnorm.getRow(1+j).ptr(),H5T_NATIVE_DOUBLE);
|
patchEnorm.getRow(1+j).ptr(),H5T_NATIVE_DOUBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,7 +374,7 @@ void HDF5Writer::writeSIM (int level, const DataEntry& entry,
|
|||||||
if (entry.second.results & DataExporter::NORMS) {
|
if (entry.second.results & DataExporter::NORMS) {
|
||||||
for (size_t j=0;j<eNorm.rows();++j) {
|
for (size_t j=0;j<eNorm.rows();++j) {
|
||||||
if (NormBase::hasElementContributions(j))
|
if (NormBase::hasElementContributions(j))
|
||||||
writeArray(group2,NormBase::getName(j),0,&dummy,H5T_NATIVE_DOUBLE);
|
writeArray(group2,NormBase::getName(j,sim->haveAnaSol()),0,&dummy,H5T_NATIVE_DOUBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ bool XMLWriter::readSIM (int level, const DataEntry& entry)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void XMLWriter::writeSIM (int level, const DataEntry& entry,
|
void XMLWriter::writeSIM (int level, const DataEntry& entry,
|
||||||
bool geometryUpdated)
|
bool geometryUpdated)
|
||||||
{
|
{
|
||||||
@ -158,18 +159,21 @@ void XMLWriter::writeSIM (int level, const DataEntry& entry,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// secondary solution fields
|
// secondary solution fields
|
||||||
|
size_t i, j;
|
||||||
if (entry.second.results & DataExporter::SECONDARY)
|
if (entry.second.results & DataExporter::SECONDARY)
|
||||||
for (size_t j = 0; j < prob->getNoFields(2); j++)
|
for (j = 0; j < prob->getNoFields(2); j++)
|
||||||
addField(prob->getField2Name(j),"secondary",sim->getName()+(prob->mixedFormulation()?"-2":"-1"),1,sim->getNoPatches());
|
addField(prob->getField2Name(j),"secondary",
|
||||||
|
sim->getName() + (prob->mixedFormulation() ? "-2" : "-1"),
|
||||||
|
1,sim->getNoPatches());
|
||||||
|
|
||||||
// norms
|
// norms
|
||||||
if (entry.second.results & DataExporter::NORMS) {
|
if (entry.second.results & DataExporter::NORMS) {
|
||||||
// since the norm data isn't available, we have to instance the object
|
// since the norm data isn't available, we have to instance the object
|
||||||
NormBase* norm = sim->getNormIntegrand();
|
NormBase* norm = sim->getNormIntegrand();
|
||||||
for (size_t j = 0; j < norm->getNoFields(); j++) {
|
for (i = j = 0; i < norm->getNoFields(); i++, j++)
|
||||||
if (norm->hasElementContributions(j))
|
if (NormBase::hasElementContributions(i))
|
||||||
addField(norm->getName(j),"knotspan wise norm",sim->getName()+"-1",1,sim->getNoPatches(),"knotspan");
|
addField(NormBase::getName(j,sim->haveAnaSol()),"knotspan wise norm",
|
||||||
}
|
sim->getName()+"-1",1,sim->getNoPatches(),"knotspan");
|
||||||
delete norm;
|
delete norm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,5 +212,5 @@ int XMLWriter::realTimeLevel(int filelevel) const
|
|||||||
|
|
||||||
int XMLWriter::realTimeLevel(int filelevel, int order, int interval) const
|
int XMLWriter::realTimeLevel(int filelevel, int order, int interval) const
|
||||||
{
|
{
|
||||||
return filelevel/order*interval;
|
return filelevel/order*interval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user