1 #ifndef _pidoums_compressible_neo_hookean_h_
2 #define _pidoums_compressible_neo_hookean_h_
14 template <
int dim,
int spacedim,
typename LAC=LATrilinos>
27 template <
typename EnergyType,
typename Res
idualType>
29 FEValuesCache<dim,spacedim> &scratch,
30 std::vector<EnergyType> &energies,
31 std::vector<std::vector<ResidualType> > &local_residuals,
32 bool compute_only_system_terms)
const;
36 const std::vector<shared_ptr<LATrilinos::BlockMatrix> >,
43 mutable shared_ptr<TrilinosWrappers::PreconditionJacobi> preconditioner;
45 ParsedFunction<dim> convection;
49 template <
int dim,
int spacedim,
typename LAC>
56 convection(
"Convection parameter", dim,
"cos(pi*x)*sin(pi*y); -sin(pi*x)*cos(pi*y)")
60 template <
int dim,
int spacedim,
typename LAC>
64 this->add_parameter(prm, &nu,
"Diffusion coefficient",
"1.0",
Patterns::Double(0.0));
68 template <
int dim,
int spacedim,
typename LAC>
69 template <
typename EnergyType,
typename Res
idualType>
73 FEValuesCache<dim,spacedim> &fe_cache,
74 std::vector<EnergyType> &,
75 std::vector<std::vector<ResidualType> > &residuals,
80 ResidualType alpha = this->alpha;
83 this->reinit (alpha, cell, fe_cache);
85 auto &us = fe_cache.get_values(
"solution",
"u", concentration, alpha);
86 auto &uts = fe_cache.get_values(
"solution_dot",
"ut", concentration, alpha);
87 auto &gradus = fe_cache.get_gradients(
"solution",
"gradu", concentration, alpha);
89 const unsigned int n_q_points = us.size();
90 auto &JxW = fe_cache.get_JxW_values();
92 std::vector<Vector<double> > convection_values(n_q_points,
Vector<double>(dim));
94 auto &fev = fe_cache.get_current_fe_values();
95 convection.vector_value_list(fev.get_quadrature_points(), convection_values);
97 for (
unsigned int q=0; q<n_q_points; ++q)
103 auto &gradu = gradus[q];
105 auto &b = convection_values[q];
106 for (
unsigned int i=0; i<residuals[0].size(); ++i)
110 auto v = fev[concentration].value(i,q);
111 auto gradv = fev[concentration].gradient(i,q);
113 residuals[0][i] += (ut*v +
117 for (
unsigned int d=0; d<dim; ++d)
118 residuals[0][i] += (u*gradu[d]*b[d]*v)*JxW[q];
125 template <
int dim,
int spacedim,
typename LAC>
128 const std::vector<shared_ptr<LATrilinos::BlockMatrix> > matrices,
134 preconditioner->initialize(matrices[0]->block(0,0));
136 auto P = linear_operator<LATrilinos::VectorType::BlockType>(matrices[0]->block(0,0));
138 auto A = linear_operator<LATrilinos::VectorType::BlockType>( matrices[0]->block(0,0) );
147 system_op = block_operator<1, 1, LATrilinos::VectorType>({{
152 prec_op = block_operator<1, 1, LATrilinos::VectorType>({{
Definition: scalar_reaction_diffusion_convection.h:15
Definition: lac_type.h:33
void declare_parameters(ParameterHandler &prm)
Definition: scalar_reaction_diffusion_convection.h:61
ActiveSelector::active_cell_iterator active_cell_iterator
This is the class that users should derive from.
Definition: pde_system_interface.h:46
void compute_system_operators(const DoFHandler< dim, spacedim > &, const std::vector< shared_ptr< LATrilinos::BlockMatrix > >, LinearOperator< LATrilinos::VectorType > &, LinearOperator< LATrilinos::VectorType > &) const
Definition: scalar_reaction_diffusion_convection.h:127
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)
~ScalarReactionDiffusionConvection()
Definition: scalar_reaction_diffusion_convection.h:19
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
Definition: scalar_reaction_diffusion_convection.h:72
ScalarReactionDiffusionConvection()
Definition: scalar_reaction_diffusion_convection.h:51