22 #ifndef _aspect_stokes_matrix_free_h 23 #define _aspect_stokes_matrix_free_h 29 #include <deal.II/matrix_free/matrix_free.h> 30 #include <deal.II/matrix_free/operators.h> 31 #include <deal.II/matrix_free/fe_evaluation.h> 33 #include <deal.II/multigrid/mg_constrained_dofs.h> 34 #include <deal.II/multigrid/multigrid.h> 35 #include <deal.II/multigrid/mg_transfer_matrix_free.h> 36 #include <deal.II/multigrid/mg_transfer_global_coarsening.templates.h> 37 #include <deal.II/multigrid/mg_tools.h> 38 #include <deal.II/multigrid/mg_coarse.h> 39 #include <deal.II/multigrid/mg_smoother.h> 40 #include <deal.II/multigrid/mg_matrix.h> 42 #include <deal.II/lac/vector.h> 43 #include <deal.II/lac/block_vector.h> 44 #include <deal.II/lac/la_parallel_vector.h> 45 #include <deal.II/lac/la_parallel_block_vector.h> 63 namespace ChangeVectorTypes
66 const ::LinearAlgebra::ReadWriteVector<double> &rwv,
67 const VectorOperation::values operation);
70 const ::LinearAlgebra::distributed::Vector<double> &in);
72 void copy(::LinearAlgebra::distributed::Vector<double> &out,
76 const ::LinearAlgebra::distributed::BlockVector<double> &in);
78 void copy(::LinearAlgebra::distributed::BlockVector<double> &out,
86 namespace MatrixFreeStokesOperators
99 template <
int dim,
typename number>
156 Table<2, SymmetricTensor<2, dim, VectorizedArray<number>>>
176 memory_consumption()
const;
187 template <
int dim,
int degree_v,
typename number>
189 :
public MatrixFreeOperators::Base<dim, ::LinearAlgebra::distributed::BlockVector<number>>
201 void clear ()
override;
213 void compute_diagonal ()
override;
221 void apply_add (::LinearAlgebra::distributed::BlockVector<number> &dst,
222 const ::LinearAlgebra::distributed::BlockVector<number> &src)
const override;
227 void local_apply (const ::MatrixFree<dim, number> &data,
228 ::LinearAlgebra::distributed::BlockVector<number> &dst,
229 const ::LinearAlgebra::distributed::BlockVector<number> &src,
230 const std::pair<unsigned int, unsigned int> &cell_range)
const;
235 void local_apply_face (const ::MatrixFree<dim, number> &data,
236 ::LinearAlgebra::distributed::BlockVector<number> &dst,
237 const ::LinearAlgebra::distributed::BlockVector<number> &src,
238 const std::pair<unsigned int, unsigned int> &face_range)
const;
243 void local_apply_boundary_face (const ::MatrixFree<dim, number> &data,
244 ::LinearAlgebra::distributed::BlockVector<number> &dst,
245 const ::LinearAlgebra::distributed::BlockVector<number> &src,
246 const std::pair<unsigned int, unsigned int> &face_range)
const;
257 template <
int dim,
int degree_p,
typename number>
259 :
public MatrixFreeOperators::Base<dim, ::LinearAlgebra::distributed::Vector<number>>
271 void clear ()
override;
283 void compute_diagonal ()
override;
291 void apply_add (::LinearAlgebra::distributed::Vector<number> &dst,
292 const ::LinearAlgebra::distributed::Vector<number> &src)
const override;
297 void local_apply (const ::MatrixFree<dim, number> &data,
298 ::LinearAlgebra::distributed::Vector<number> &dst,
299 const ::LinearAlgebra::distributed::Vector<number> &src,
300 const std::pair<unsigned int, unsigned int> &cell_range)
const;
306 void local_compute_diagonal (
const MatrixFree<dim,number> &data,
307 ::LinearAlgebra::distributed::Vector<number> &dst,
308 const unsigned int &dummy,
309 const std::pair<unsigned int,unsigned int> &cell_range)
const;
321 template <
int dim,
int degree_v,
typename number>
323 :
public MatrixFreeOperators::Base<dim, ::LinearAlgebra::distributed::Vector<number>>
335 void clear ()
override;
347 void compute_diagonal ()
override;
354 void set_diagonal (const ::LinearAlgebra::distributed::Vector<number> &diag);
361 void inner_cell_operation(FEEvaluation<dim,
365 number> &velocity)
const;
371 void cell_operation(FEEvaluation<dim,
375 number> &velocity)
const;
382 void apply_add (::LinearAlgebra::distributed::Vector<number> &dst,
383 const ::LinearAlgebra::distributed::Vector<number> &src)
const override;
388 void local_apply (const ::MatrixFree<dim, number> &data,
389 ::LinearAlgebra::distributed::Vector<number> &dst,
390 const ::LinearAlgebra::distributed::Vector<number> &src,
391 const std::pair<unsigned int, unsigned int> &cell_range)
const;
428 virtual void setup_dofs()=0;
437 virtual void assemble()=0;
444 virtual void build_preconditioner()=0;
456 virtual const DoFHandler<dim> &
457 get_dof_handler_v ()
const = 0;
463 virtual const DoFHandler<dim> &
464 get_dof_handler_p ()
const = 0;
470 virtual const DoFHandler<dim> &
471 get_dof_handler_projection ()
const = 0;
477 virtual const AffineConstraints<double> &
478 get_constraints_v ()
const = 0;
484 virtual const AffineConstraints<double> &
485 get_constraints_p ()
const = 0;
492 get_mg_transfer_A ()
const = 0;
499 get_mg_transfer_S ()
const = 0;
505 virtual std::size_t get_cell_data_memory_consumption()
const = 0;
518 template <
int dim,
int velocity_degree>
550 void setup_dofs()
override;
559 void assemble()
override;
565 void build_preconditioner()
override;
577 const DoFHandler<dim> &
578 get_dof_handler_v ()
const override;
584 const DoFHandler<dim> &
585 get_dof_handler_p ()
const override;
591 const DoFHandler<dim> &
592 get_dof_handler_projection ()
const override;
598 const AffineConstraints<double> &
599 get_constraints_v ()
const override;
605 const AffineConstraints<double> &
606 get_constraints_p ()
const override;
613 get_mg_transfer_A ()
const override;
620 get_mg_transfer_S ()
const override;
627 std::size_t get_cell_data_memory_consumption()
const override;
633 void parse_parameters (ParameterHandler &prm);
640 void evaluate_material_model();
646 void correct_stokes_rhs();
681 MGLevelObject<MatrixFreeStokesOperators::OperatorCellData<dim, GMGNumberType>>
level_cell_data;
const OperatorCellData< dim, number > * cell_data
std::set< types::boundary_id > free_surface_boundary_indicators
MGLevelObject< MatrixFreeStokesOperators::OperatorCellData< dim, GMGNumberType > > level_cell_data
DoFHandler< dim > dof_handler_p
::TrilinosWrappers::MPI::BlockVector BlockVector
MatrixFreeStokesOperators::OperatorCellData< dim, GMGNumberType > active_cell_data
MGLevelObject< GMGSchurComplementMatrixType > mg_matrices_Schur_complement
AffineConstraints< double > constraints_v
bool apply_stabilization_free_surface_faces
DoFHandler< dim > dof_handler_projection
MGLevelObject< GMGABlockMatrixType > mg_matrices_A_block
const OperatorCellData< dim, number > * cell_data
bool symmetrize_newton_system
MGConstrainedDoFs mg_constrained_dofs_A_block
MGConstrainedDoFs mg_constrained_dofs_projection
Table< 2, Tensor< 1, dim, VectorizedArray< number > > > free_surface_stabilization_term_table
void copy(::LinearAlgebra::distributed::BlockVector< double > &out, const TrilinosWrappers::MPI::BlockVector &in)
::TrilinosWrappers::MPI::Vector Vector
StokesMatrixType stokes_matrix
const OperatorCellData< dim, number > * cell_data
void declare_parameters(ParameterHandler &prm)
Table< 2, SymmetricTensor< 2, dim, VectorizedArray< number > > > strain_rate_table
MGTransferMF< dim, GMGNumberType > mg_transfer_A_block
AffineConstraints< double > constraints_p
MGTransferMatrixFree< dim, NumberType > MGTransferMF
std::vector< std::shared_ptr< MatrixFree< dim, double > > > matrix_free_objects
MGTransferMF< dim, GMGNumberType > mg_transfer_Schur_complement
FESystem< dim > fe_projection
Table< 2, VectorizedArray< number > > viscosity
Table< 2, SymmetricTensor< 2, dim, VectorizedArray< number > > > newton_factor_wrt_strain_rate_table
SchurComplementMatrixType Schur_complement_block_matrix
DoFHandler< dim > dof_handler_v
bool enable_newton_derivatives
Table< 2, VectorizedArray< number > > newton_factor_wrt_pressure_table
MGConstrainedDoFs mg_constrained_dofs_Schur_complement
ABlockMatrixType A_block_matrix