Chaste Release::3.1
|
#include <AbstractNonlinearAssemblerSolverHybrid.hpp>
Public Member Functions | |
void | ComputeResidual (const Vec currentGuess, Vec residualVector) |
void | ComputeJacobian (const Vec currentGuess, Mat *pJacobian) |
AbstractNonlinearAssemblerSolverHybrid (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > *pBoundaryConditions, unsigned numQuadPoints=2) | |
virtual | ~AbstractNonlinearAssemblerSolverHybrid () |
virtual Vec | Solve (Vec initialGuess, bool useAnalyticalJacobian=false) |
void | SetNonlinearSolver (AbstractNonlinearSolver *pNonlinearSolver) |
bool | VerifyJacobian (double tol) |
Protected Member Functions | |
void | ApplyDirichletConditions (Vec currentGuess, Vec residual, Mat *pMat) |
void | ComputeJacobianNumerically (const Vec currentGuess, Mat *pJacobian) |
Protected Attributes | |
AbstractTetrahedralMesh < ELEMENT_DIM, SPACE_DIM > * | mpMesh |
BoundaryConditionsContainer < ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * | mpBoundaryConditions |
AbstractNonlinearSolver * | mpSolver |
bool | mWeAllocatedSolverMemory |
bool | mUseAnalyticalJacobian |
NaturalNeumannSurfaceTermAssembler < ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * | mpNeumannSurfaceTermsAssembler |
The ASSEMBLER-SOLVER class.
An abstract solver for solving nonlinear elliptic PDEs.
Definition at line 105 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractNonlinearAssemblerSolverHybrid | ( | AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * | pMesh, |
BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * | pBoundaryConditions, | ||
unsigned | numQuadPoints = 2 |
||
) |
Constructor.
pMesh | The mesh |
pBoundaryConditions | The boundary conditions to apply |
numQuadPoints | number of quadrature points (defaults to 2) |
Definition at line 226 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
References AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh, AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpNeumannSurfaceTermsAssembler, AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpSolver, and AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mWeAllocatedSolverMemory.
AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::~AbstractNonlinearAssemblerSolverHybrid | ( | ) | [virtual] |
Destructor.
Definition at line 252 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
void AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletConditions | ( | Vec | currentGuess, |
Vec | residual, | ||
Mat * | pMat | ||
) | [protected] |
Apply Dirichlet boundary conditions to either the residual or Jacobian.
currentGuess | the solution guess for the current nonlinear solver iteration |
residual | the residual to apply boundary conditions to (can be NULL if bcs to be applied to Jacobian only) |
pMat | the Jacobian to apply boundary conditions to (can be NULL if bcs to be applied to residual only) |
Definition at line 262 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
void AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobian | ( | const Vec | currentGuess, |
Mat * | pJacobian | ||
) |
Compute the Jacobian matrix given a current guess at the solution. Choose whether to use a numerical or analytical method based on a flag provided by the user (in Solve()).
currentGuess | The solution guess for the current iteration. |
pJacobian | Pointer to object to fill with the Jacobian matrix. |
NOTE: this method is called indirectly by the PETSc iterative solvers, so must be public.
Definition at line 298 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
References PetscMatTools::Finalise(), and PetscMatTools::SwitchWriteMode().
void AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeJacobianNumerically | ( | const Vec | currentGuess, |
Mat * | pJacobian | ||
) | [protected] |
Computes the Jacobian numerically i.e. an approximation, using numerical partial derivatives.
currentGuess | Independent variable, u in f(u), for example |
pJacobian | A pointer to the Jacobian matrix |
Definition at line 319 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
References PetscVecTools::AddToElement(), PetscTools::CreateVec(), PetscTools::Destroy(), PetscMatTools::Finalise(), PetscVecTools::Scale(), PetscMatTools::SetElement(), and PetscVecTools::WAXPY().
void AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ComputeResidual | ( | const Vec | currentGuess, |
Vec | residualVector | ||
) |
Compute the residual vector given the current solution guess.
currentGuess | The solution guess for the current nonlinear solve iteration. |
residualVector | We fill this with the residual vector. |
NOTE: this method is called indirectly by the PETSc iterative solvers, so must be public.
Definition at line 277 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
References PetscVecTools::Finalise().
void AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetNonlinearSolver | ( | AbstractNonlinearSolver * | pNonlinearSolver | ) |
SetNonlinearSolver - by default a SimplePetscNonlinearSolver is created and used in this class, this method can be called to use a different AbstractNonlinearSolver.
pNonlinearSolver | a nonlinear solver |
Definition at line 403 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
Vec AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve | ( | Vec | initialGuess, |
bool | useAnalyticalJacobian = false |
||
) | [virtual] |
Assemble and solve the system for a nonlinear elliptic PDE.
initialGuess | An initial guess for the iterative solver |
useAnalyticalJacobian | Set to true to use an analytically calculated Jacobian matrix rather than a numerically approximated one. |
Definition at line 379 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
References EXCEPTION.
bool AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::VerifyJacobian | ( | double | tol | ) |
A helper method for use when writing concrete assemblers. Once the user has calculated (on paper) the weak form and the form of the ComputeMatrixTerm method, they can check whether the analytic Jacobian matches the numerical Jacobian to verify the correctness of the code.
tol | A tolerance which defaults to 1e-5 |
This method should NOT be run in simulations - it is only to verify the correctness of the concrete assembler code. Allocates dense matrices.
Definition at line 414 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
References PetscMatTools::CheckEquality(), PetscTools::CreateAndSetVec(), PetscTools::Destroy(), and PetscTools::SetupMat().
BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,PROBLEM_DIM>* AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpBoundaryConditions [protected] |
Boundary conditions container.
Definition at line 113 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh [protected] |
The mesh.
Reimplemented from AbstractFeVolumeIntegralAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, true, true, NONLINEAR >.
Definition at line 110 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractNonlinearAssemblerSolverHybrid().
NaturalNeumannSurfaceTermAssembler<ELEMENT_DIM,SPACE_DIM,PROBLEM_DIM>* AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpNeumannSurfaceTermsAssembler [protected] |
An assembler for the surface integral terms in the residual
Definition at line 125 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractNonlinearAssemblerSolverHybrid().
AbstractNonlinearSolver* AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpSolver [protected] |
The nonlinear solver.
Definition at line 116 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractNonlinearAssemblerSolverHybrid().
bool AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mUseAnalyticalJacobian [protected] |
Whether to use an analytical expression for the Jacobian.
Definition at line 122 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
bool AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mWeAllocatedSolverMemory [protected] |
Whether memory has been allocated for the solver.
Definition at line 119 of file AbstractNonlinearAssemblerSolverHybrid.hpp.
Referenced by AbstractNonlinearAssemblerSolverHybrid< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractNonlinearAssemblerSolverHybrid().