5 #ifndef _dynamic_navier_stokes_h_
6 #define _dynamic_navier_stokes_h_
23 #include <deal2lkit/fe_values_cache.h>
24 #include <deal2lkit/parsed_function.h>
35 typedef Assembly::CopyData::piDoMUSSystem<dim,dim>
CopySystem;
43 void parse_parameters_call_back ();
49 template<
typename Number>
53 std::vector<Number> &local_residual)
const;
54 template<
typename Number>
58 std::vector<Number> &local_residual)
const;
65 const std::vector<shared_ptr<MAT> >,
69 template<
typename Number>
73 std::vector<std::vector<Number> > &)
const
80 mutable shared_ptr<TrilinosWrappers::PreconditionJacobi> P00_preconditioner;
81 mutable shared_ptr<TrilinosWrappers::PreconditionAMG> P11_preconditioner;
82 mutable shared_ptr<TrilinosWrappers::PreconditionJacobi> P22_preconditioner;
88 "FESystem[FE_Q(2)^d-FE_Q(2)^d-FE_Q(1)]",
90 "1,0,0; 1,1,1; 0,0,1",
91 "1,0,0; 0,1,0; 0,0,1",
97 template<
typename Number>
101 std::vector<Number> &local_residual)
const
103 Number alpha = this->alpha;
104 fe_cache.reinit(cell);
106 fe_cache.cache_local_solution_vector(
"solution", *this->solution, alpha);
107 fe_cache.cache_local_solution_vector(
"solution_dot", *this->solution_dot, alpha);
109 this->fix_solution_dot_derivative(fe_cache, alpha);
115 auto &us = fe_cache.get_values(
"solution",
"u", velocity, alpha);
116 auto &grad_us = fe_cache.get_gradients(
"solution",
"grad_u", velocity, alpha);
117 auto &us_dot = fe_cache.get_values(
"solution_dot",
"u_dot", velocity, alpha);
118 auto &grad_ds = fe_cache.get_gradients(
"solution",
"grad_d", displacement, alpha);
119 auto &ps = fe_cache.get_values(
"solution",
"p", pressure, alpha);
121 const unsigned int n_q_points = ps.size();
124 auto &JxW = fe_cache.get_JxW_values();
127 for (
unsigned int i=0; i<local_residual.size(); ++i)
128 local_residual[i] = 0;
130 auto &fev = fe_cache.get_current_fe_values();
131 for (
unsigned int q=0; q<n_q_points; ++q)
133 for (
unsigned int i=0; i<local_residual.size(); ++i)
136 auto v = fev[velocity ].value(i,q);
137 auto grad_v = fev[velocity ].gradient(i,q);
138 auto grad_e = fev[displacement].gradient(i,q);
139 auto m = fev[pressure ].value(i,q);
146 const Number &p = ps[q];
149 local_residual[i] += (rho * inner(u_dot,v) +
150 eta * inner(grad_u,grad_v) +
151 inner(grad_d,grad_e) +
152 (1./eta)*p*m)*JxW[q];
158 template<
typename Number>
162 std::vector<Number> &local_residual)
const
164 Number alpha = this->alpha;
165 fe_cache.reinit(cell);
167 fe_cache.cache_local_solution_vector(
"solution", *this->solution, alpha);
168 fe_cache.cache_local_solution_vector(
"solution_dot", *this->solution_dot, alpha);
170 this->fix_solution_dot_derivative(fe_cache, alpha);
178 auto &us = fe_cache.get_values(
"solution",
"u", velocity, alpha);
179 auto &grad_us = fe_cache.get_gradients(
"solution",
"grad_u", velocity, alpha);
180 auto &div_us = fe_cache.get_divergences(
"solution",
"div_u", velocity, alpha);
181 auto &sym_grad_us = fe_cache.get_symmetric_gradients(
"solution",
"u", velocity, alpha);
182 auto &us_dot = fe_cache.get_values(
"solution_dot",
"u_dot", velocity, alpha);
185 auto &ds = fe_cache.get_values(
"solution",
"d", displacement, alpha);
186 auto &grad_ds = fe_cache.get_gradients(
"solution",
"grad_d", displacement, alpha);
187 auto &div_ds = fe_cache.get_divergences(
"solution",
"div_d", displacement, alpha);
188 auto &Fs = fe_cache.get_deformation_gradients(
"solution",
"Fd", displacement, alpha);
189 auto &ds_dot = fe_cache.get_values(
"solution_dot",
"d_dot", displacement, alpha);
192 auto &ps = fe_cache.get_values(
"solution",
"p", pressure, alpha);
195 auto &JxW = fe_cache.get_JxW_values();
197 const unsigned int n_q_points = ps.size();
200 for (
unsigned int i=0; i<local_residual.size(); ++i)
201 local_residual[i] = 0;
203 auto &fev = fe_cache.get_current_fe_values();
204 for (
unsigned int q=0; q<n_q_points; ++q)
206 for (
unsigned int i=0; i<local_residual.size(); ++i)
210 auto v = fev[velocity ].value(i,q);
211 auto grad_v = fev[velocity ].gradient(i,q);
212 auto div_v = fev[velocity ].divergence(i,q);
214 auto grad_e = fev[displacement].gradient(i,q);
216 auto m = fev[pressure ].value(i,q);
221 const Number &div_u = div_us[q];
229 const Number &div_d = div_ds[q];
231 Number J = determinant(F);
236 const Number &p = ps[q];
242 for (
unsigned int i = 0; i<dim; ++i)
248 local_residual[i] += (
250 rho*inner( u_dot * J_ale , v )
252 + inner( grad_u * ( F_inv * ( u - d_dot ) ) * J_ale , v )
254 + inner( J_ale * sigma * Ft_inv, grad_v)
259 + eta * inner( grad_d , grad_e )
276 this->add_parameter(prm, &rho,
"rho [Kg m^-d]",
"1.0",
Patterns::Double(0.0));
291 const std::vector<shared_ptr<MAT> >,
296 std::vector<std::vector<bool> > constant_modes;
312 P00_preconditioner ->initialize (preconditioner_matrix.
block(0,0));
313 P11_preconditioner ->initialize (preconditioner_matrix.
block(1,1), Amg_data);
314 P22_preconditioner ->initialize (preconditioner_matrix.
block(2,2));
318 std::array<std::array<LinearOperator<TrilinosWrappers::MPI::Vector>, 3>, 3> S;
319 for (
unsigned int i = 0; i<3; ++i)
320 for (
unsigned int j = 0; j<3; ++j)
321 S[i][j] = linear_operator< TrilinosWrappers::MPI::Vector >( matrix.
block(i,j) );
331 std::array<std::array<LinearOperator<TrilinosWrappers::MPI::Vector>, 3>, 3> P;
332 for (
unsigned int i = 0; i<3; ++i)
333 for (
unsigned int j = 0; j<3; ++j)
334 P[i][j] = linear_operator< TrilinosWrappers::MPI::Vector >( preconditioner_matrix.
block(i,j) );
340 for (
unsigned int i = 0; i<3; ++i)
341 for (
unsigned int j = 0; j<3; ++j)
343 P[i][j] = null_operator< TrilinosWrappers::MPI::Vector >(P[i][j]);
351 dealii::TrilinosWrappers::MPI::Vector,
352 dealii::TrilinosWrappers::MPI::Vector,
357 >( preconditioner_matrix.
block(0,0), *P00_preconditioner );
370 P[1][1] = inverse_operator< >( S[1][1],
372 *P11_preconditioner);
374 P[2][2] = inverse_operator< >( S[2][2],
376 *P22_preconditioner);
380 prec_op = block_forward_substitution< >(
TrilinosWrappers::BlockSparseMatrix MAT
Definition: ale_navier_stokes.h:37
virtual void compute_system_operators(const DoFHandler< dim > &, const TrilinosWrappers::BlockSparseMatrix &, const TrilinosWrappers::BlockSparseMatrix &, const std::vector< shared_ptr< MAT > >, LinearOperator< VEC > &, LinearOperator< VEC > &) const
Definition: ale_navier_stokes.h:288
void system_residual(const typename DoFHandler< dim >::active_cell_iterator &, Scratch &, CopySystem &, std::vector< Number > &local_residual) const
Definition: ale_navier_stokes.h:159
LinearOperator< Range, Domain > linear_operator(const Matrix &matrix)
Assembly::CopyData::piDoMUSPreconditioner< dim, dim > CopyPreconditioner
Definition: ale_navier_stokes.h:34
double aggregation_threshold
std::vector< std::vector< bool > > constant_modes
void preconditioner_residual(const typename DoFHandler< dim >::active_cell_iterator &, Scratch &, CopyPreconditioner &, std::vector< Number > &local_residual) const
Definition: ale_navier_stokes.h:98
unsigned int smoother_sweeps
LinearOperator< Range, Domain > null_operator(const LinearOperator< Range, Domain > &op)
ALENavierStokes()
Definition: ale_navier_stokes.h:86
void declare_parameters(ParameterHandler &prm)
Definition: ale_navier_stokes.h:272
FEValuesCache< dim, dim > Scratch
Definition: ale_navier_stokes.h:33
void aux_matrix_residuals(const typename DoFHandler< dim >::active_cell_iterator &, Scratch &, CopyPreconditioner &, std::vector< std::vector< Number > > &) const
Definition: ale_navier_stokes.h:70
BlockType & block(const unsigned int row, const unsigned int column)
ComponentMask component_mask(const FEValuesExtractors::Scalar &scalar) const
Definition: ale_navier_stokes.h:30
Assembly::CopyData::piDoMUSSystem< dim, dim > CopySystem
Definition: ale_navier_stokes.h:35
void parse_parameters_call_back()
Definition: ale_navier_stokes.h:280
Definition: non_conservative.h:19
TrilinosWrappers::MPI::BlockVector VEC
Definition: ale_navier_stokes.h:36
const FiniteElement< dim, dim > & get_fe() const
bool higher_order_elements