ug4
|
Interface providing Jacobian and Defect of a discretization. More...
#include <assemble_interface.h>
Public Types | |
typedef TAlgebra | algebra_type |
Algebra type. More... | |
typedef TAlgebra::matrix_type | matrix_type |
Type of algebra matrix. More... | |
typedef TAlgebra::vector_type | vector_type |
Type of algebra vector. More... | |
Public Member Functions | |
void | adjust_solution (vector_type &u) |
virtual void | adjust_solution (vector_type &u, const GridLevel &gl)=0 |
sets dirichlet values in solution vector More... | |
void | assemble_defect (vector_type &d, const vector_type &u) |
virtual void | assemble_defect (vector_type &d, const vector_type &u, const GridLevel &gl)=0 |
assembles Defect More... | |
void | assemble_jacobian (matrix_type &J, const vector_type &u) |
virtual void | assemble_jacobian (matrix_type &J, const vector_type &u, const GridLevel &gl)=0 |
assembles Jacobian (or Approximation of Jacobian) More... | |
void | assemble_linear (matrix_type &A, vector_type &b) |
virtual void | assemble_linear (matrix_type &A, vector_type &b, const GridLevel &gl)=0 |
Assembles Matrix and Right-Hand-Side for a linear problem. More... | |
void | assemble_mass_matrix (matrix_type &M, const vector_type &u) |
virtual void | assemble_mass_matrix (matrix_type &M, const vector_type &u, const GridLevel &gl) |
assembles mass matrix More... | |
void | assemble_rhs (vector_type &b) |
virtual void | assemble_rhs (vector_type &b, const GridLevel &gl)=0 |
Assembles Right-Hand-Side for a linear problem. More... | |
virtual void | assemble_rhs (vector_type &rhs, const vector_type &u) |
virtual void | assemble_rhs (vector_type &rhs, const vector_type &u, const GridLevel &gl)=0 |
assembles rhs More... | |
void | assemble_stiffness_matrix (matrix_type &A, const vector_type &u) |
virtual void | assemble_stiffness_matrix (matrix_type &A, const vector_type &u, const GridLevel &gl) |
assembles stiffness matrix More... | |
virtual SmartPtr< IConstraint< TAlgebra > > | constraint (size_t i)=0 |
returns the i'th constraint More... | |
virtual size_t | num_constraints () const =0 |
returns the number of constraints More... | |
virtual | ~IAssemble () |
Virtual Destructor. More... | |
virtual SmartPtr< AssemblingTuner< TAlgebra > > | ass_tuner ()=0 |
virtual ConstSmartPtr< AssemblingTuner< TAlgebra > > | ass_tuner () const =0 |
Interface providing Jacobian and Defect of a discretization.
Interface to generate Jacobi-Matrices and Defect-Vectors for a nonlinear problem and to compute Matrix and Right-Hand Side for a linear problem.
The Interface can be used directly to compute Jacobian and Defect (resp. Mass-Stiffness-matrix_type and right-hand side) in case of nonlinear (resp. linear) problem. Furthermore, the interface is used in the NewtonSolver and MultiGridSolver. The NewtonSolver uses the functions assemble_defect+assemble_jacobian or assemble_jacobian_defect. The MultiGridSolver uses the function assemble_jacobian in order to assemble coarse grid Matrices.
To give an idea of the usage, an implementation should obey this rules:
\[ d(u^k) = \sum_{i=0}^{l-1} s_{m,i} M(u^{k-i}) + s_{a,i} \{A(u^{k-i}) - f\} \]
and assemble_linear will return false.\[ d(u^k) = \sum_{i=0}^{l-1} s_{m,i} M*u^{k-i} + s_{a,i} \{A*u^{k-i} - f \} J(u^k) = s_{m,0}*M + s_{a,0} A \]
and assemble_linear will compute \( A = s_{m,0}*M + s_{a,0} A \) and \( b = - \{ \sum_{i=1}^{l-1} s_{m,i} M*u^{k-i} + s_{a,i} \{A*u^{k-i} - f\} \} + s_{a,0} * f \)\[ d(u) = A(u) - f \]
and assemble_linear will return false.Stationary linear Problem \( A*u = f \). Then, the defect will be
\[ d(u) = A*u - f J(u) = A \]
and assemble_linear will compute \( A = A \) and \( b = f \).
TAlgebra | Algebra type |
typedef TAlgebra ug::IAssemble< TAlgebra >::algebra_type |
Algebra type.
typedef TAlgebra::matrix_type ug::IAssemble< TAlgebra >::matrix_type |
Type of algebra matrix.
typedef TAlgebra::vector_type ug::IAssemble< TAlgebra >::vector_type |
Type of algebra vector.
|
inlinevirtual |
Virtual Destructor.
|
inline |
References ug::IAssemble< TAlgebra >::adjust_solution().
|
pure virtual |
sets dirichlet values in solution vector
Sets dirichlet values of the NumericalSolution u when components are dirichlet
[out] | u | Numerical Solution |
[in] | gl | Grid Level |
Implemented in ug::IDomainDiscretization< TAlgebra >, ug::SDIRK< TAlgebra >, ug::MultiStepTimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
Referenced by ug::IAssemble< TAlgebra >::adjust_solution().
|
pure virtual |
Implemented in ug::ITimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
|
pure virtual |
Implemented in ug::ITimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
|
inline |
References ug::IAssemble< TAlgebra >::assemble_defect().
|
pure virtual |
assembles Defect
Assembles Defect at a given Solution u.
[out] | d | Defect d(u) to be filled |
[in] | u | Current iterate |
[in] | gl | Grid Level |
Implemented in ug::IDomainDiscretization< TAlgebra >, ug::SDIRK< TAlgebra >, ug::MultiStepTimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
Referenced by ug::IAssemble< TAlgebra >::assemble_defect().
|
inline |
References ug::IAssemble< TAlgebra >::assemble_jacobian().
|
pure virtual |
assembles Jacobian (or Approximation of Jacobian)
Assembles Jacobian at a given iterate u.
[out] | J | Jacobian J(u) matrix to be filled |
[in] | u | Current iterate |
[in] | gl | Grid Level |
Implemented in ug::IDomainDiscretization< TAlgebra >, ug::SDIRK< TAlgebra >, ug::MultiStepTimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
Referenced by ug::IAssemble< TAlgebra >::assemble_jacobian().
|
inline |
References ug::IAssemble< TAlgebra >::assemble_linear().
|
pure virtual |
Assembles Matrix and Right-Hand-Side for a linear problem.
Assembles matrix_type and Right-Hand-Side for a linear problem
[out] | A | Mass-/Stiffness- Matrix |
[out] | b | Right-Hand-Side |
[in] | gl | Grid Level |
Implemented in ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >, ug::IDomainDiscretization< TAlgebra >, ug::SDIRK< TAlgebra >, ug::MultiStepTimeDiscretization< TAlgebra >, and ug::CompositeTimeDiscretization< TAlgebra >.
Referenced by ug::IAssemble< TAlgebra >::assemble_linear().
|
inline |
|
inlinevirtual |
assembles mass matrix
Reimplemented in ug::IDomainDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
References UG_THROW.
Referenced by ug::IAssemble< TAlgebra >::assemble_mass_matrix().
|
inline |
References ug::IAssemble< TAlgebra >::assemble_rhs().
|
pure virtual |
Assembles Right-Hand-Side for a linear problem.
Assembles Right-Hand-Side for a linear problem
[out] | b | Right-Hand-Side |
[in] | gl | Grid Level |
Implemented in ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >, ug::IDomainDiscretization< TAlgebra >, ug::SDIRK< TAlgebra >, ug::MultiStepTimeDiscretization< TAlgebra >, and ug::CompositeTimeDiscretization< TAlgebra >.
|
inlinevirtual |
References ug::IAssemble< TAlgebra >::assemble_rhs().
|
pure virtual |
assembles rhs
Implemented in ug::IDomainDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >, ug::SDIRK< TAlgebra >, ug::MultiStepTimeDiscretization< TAlgebra >, and ug::CompositeTimeDiscretization< TAlgebra >.
Referenced by ug::IAssemble< TAlgebra >::assemble_rhs().
|
inline |
|
inlinevirtual |
assembles stiffness matrix
Reimplemented in ug::IDomainDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
References UG_THROW.
Referenced by ug::IAssemble< TAlgebra >::assemble_stiffness_matrix().
|
pure virtual |
returns the i'th constraint
Implemented in ug::IDomainDiscretization< TAlgebra >, ug::ITimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.
|
pure virtual |
returns the number of constraints
Implemented in ug::IDomainDiscretization< TAlgebra >, ug::ITimeDiscretization< TAlgebra >, ug::CompositeTimeDiscretization< TAlgebra >, ug::DomainDiscretizationBase< TDomain, TAlgebra, TGlobAssembler >, ug::DomainDiscretizationBase< TDomain, TAlgebra, LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > >, and ug::DomainDiscretizationBase< TDomain, TAlgebra, StdGlobAssembler< TDomain, TAlgebra > >.