Skip to content

Commit

Permalink
Tempus: add error estimator for selected methods
Browse files Browse the repository at this point in the history
- SSPERK22
- SSPERK33
  • Loading branch information
Sidafa Conde committed Jul 7, 2020
1 parent 4036135 commit 5b00be2
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions packages/tempus/src/Tempus_StepperRKButcherTableau.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ class StepperERK_3Stage3rdOrderTVD :
void setupTableau()
{
typedef Teuchos::ScalarTraits<Scalar> ST;
using Teuchos::as;
const Scalar one = ST::one();
const Scalar zero = ST::zero();
const Scalar onehalf = one/(2*one);
Expand All @@ -1080,6 +1081,7 @@ class StepperERK_3Stage3rdOrderTVD :
Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);

// Fill A:
A(0,0) = zero; A(0,1) = zero; A(0,2) = zero;
Expand All @@ -1092,10 +1094,15 @@ class StepperERK_3Stage3rdOrderTVD :
// fill c:
c(0) = zero; c(1) = one; c(2) = onehalf;

// Fill bstar:
bstar(0) = as<Scalar>(0.291485418878409);
bstar(1) = as<Scalar>(0.291485418878409);
bstar(2) = as<Scalar>(0.417029162243181);

int order = 3;

this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
this->getStepperType(),A,b,c,order,order,order));
this->getStepperType(),A,b,c,order,order,order,bstar));
}
};

Expand Down Expand Up @@ -1448,7 +1455,8 @@ class StepperERK_Ralston :
* \;\;\;\;\mbox{ where }\;\;\;\;
* \begin{array}{c|cc} 0 & 0 & \\
* 1 & 1 & 0 \\ \hline
* & 1/2 & 1/2 \end{array}
* & 1/2 & 1/2 \\
* & 3/4 & 1/4 \end{array}
* \f]
*/
template<class Scalar>
Expand Down Expand Up @@ -1502,10 +1510,11 @@ class StepperERK_Trapezoidal :
std::ostringstream Description;
Description << this->getStepperType() << "\n"
<< "This Stepper is known as 'RK Explicit Trapezoidal' or 'Heuns Method' or 'SSPERK22'.\n"
<< "c = [ 0 1 ]'\n"
<< "A = [ 0 ]\n"
<< " [ 1 0 ]\n"
<< "b = [ 1/2 1/2 ]'";
<< "c = [ 0 1 ]'\n"
<< "A = [ 0 ]\n"
<< " [ 1 0 ]\n"
<< "b = [ 1/2 1/2 ]\n"
<< "bstart = [ 3/4 1/4 ]'";
return Description.str();
}

Expand All @@ -1514,6 +1523,7 @@ class StepperERK_Trapezoidal :
void setupTableau()
{
typedef Teuchos::ScalarTraits<Scalar> ST;
using Teuchos::as;
const Scalar one = ST::one();
const Scalar zero = ST::zero();
const Scalar onehalf = one/(2*one);
Expand All @@ -1522,6 +1532,7 @@ class StepperERK_Trapezoidal :
Teuchos::SerialDenseMatrix<int,Scalar> A(NumStages,NumStages);
Teuchos::SerialDenseVector<int,Scalar> b(NumStages);
Teuchos::SerialDenseVector<int,Scalar> c(NumStages);
Teuchos::SerialDenseVector<int,Scalar> bstar(NumStages);

// Fill A:
A(0,0) = zero; A(0,1) = zero;
Expand All @@ -1533,10 +1544,14 @@ class StepperERK_Trapezoidal :
// fill c:
c(0) = zero; c(1) = one;

// Fill bstar
bstar(0) = as<Scalar>(3*one/(4*one));
bstar(1) = as<Scalar>(1*one/(4*one));

int order = 2;

this->tableau_ = Teuchos::rcp(new RKButcherTableau<Scalar>(
this->getStepperType(),A,b,c,order,order,order));
this->getStepperType(),A,b,c,order,order,order,bstar));
}
};

Expand Down

0 comments on commit 5b00be2

Please sign in to comment.