Skip to content
Snippets Groups Projects
Commit e7be8b54 authored by Vinayak Gholap's avatar Vinayak Gholap
Browse files

Correction in time averaging

parent ed0d7d21
Branches
No related tags found
1 merge request!386Major update: Computing average IPVar over time period, rewriting last time...
...@@ -3838,6 +3838,9 @@ void nonLinearMechSolver::computePeriodAveragedIPDataOnPhysical(const double tst ...@@ -3838,6 +3838,9 @@ void nonLinearMechSolver::computePeriodAveragedIPDataOnPhysical(const double tst
{ {
double avgValue = 0.0; double avgValue = 0.0;
int count = 0; int count = 0;
double t_0 = 0.0;
double t_i = 0.0;
double dt = 0.0;
double sum_dt = 0.0; double sum_dt = 0.0;
   
// here can check GP against std::map coordinates for correctness // here can check GP against std::map coordinates for correctness
...@@ -3846,16 +3849,21 @@ void nonLinearMechSolver::computePeriodAveragedIPDataOnPhysical(const double tst ...@@ -3846,16 +3849,21 @@ void nonLinearMechSolver::computePeriodAveragedIPDataOnPhysical(const double tst
for(auto it = IPVariableOverTime.begin(); it != IPVariableOverTime.end(); ++it) for(auto it = IPVariableOverTime.begin(); it != IPVariableOverTime.end(); ++it)
{ {
const double t = it->first; const double t = it->first;
t_i = it->first;
if(t >= tstart && t <= tend) if(t >= tstart && t <= tend)
{ {
count++; count++;
sum_dt += t; dt = (t_i - t_0);
sum_dt += dt;
   
// compute average of IPVariable over given time period // compute average of IPVariable over given time period
//avgValue += IPVariableOverTime.at(t).at(eleNum).at(j); //avgValue += IPVariableOverTime.at(t).at(eleNum).at(j);
   
// sum(w_AV * dt) // sum(w_AV * dt)
avgValue += (IPVariableOverTime.at(t).at(eleNum).at(j)) * t; avgValue += (IPVariableOverTime.at(t).at(eleNum).at(j)) * dt;
  • Author Developer

    Mistake: w_AV * current time

    Correction: w_AV * time-step size

    Note: If time-step size dt is constant, this leads to mean of w_AV.

    Edited by Vinayak Gholap
  • Please register or sign in to reply
// update time
t_0 = t_i;
} }
} }
//avgValue /= count; //avgValue /= count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment