Skip to content
Snippets Groups Projects
Commit 4bece3c2 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

[Cleanup] Rename: problem_*-> *

parent ac36e7c8
No related branches found
No related tags found
No related merge requests found
...@@ -8,10 +8,9 @@ class TimeSteppingScheme { ...@@ -8,10 +8,9 @@ class TimeSteppingScheme {
public: public:
void virtual nextTimeStep() = 0; void virtual nextTimeStep() = 0;
void virtual setup(VectorType const &ell, double _tau, double time, void virtual setup(VectorType const &ell, double _tau, double time,
VectorType &problem_rhs, VectorType &problem_iterate, VectorType &rhs, VectorType &iterate, MatrixType &AB) = 0;
MatrixType &problem_AB) = 0;
void virtual postProcess(VectorType const &problem_iterate) = 0; void virtual postProcess(VectorType const &iterate) = 0;
void virtual extractDisplacement(VectorType &displacement) const = 0; void virtual extractDisplacement(VectorType &displacement) const = 0;
void virtual extractVelocity(VectorType &velocity) const = 0; void virtual extractVelocity(VectorType &velocity) const = 0;
}; };
......
...@@ -19,8 +19,8 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() { ...@@ -19,8 +19,8 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() {
template <class VectorType, class MatrixType, class FunctionType, int dim> template <class VectorType, class MatrixType, class FunctionType, int dim>
void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup( void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup(
VectorType const &ell, double _tau, double time, VectorType &problem_rhs, VectorType const &ell, double _tau, double time, VectorType &rhs,
VectorType &problem_iterate, MatrixType &problem_AM) { VectorType &iterate, MatrixType &AM) {
postProcessCalled = false; postProcessCalled = false;
tau = _tau; tau = _tau;
...@@ -54,38 +54,38 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup( ...@@ -54,38 +54,38 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup(
indices.import(A); indices.import(A);
indices.import(M); indices.import(M);
indices.import(C); indices.import(C);
indices.exportIdx(problem_AM); indices.exportIdx(AM);
} }
problem_AM = 0.0; AM = 0.0;
Arithmetic::addProduct(problem_AM, (1.0 - wc) / tau, M); Arithmetic::addProduct(AM, (1.0 - wc) / tau, M);
Arithmetic::addProduct(problem_AM, wc, C); Arithmetic::addProduct(AM, wc, C);
Arithmetic::addProduct(problem_AM, tau, A); Arithmetic::addProduct(AM, tau, A);
// set up RHS // set up RHS
{ {
problem_rhs = ell; rhs = ell;
Arithmetic::addProduct(problem_rhs, (1.0 - wc) / tau, M, v_o); Arithmetic::addProduct(rhs, (1.0 - wc) / tau, M, v_o);
Arithmetic::subtractProduct(problem_rhs, A, u_o); Arithmetic::subtractProduct(rhs, A, u_o);
} }
// v_o makes a good initial iterate; we could use anything, though // v_o makes a good initial iterate; we could use anything, though
problem_iterate = 0.0; iterate = 0.0;
for (size_t i = 0; i < dirichletNodes.size(); ++i) for (size_t i = 0; i < dirichletNodes.size(); ++i)
switch (dirichletNodes[i].count()) { switch (dirichletNodes[i].count()) {
case 0: case 0:
continue; continue;
case dim: case dim:
problem_iterate[i] = 0; iterate[i] = 0;
dirichletFunction.evaluate(time, problem_iterate[i][0]); dirichletFunction.evaluate(time, iterate[i][0]);
break; break;
case 1: case 1:
if (dirichletNodes[i][0]) { if (dirichletNodes[i][0]) {
dirichletFunction.evaluate(time, problem_iterate[i][0]); dirichletFunction.evaluate(time, iterate[i][0]);
break; break;
} }
if (dirichletNodes[i][1]) { if (dirichletNodes[i][1]) {
problem_iterate[i][1] = 0; iterate[i][1] = 0;
break; break;
} }
assert(false); assert(false);
...@@ -96,10 +96,10 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup( ...@@ -96,10 +96,10 @@ void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::setup(
template <class VectorType, class MatrixType, class FunctionType, int dim> template <class VectorType, class MatrixType, class FunctionType, int dim>
void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::postProcess( void BackwardEuler<VectorType, MatrixType, FunctionType, dim>::postProcess(
VectorType const &problem_iterate) { VectorType const &iterate) {
postProcessCalled = true; postProcessCalled = true;
v = problem_iterate; v = iterate;
u = u_o; u = u_o;
Arithmetic::addProduct(u, tau, v); Arithmetic::addProduct(u, tau, v);
......
...@@ -21,8 +21,8 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() { ...@@ -21,8 +21,8 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::nextTimeStep() {
template <class VectorType, class MatrixType, class FunctionType, int dim> template <class VectorType, class MatrixType, class FunctionType, int dim>
void Newmark<VectorType, MatrixType, FunctionType, dim>::setup( void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
VectorType const &ell, double _tau, double time, VectorType &problem_rhs, VectorType const &ell, double _tau, double time, VectorType &rhs,
VectorType &problem_iterate, MatrixType &problem_AM) { VectorType &iterate, MatrixType &AM) {
postProcessCalled = false; postProcessCalled = false;
tau = _tau; tau = _tau;
...@@ -57,40 +57,40 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup( ...@@ -57,40 +57,40 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
indices.import(A); indices.import(A);
indices.import(M); indices.import(M);
indices.import(C); indices.import(C);
indices.exportIdx(problem_AM); indices.exportIdx(AM);
} }
problem_AM = 0.0; AM = 0.0;
Arithmetic::addProduct(problem_AM, (1.0 - wc) * 2.0 / tau, M); Arithmetic::addProduct(AM, (1.0 - wc) * 2.0 / tau, M);
Arithmetic::addProduct(problem_AM, wc, C); Arithmetic::addProduct(AM, wc, C);
Arithmetic::addProduct(problem_AM, tau / 2.0, A); Arithmetic::addProduct(AM, tau / 2.0, A);
// set up RHS // set up RHS
{ {
problem_rhs = ell; rhs = ell;
Arithmetic::addProduct(problem_rhs, (1.0 - wc) * 2.0 / tau, M, v_o); Arithmetic::addProduct(rhs, (1.0 - wc) * 2.0 / tau, M, v_o);
Arithmetic::addProduct(problem_rhs, 1.0 - wc, M, a_o); Arithmetic::addProduct(rhs, 1.0 - wc, M, a_o);
Arithmetic::subtractProduct(problem_rhs, tau / 2.0, A, v_o); Arithmetic::subtractProduct(rhs, tau / 2.0, A, v_o);
Arithmetic::subtractProduct(problem_rhs, A, u_o); Arithmetic::subtractProduct(rhs, A, u_o);
} }
// v_o makes a good initial iterate; we could use anything, though // v_o makes a good initial iterate; we could use anything, though
problem_iterate = 0.0; iterate = 0.0;
for (size_t i = 0; i < dirichletNodes.size(); ++i) for (size_t i = 0; i < dirichletNodes.size(); ++i)
switch (dirichletNodes[i].count()) { switch (dirichletNodes[i].count()) {
case 0: case 0:
continue; continue;
case dim: case dim:
problem_iterate[i] = 0; iterate[i] = 0;
dirichletFunction.evaluate(time, problem_iterate[i][0]); dirichletFunction.evaluate(time, iterate[i][0]);
break; break;
case 1: case 1:
if (dirichletNodes[i][0]) { if (dirichletNodes[i][0]) {
dirichletFunction.evaluate(time, problem_iterate[i][0]); dirichletFunction.evaluate(time, iterate[i][0]);
break; break;
} }
if (dirichletNodes[i][1]) { if (dirichletNodes[i][1]) {
problem_iterate[i][1] = 0; iterate[i][1] = 0;
break; break;
} }
assert(false); assert(false);
...@@ -101,10 +101,10 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup( ...@@ -101,10 +101,10 @@ void Newmark<VectorType, MatrixType, FunctionType, dim>::setup(
template <class VectorType, class MatrixType, class FunctionType, int dim> template <class VectorType, class MatrixType, class FunctionType, int dim>
void Newmark<VectorType, MatrixType, FunctionType, dim>::postProcess( void Newmark<VectorType, MatrixType, FunctionType, dim>::postProcess(
VectorType const &problem_iterate) { VectorType const &iterate) {
postProcessCalled = true; postProcessCalled = true;
v = problem_iterate; v = iterate;
// u1 = tau/2 ( v1 + v0 ) + u0 // u1 = tau/2 ( v1 + v0 ) + u0
u = u_o; u = u_o;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment