Changed: Always use SIMinput::adm::cout (and not IFEM::cout)
when printing norms and convergence history for the MultiStepSIM drivers.
This commit is contained in:
parent
ffb7db391e
commit
46b6834208
@ -138,7 +138,7 @@ SIM::ConvStatus EigenModeSIM::solveStep (TimeStep& param, SIM::SolutionMode,
|
|||||||
for (size_t i = 0; i < amplitude.size() && i < modes.size(); i++)
|
for (size_t i = 0; i < amplitude.size() && i < modes.size(); i++)
|
||||||
solution.front().add(modes[i].eigVec,amplitude[i]*sin(modes[i].eigVal*t));
|
solution.front().add(modes[i].eigVec,amplitude[i]*sin(modes[i].eigVal*t));
|
||||||
|
|
||||||
if (msgLevel >= 0 && myPid == 0) std::cout << std::endl;
|
if (msgLevel >= 0) model.getProcessAdm().cout << std::endl;
|
||||||
return this->solutionNorms(param.time,zero_tolerance,outPrec) ?
|
return this->solutionNorms(param.time,zero_tolerance,outPrec) ?
|
||||||
SIM::CONVERGED : SIM::FAILURE;
|
SIM::CONVERGED : SIM::FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -314,12 +314,11 @@ SIM::ConvStatus NewmarkSIM::solveStep (TimeStep& param, SIM::SolutionMode,
|
|||||||
|
|
||||||
if (msgLevel >= 0)
|
if (msgLevel >= 0)
|
||||||
{
|
{
|
||||||
std::streamsize oldPrec = 0;
|
utl::LogStream& cout = model.getProcessAdm().cout;
|
||||||
double digits = log10(param.time.t)-log10(param.time.dt);
|
double digits = log10(param.time.t)-log10(param.time.dt);
|
||||||
if (digits > 6.0) oldPrec = IFEM::cout.precision(ceil(digits));
|
size_t stdPrec = digits > 6.0 ? cout.precision(ceil(digits)) : 0;
|
||||||
IFEM::cout <<"\n step="<< param.step
|
cout <<"\n step="<< param.step <<" time="<< param.time.t << std::endl;
|
||||||
<<" time="<< param.time.t << std::endl;
|
if (digits > 6.0) cout.precision(stdPrec);
|
||||||
if (digits > 6.0) IFEM::cout.precision(oldPrec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subiter&FIRST && !model.updateDirichlet(param.time.t,&solution.front()))
|
if (subiter&FIRST && !model.updateDirichlet(param.time.t,&solution.front()))
|
||||||
@ -462,15 +461,16 @@ SIM::ConvStatus NewmarkSIM::checkConvergence (TimeStep& param)
|
|||||||
if (msgLevel > 0)
|
if (msgLevel > 0)
|
||||||
{
|
{
|
||||||
// Print convergence history
|
// Print convergence history
|
||||||
std::ios::fmtflags oldFlags = IFEM::cout.flags(std::ios::scientific);
|
utl::LogStream& cout = model.getProcessAdm().cout;
|
||||||
std::streamsize oldPrec = IFEM::cout.precision(3);
|
std::ios::fmtflags stdFlags = cout.flags(std::ios::scientific);
|
||||||
IFEM::cout <<" iter="<< param.iter
|
std::streamsize stdPrec = cout.precision(3);
|
||||||
<<" conv="<< fabs(norm)
|
cout <<" iter="<< param.iter
|
||||||
<<" enen="<< norms[0]
|
<<" conv="<< fabs(norm)
|
||||||
<<" resn="<< norms[1]
|
<<" enen="<< norms[0]
|
||||||
<<" incn="<< norms[2] << std::endl;
|
<<" resn="<< norms[1]
|
||||||
IFEM::cout.flags(oldFlags);
|
<<" incn="<< norms[2] << std::endl;
|
||||||
IFEM::cout.precision(oldPrec);
|
cout.flags(stdFlags);
|
||||||
|
cout.precision(stdPrec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for convergence or divergence
|
// Check for convergence or divergence
|
||||||
|
@ -47,17 +47,21 @@ NonLinSIM::~NonLinSIM ()
|
|||||||
{
|
{
|
||||||
if (slowNodes.empty()) return;
|
if (slowNodes.empty()) return;
|
||||||
|
|
||||||
|
utl::LogStream& cout = model.getProcessAdm().cout;
|
||||||
|
|
||||||
std::map<int,int>::const_iterator nit;
|
std::map<int,int>::const_iterator nit;
|
||||||
std::cout <<"\n *** Here are the nodal points flagged with slow convergence"
|
cout <<"\n *** Here are the nodal points flagged with slow convergence"
|
||||||
<<"\n ======================================================="
|
<<"\n ======================================================="
|
||||||
<<"\n Node Count Patch Coordinates\n";
|
<<"\n Node Count Patch Coordinates\n";
|
||||||
for (nit = slowNodes.begin(); nit != slowNodes.end(); ++nit)
|
for (nit = slowNodes.begin(); nit != slowNodes.end(); ++nit)
|
||||||
{
|
{
|
||||||
Vec4 X = model.getNodeCoord(nit->first);
|
Vec4 X = model.getNodeCoord(nit->first);
|
||||||
std::cout << std::setw(9) << nit->first
|
cout << std::setw(9) << nit->first
|
||||||
<< std::setw(5) << nit->second
|
<< std::setw(5) << nit->second
|
||||||
<< std::setw(7) << X.idx <<" ";
|
<< std::setw(7) << X.idx <<" ";
|
||||||
X.Vec3::print(std::cout) << std::endl;
|
for (int i = 0; i < 3; i++)
|
||||||
|
cout <<" "<< utl::trunc(X[i]);
|
||||||
|
cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,20 +201,15 @@ ConvStatus NonLinSIM::solveStep (TimeStep& param, SolutionMode mode,
|
|||||||
|
|
||||||
if (msgLevel >= 0)
|
if (msgLevel >= 0)
|
||||||
{
|
{
|
||||||
std::streamsize oldPrec = 0;
|
utl::LogStream& cout = model.getProcessAdm().cout;
|
||||||
double digits = log10(param.time.t)-log10(param.time.dt);
|
double digits = log10(param.time.t)-log10(param.time.dt);
|
||||||
if (digits > 6.0)
|
std::streamsize oldPrec = digits > 6.0 ? cout.precision(ceil(digits)) : 0;
|
||||||
{
|
cout <<"\n step="<< param.step <<" time="<< param.time.t;
|
||||||
oldPrec = std::cout.precision();
|
|
||||||
model.getProcessAdm().cout << std::setprecision(ceil(digits));
|
|
||||||
}
|
|
||||||
model.getProcessAdm().cout <<"\n step="<< param.step <<" time="<< param.time.t;
|
|
||||||
if (param.maxCFL > 0.0)
|
if (param.maxCFL > 0.0)
|
||||||
model.getProcessAdm().cout <<" CFL = "<< param.time.CFL << std::endl;
|
cout <<" CFL = "<< param.time.CFL << std::endl;
|
||||||
else
|
else
|
||||||
model.getProcessAdm().cout << std::endl;
|
cout << std::endl;
|
||||||
if (oldPrec > 0)
|
if (oldPrec > 0) cout << std::setprecision(oldPrec);
|
||||||
model.getProcessAdm().cout << std::setprecision(oldPrec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
param.iter = 0;
|
param.iter = 0;
|
||||||
@ -427,46 +426,47 @@ ConvStatus NonLinSIM::checkConvergence (TimeStep& param)
|
|||||||
if (msgLevel > 0)
|
if (msgLevel > 0)
|
||||||
{
|
{
|
||||||
// Print convergence history
|
// Print convergence history
|
||||||
std::ios::fmtflags oldFlags = std::cout.flags(std::ios::scientific);
|
utl::LogStream& cout = model.getProcessAdm().cout;
|
||||||
std::streamsize oldPrec = std::cout.precision(3);
|
std::ios::fmtflags oldFlags = cout.flags(std::ios::scientific);
|
||||||
model.getProcessAdm().cout <<" iter="<< param.iter
|
std::streamsize oldPrec = cout.precision(3);
|
||||||
<<" conv="<< fabs(norm)
|
cout <<" iter="<< param.iter
|
||||||
<<" enen="<< enorm
|
<<" conv="<< fabs(norm)
|
||||||
<<" resn="<< resNorm
|
<<" enen="<< enorm
|
||||||
<<" incn="<< linsolNorm << std::endl;
|
<<" resn="<< resNorm
|
||||||
|
<<" incn="<< linsolNorm << std::endl;
|
||||||
if (status == SLOW && prnSlow > 0)
|
if (status == SLOW && prnSlow > 0)
|
||||||
{
|
{
|
||||||
// Find and print out the worst DOF(s) when detecting slow convergence
|
// Find and print out the worst DOF(s) when detecting slow convergence
|
||||||
std::map<std::pair<int,int>,RealArray> worstDOFs;
|
std::map<std::pair<int,int>,RealArray> worstDOFs;
|
||||||
model.getWorstDofs(linsol,residual,prnSlow,convTol*refNorm,worstDOFs);
|
model.getWorstDofs(linsol,residual,prnSlow,convTol*refNorm,worstDOFs);
|
||||||
std::cout <<" ** Slow convergence detected";
|
cout <<" ** Slow convergence detected";
|
||||||
if (worstDOFs.size() > 1)
|
if (worstDOFs.size() > 1)
|
||||||
std::cout <<", here are the "<< worstDOFs.size() <<" worst DOFs:";
|
cout <<", here are the "<< worstDOFs.size() <<" worst DOFs:";
|
||||||
else if (worstDOFs.size() == 1)
|
else if (worstDOFs.size() == 1)
|
||||||
std::cout <<", here is the worst DOF:";
|
cout <<", here is the worst DOF:";
|
||||||
else
|
else
|
||||||
std::cout <<".";
|
cout <<".";
|
||||||
std::map<std::pair<int,int>,RealArray>::const_iterator it;
|
std::map<std::pair<int,int>,RealArray>::const_iterator it;
|
||||||
for (it = worstDOFs.begin(); it != worstDOFs.end(); it++)
|
for (it = worstDOFs.begin(); it != worstDOFs.end(); it++)
|
||||||
{
|
{
|
||||||
std::cout <<"\n Node "<< it->first.first
|
cout <<"\n Node "<< it->first.first
|
||||||
<<" local DOF "<< it->first.second;
|
<<" local DOF "<< it->first.second;
|
||||||
char nodeType = model.getNodeType(it->first.first);
|
char nodeType = model.getNodeType(it->first.first);
|
||||||
if (nodeType != ' ')
|
if (nodeType != ' ')
|
||||||
std::cout <<" ("<< nodeType <<")";
|
cout <<" ("<< nodeType <<")";
|
||||||
std::cout <<" :\tEnergy = "<< it->second[0]
|
cout <<" :\tEnergy = "<< it->second[0]
|
||||||
<<"\tdu = "<< it->second[1]
|
<<"\tdu = "<< it->second[1]
|
||||||
<<"\tres = "<< it->second[2];
|
<<"\tres = "<< it->second[2];
|
||||||
std::map<int,int>::iterator nit = slowNodes.find(it->first.first);
|
std::map<int,int>::iterator nit = slowNodes.find(it->first.first);
|
||||||
if (nit == slowNodes.end())
|
if (nit == slowNodes.end())
|
||||||
slowNodes.insert(std::make_pair(it->first.first,1));
|
slowNodes.insert(std::make_pair(it->first.first,1));
|
||||||
else
|
else
|
||||||
++nit->second;
|
++nit->second;
|
||||||
}
|
}
|
||||||
std::cout << std::endl;
|
cout << std::endl;
|
||||||
}
|
}
|
||||||
std::cout.flags(oldFlags);
|
cout.flags(oldFlags);
|
||||||
std::cout.precision(oldPrec);
|
cout.precision(oldPrec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for convergence or divergence
|
// Check for convergence or divergence
|
||||||
|
Loading…
Reference in New Issue
Block a user