39class NonlinearOperatorCoupled
42 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
43 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
48 NonlinearOperatorCoupled()
49 : pde_operator(
nullptr), rhs_vector(
nullptr), time(0.0), scaling_factor_mass(1.0)
54 initialize(PDEOperator
const & pde_operator)
56 this->pde_operator = &pde_operator;
60 update(VectorType
const & rhs_vector,
double const & time,
double const & scaling_factor)
62 this->rhs_vector = &rhs_vector;
64 this->scaling_factor_mass = scaling_factor;
72 evaluate_residual(BlockVectorType & dst, BlockVectorType
const & src)
const
74 pde_operator->evaluate_nonlinear_residual(dst, src, rhs_vector, time, scaling_factor_mass);
78 PDEOperator
const * pde_operator;
80 VectorType
const * rhs_vector;
82 double scaling_factor_mass;
86class LinearOperatorCoupled :
public dealii::EnableObserverPointer
89 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
94 LinearOperatorCoupled() : dealii::EnableObserverPointer(), pde_operator(
nullptr)
99 initialize(PDEOperator
const & pde_operator)
101 this->pde_operator = &pde_operator;
109 set_solution_linearization(BlockVectorType
const & solution_linearization)
const
111 pde_operator->set_velocity_ptr(solution_linearization.block(0));
120 vmult(BlockVectorType & dst, BlockVectorType
const & src)
const
122 pde_operator->apply_linearized_problem(dst, src);
126 PDEOperator
const * pde_operator;
130class BlockPreconditioner
133 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
138 BlockPreconditioner() : update_needed(
true), pde_operator(
nullptr)
143 initialize(PDEOperator * pde_operator_in)
145 pde_operator = pde_operator_in;
151 pde_operator->update_block_preconditioner();
153 this->update_needed =
false;
159 return update_needed;
163 vmult(BlockVectorType & dst, BlockVectorType
const & src)
const
165 AssertThrow(this->update_needed ==
false,
167 "BlockPreconditioner can not be applied because it is not up-to-date."));
169 pde_operator->apply_block_preconditioner(dst, src);
172 std::shared_ptr<TimerTree>
177 "Function get_timings() is not implemented for BlockPreconditioner."));
179 return std::make_shared<TimerTree>();
185 PDEOperator * pde_operator;
189class OperatorCoupled :
public SpatialOperatorBase<dim, Number>
192 typedef SpatialOperatorBase<dim, Number> Base;
193 typedef OperatorCoupled<dim, Number> This;
195 typedef typename Base::MultigridPoisson MultigridPoisson;
197 typedef typename Base::VectorType VectorType;
199 typedef typename Base::BlockVectorType BlockVectorType;
205 OperatorCoupled(std::shared_ptr<
Grid<dim> const> grid,
206 std::shared_ptr<dealii::Mapping<dim>
const> mapping,
211 std::string
const & field,
212 MPI_Comm
const & mpi_comm);
217 virtual ~OperatorCoupled();
221 setup_derived()
final;
224 setup_preconditioners_and_solvers()
final;
232 update_divergence_penalty_operator(VectorType
const & velocity);
239 update_continuity_penalty_operator(VectorType
const & velocity);
250 set_scaling_factor_continuity(
double const scaling_factor);
263 solve_linear_problem(BlockVectorType & dst,
264 BlockVectorType
const & src,
265 VectorType
const & transport_velocity,
266 bool const & update_preconditioner,
267 double const & scaling_factor_mass = 1.0);
276 std::tuple<unsigned int, unsigned int>
277 solve_nonlinear_problem(BlockVectorType & dst,
278 VectorType
const & rhs_vector,
279 bool const & update_preconditioner,
280 double const & time = 0.0,
281 double const & scaling_factor_mass = 1.0);
288 evaluate_nonlinear_residual(BlockVectorType & dst,
289 BlockVectorType
const & src,
290 VectorType
const * rhs_vector,
292 double const & scaling_factor_mass)
const;
301 evaluate_nonlinear_residual_steady(BlockVectorType & dst,
302 BlockVectorType
const & src,
303 double const & time)
const;
309 apply_linearized_problem(BlockVectorType & dst, BlockVectorType
const & src)
const;
318 rhs_linear_problem(BlockVectorType & dst,
319 VectorType
const & transport_velocity,
320 double const & time = 0.0)
const;
326 update_block_preconditioner();
329 apply_block_preconditioner(BlockVectorType & dst, BlockVectorType
const & src)
const;
333 setup_solver_coupled();
339 setup_block_preconditioner();
342 initialize_vectors();
345 initialize_preconditioner_velocity_block();
348 setup_multigrid_preconditioner_momentum();
351 setup_iterative_solver_momentum();
354 initialize_preconditioner_pressure_block();
357 setup_multigrid_preconditioner_schur_complement();
360 setup_iterative_solver_schur_complement();
363 setup_pressure_convection_diffusion_operator();
366 apply_preconditioner_velocity_block(VectorType & dst, VectorType
const & src)
const;
369 apply_preconditioner_pressure_block(VectorType & dst, VectorType
const & src)
const;
372 apply_inverse_negative_laplace_operator(VectorType & dst, VectorType
const & src)
const;
379 VectorType
mutable temp_vector;
381 double scaling_factor_continuity;
397 std::shared_ptr<Krylov::SolverBase<BlockVectorType>> linear_solver;
403 Preconditioner block_preconditioner;
406 std::shared_ptr<PreconditionerBase<Number>> preconditioner_momentum;
408 std::shared_ptr<Krylov::SolverBase<VectorType>> solver_velocity_block;
411 std::shared_ptr<PreconditionerBase<Number>> multigrid_preconditioner_schur_complement;
412 std::shared_ptr<PreconditionerBase<Number>> inverse_mass_preconditioner_schur_complement;
414 std::shared_ptr<ConvDiff::CombinedOperator<dim, Number>> pressure_conv_diff_operator;
416 std::shared_ptr<Poisson::LaplaceOperator<dim, Number, 1>> laplace_operator;
418 std::shared_ptr<Krylov::SolverBase<VectorType>> solver_pressure_block;
421 VectorType
mutable vec_tmp_pressure;
422 VectorType
mutable vec_tmp_velocity, vec_tmp_velocity_2;
425 VectorType
mutable tmp_scp_pressure;
426 VectorType
mutable tmp_scp_velocity, tmp_scp_velocity_2;