Skip to content
Snippets Groups Projects
Commit fbbc38fa authored by Laura Stengel's avatar Laura Stengel
Browse files

Documented IElasticity and removed unused methods.

parent e4419a07
No related branches found
No related tags found
1 merge request!231Resolve "Document Code"
......@@ -7,7 +7,9 @@
#include "CardiacData.hpp"
#include "problem/ElasticityProblem.hpp"
/**
* Interface to generate different linear and nonlinear assembles.
*/
class IElasticity : public INonLinearTimeAssemble, public ICardiacAssemble {
protected:
using IAssemble::verbose;
......@@ -24,6 +26,7 @@ protected:
//Prestress
std::unique_ptr<Vector> Prestress = nullptr;
/// Calculates the prestress for the corresponding discretization.
virtual void prestress(const Vector &u_0, Vector &pStress) = 0;
//Active Deformation
......@@ -39,8 +42,10 @@ protected:
public:
IElasticity(ElasticityProblem &eP);
/// Gets the corresponding discretization.
virtual const IDiscretization &GetDisc() const = 0;
/// Creates a new discretization with a different size.
virtual std::unique_ptr<IDiscretization> CreateDisc(int size) const = 0;
const char *Name() const override { return "Cardiac Elasticity"; }
......@@ -51,10 +56,17 @@ public:
void InitializePrestress(const Vector &u);
/**
* Clears DirichletFlags and generate Dirichlet boundary dependent of the initialize
* method in the assemble.
* Is called once per time step.
*/
virtual void Initialize(const cell &c, Vector &U) const {};
/// Updates the displacement vector to the next time step.
void FinishTimeStep(const Vector &u) override;
/// Calculates iota4 if time step is finished.
void Finalize(Vectors &vecs);
using IAssemble::Residual;
......@@ -68,10 +80,19 @@ public:
return r.norm();
}
/**
* Calculates the stiffness part k_p for the traction boundary q(u,v,n) = k_p * u + c_p * v and
stores it in matrix form.
*/
virtual void TractionStiffness(Matrix &matrix) const {};
/**
* Calculates the stiffness part c_p for the traction boundary q(u,v,n) = k_p * u + c_p * v and
stores it in matrix form.
*/
virtual void TractionViscosity(Matrix &matrix) const {};
/// Calculates the residual including viscous part.
virtual double ViscoResidual(const Vector &u, const Vector &v, Vector &defect) const {
defect = *Prestress;
TRY {
......@@ -83,11 +104,13 @@ public:
return defect.norm();
}
/// Calculates the residual including viscous part for every cell.
virtual void
ViscoResidual(const cell &c, const Vector &u, const Vector &v, Vector &defect) const {
Residual(c, u, defect);
}
/// Calculate Jacobi including viscous part.
virtual void ViscoJacobi(const Vector &u, const Vector &v, Matrix &jacobi) const {
jacobi = 0;
TRY {
......@@ -97,36 +120,42 @@ public:
jacobi.ClearDirichletValues();
}
/// Calculate Jacobi including viscous part for every cell.
virtual void ViscoJacobi(const cell &c, const Vector &u, const Vector &v, Matrix &jacobi) const {
Jacobi(c, u, jacobi);
}
virtual void GetStress(const Vector &u, Vector &stress) const = 0;
/// Calculates the invariant iota4.
virtual void GetInvariant(const Vector &u, Vector &iota4) const = 0;
virtual void PlotFibres(const Vector &u, VtuPlot &plot) const {}
void PlotDisplacement(const Vector &u, int step, const string &varname) const;
/**
* Creates a new vector with the discretization of target (coarse vector) and projects fine
vector on it.
*/
Vector Projection(const Vector &target, const Vector &fine) const {
Vector v(0.0, target);
Project(fine, v);
return v;
}
/// Project fine vector on coarse vector.
virtual void Project(const Vector &fine, Vector &u) const {
Warning("No Projection implemented")
}
/**
* Creates a new vector with the discretization of the fine vector and interpolates it on the
* coarse vector.
*/
Vector Interpolation(const Vector &coarse, const Vector &target) const {
Vector v(target);
Interpolate(coarse, v);
return v;
}
/// Interpolates the fine vector through the coarse vector.
virtual void Interpolate(const Vector &coarse, Vector &u) const {
Warning("No Interpolation implemented")
}
......@@ -193,10 +222,12 @@ public:
return 0.0;
}
/// For coupled system to update the stretch gamma_f.
virtual void UpdateStretch(const Vector &gamma_f) const {
Warning("UpdateStretch is not defined")
};
/// Sets the displacement for a problem with exact solution.
virtual void SetDisplacement(Vector &u) const {
Warning("SetDisplacement is not defined")
};
......@@ -205,7 +236,6 @@ public:
return eProblem;
}
virtual void PlotBoundary(const Vector &U, const Vector &scal) const {
Warning("Nothing to Plot")
};
......@@ -214,21 +244,28 @@ public:
void SetInitialValue(Vectors &values);
/// Every time step will be plotted if we are in the dynamic case.
void PlotIteration(const Vector &u) const override;
void PlotIteration(const Vectors &u, int step = -1) const;
/// Every pressure step will be plotted (static).
void PlotPressureIteration(const Vector &u, int step) const;
/// Prints some information after every time step.
void PrintIteration(const Vector &u) const override;
/// Prints some information after every pressure step.
void PrintPressureIteration(const Vector &u) const;
};
/**
* Is searching for the current discretization and than calls the function CreateFiniteElasticityAssemble
to create different assembles.
*/
std::unique_ptr<IElasticity>
CreateFiniteElasticityAssemble(ElasticityProblem &elasticityProblem, int degree, bool isStatic);
/// Creates different ElasticityAssembles, e.g. Lagrange, DG and EG.
std::unique_ptr<IElasticity>
CreateFiniteElasticityAssemble(ElasticityProblem &elasticityProblem, const std::string &modelName,
int degree, bool isStatic);
......
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