1 #ifndef _pidoums_template_h_
2 #define _pidoums_template_h_
6 template <
int dim,
int spacedim,
typename LAC>
17 template <
typename EnergyType,
typename Res
idualType>
19 FEValuesCache<dim,spacedim> &scratch,
20 std::vector<EnergyType> &energies,
21 std::vector<std::vector<ResidualType> > &local_residuals,
22 bool compute_only_system_terms)
const;
27 const std::vector<shared_ptr<LATrilinos::BlockMatrix> >,
71 mutable shared_ptr<TrilinosWrappers::PreconditionJacobi> preconditioner;
77 template <
int dim,
int spacedim,
typename LAC>
80 (\* section name in parameter file *\
"ProblemTemplate Parameters",
81 \* n componenets *\ dim,
83 \* finite element type *\
"FESystem[FE_Q(1)^d]",
84 \* component names *\
"u,u,u",
85 \* differential (1) and algebraic components (0) needed by IDA *\
"1")
89 template <
int dim,
int spacedim,
typename LAC>
94 this->add_parameter(....);
97 template <
int dim,
int spacedim,
typename LAC>
107 template <
int dim,
int spacedim,
typename LAC>
108 template <
typename EnergyType,
typename Res
idualType>
112 FEValuesCache<dim,spacedim> &fe_cache,
113 std::vector<EnergyType> &energies,
114 std::vector<std::vector<ResidualType> > &local_residuals,
115 bool compute_only_system_matrix)
const
123 this->reinit (et, cell, fe_cache);
124 auto &Fs = fe_cache.get_deformation_gradients(
"solution",
"Fu", displacement, et);
129 this->reinit (rt, cell, fe_cache);
130 auto &us = fe_cache.get_values(
"solution",
"u", displacement, rt);
135 auto &fev = fe_cache.get_current_fe_values();
136 const unsigned int n_q_points = us.size();
137 auto &JxW = fe_cache.get_JxW_values();
140 for (
unsigned int q=0; q<n_q_points; ++q)
144 auto C = transpose(F)*F;
147 auto J = determinant(F);
148 auto lnJ = std::log (J);
150 EnergyType psi = (
mu/2.)*(Ic-dim) -
mu*lnJ + (lambda/2.)*(lnJ)*(lnJ);
152 energies[0] += (psi)*JxW[q];
156 for (
unsigned int i=0; i<local_residuals[0].size(); ++i)
158 auto v = fev[displacement] .value(i,q);
160 local_residuals[0] -= 0.1*v*u;
168 if (!compute_only_system_matrix)
169 local_residuals[1] += v*u;
176 template <
int dim,
int spacedim,
typename LAC>
179 const std::vector<shared_ptr<LATrilinos::BlockMatrix> > matrices,
185 preconditioner->initialize(matrices[1]->block(0,0));
186 auto P = linear_operator<LATrilinos::VectorType::BlockType>(matrices[1]->block(0,0));
188 auto A = linear_operator<LATrilinos::VectorType::BlockType>( matrices[0]->block(0,0) );
197 system_op = block_operator<1, 1, LATrilinos::VectorType>({{
202 prec_op = block_operator<1, 1, LATrilinos::VectorType>({{
Definition: lac_type.h:33
ActiveSelector::active_cell_iterator active_cell_iterator
This is the class that users should derive from.
Definition: pde_system_interface.h:46
ProblemTemplate()
Definition: template.h:78
LinearOperator< typename Solver::vector_type, typename Solver::vector_type > inverse_operator(const LinearOperator< typename Solver::vector_type, typename Solver::vector_type > &op, Solver &solver, const Preconditioner &preconditioner)
void energies_and_residuals(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, FEValuesCache< dim, spacedim > &scratch, std::vector< EnergyType > &energies, std::vector< std::vector< ResidualType > > &local_residuals, bool compute_only_system_terms) const
void parse_parameters_call_back()
void declare_parameters(ParameterHandler &prm)
Definition: template.h:90
void compute_system_operators(const DoFHandler< dim, spacedim > &, const std::vector< shared_ptr< LATrilinos::BlockMatrix > >, LinearOperator< LATrilinos::VectorType > &, LinearOperator< LATrilinos::VectorType > &) const
Definition: template.h:178
~ProblemTemplate()
Definition: template.h:10
void parse_parameters_call_back()
Definition: compressible_neo_hookean.h:71