38class NonlinearOperatorCoupled
41 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
42 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
47 NonlinearOperatorCoupled()
48 : pde_operator(
nullptr), rhs_vector(
nullptr), time(0.0), scaling_factor_mass(1.0)
53 initialize(PDEOperator
const & pde_operator)
55 this->pde_operator = &pde_operator;
59 update(VectorType
const & rhs_vector,
double const & time,
double const & scaling_factor)
61 this->rhs_vector = &rhs_vector;
63 this->scaling_factor_mass = scaling_factor;
71 evaluate_residual(BlockVectorType & dst, BlockVectorType
const & src)
const
73 pde_operator->evaluate_nonlinear_residual(dst, src, rhs_vector, time, scaling_factor_mass);
77 PDEOperator
const * pde_operator;
79 VectorType
const * rhs_vector;
81 double scaling_factor_mass;
85class LinearOperatorCoupled :
public dealii::Subscriptor
88 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
93 LinearOperatorCoupled() : dealii::Subscriptor(), pde_operator(
nullptr)
98 initialize(PDEOperator
const & pde_operator)
100 this->pde_operator = &pde_operator;
108 set_solution_linearization(BlockVectorType
const & solution_linearization)
const
110 pde_operator->set_velocity_ptr(solution_linearization.block(0));
119 vmult(BlockVectorType & dst, BlockVectorType
const & src)
const
121 pde_operator->apply_linearized_problem(dst, src);
125 PDEOperator
const * pde_operator;
129class BlockPreconditioner
132 typedef dealii::LinearAlgebra::distributed::BlockVector<Number> BlockVectorType;
137 BlockPreconditioner() : update_needed(
true), pde_operator(
nullptr)
142 initialize(PDEOperator * pde_operator_in)
144 pde_operator = pde_operator_in;
150 pde_operator->update_block_preconditioner();
152 this->update_needed =
false;
158 return update_needed;
162 vmult(BlockVectorType & dst, BlockVectorType
const & src)
const
164 AssertThrow(this->update_needed ==
false,
166 "BlockPreconditioner can not be applied because it is not up-to-date."));
168 pde_operator->apply_block_preconditioner(dst, src);
171 std::shared_ptr<TimerTree>
176 "Function get_timings() is not implemented for BlockPreconditioner."));
178 return std::make_shared<TimerTree>();
184 PDEOperator * pde_operator;
188class OperatorCoupled :
public SpatialOperatorBase<dim, Number>
191 typedef SpatialOperatorBase<dim, Number> Base;
192 typedef OperatorCoupled<dim, Number> This;
194 typedef typename Base::MultigridPoisson MultigridPoisson;
196 typedef typename Base::VectorType VectorType;
198 typedef typename Base::BlockVectorType BlockVectorType;
204 OperatorCoupled(std::shared_ptr<
Grid<dim> const> grid,
205 std::shared_ptr<dealii::Mapping<dim>
const> mapping,
210 std::string
const & field,
211 MPI_Comm
const & mpi_comm);
216 virtual ~OperatorCoupled();
220 setup_derived()
final;
223 setup_preconditioners_and_solvers()
final;
231 update_divergence_penalty_operator(VectorType
const & velocity);
238 update_continuity_penalty_operator(VectorType
const & velocity);
249 set_scaling_factor_continuity(
double const scaling_factor);
262 solve_linear_problem(BlockVectorType & dst,
263 BlockVectorType
const & src,
264 VectorType
const & transport_velocity,
265 bool const & update_preconditioner,
266 double const & scaling_factor_mass = 1.0);
275 std::tuple<unsigned int, unsigned int>
276 solve_nonlinear_problem(BlockVectorType & dst,
277 VectorType
const & rhs_vector,
278 bool const & update_preconditioner,
279 double const & time = 0.0,
280 double const & scaling_factor_mass = 1.0);
287 evaluate_nonlinear_residual(BlockVectorType & dst,
288 BlockVectorType
const & src,
289 VectorType
const * rhs_vector,
291 double const & scaling_factor_mass)
const;
300 evaluate_nonlinear_residual_steady(BlockVectorType & dst,
301 BlockVectorType
const & src,
302 double const & time)
const;
308 apply_linearized_problem(BlockVectorType & dst, BlockVectorType
const & src)
const;
317 rhs_linear_problem(BlockVectorType & dst,
318 VectorType
const & transport_velocity,
319 double const & time = 0.0)
const;
325 update_block_preconditioner();
328 apply_block_preconditioner(BlockVectorType & dst, BlockVectorType
const & src)
const;
332 setup_solver_coupled();
338 setup_block_preconditioner();
341 initialize_vectors();
344 initialize_preconditioner_velocity_block();
347 setup_multigrid_preconditioner_momentum();
350 setup_iterative_solver_momentum();
353 initialize_preconditioner_pressure_block();
356 setup_multigrid_preconditioner_schur_complement();
359 setup_iterative_solver_schur_complement();
362 setup_pressure_convection_diffusion_operator();
365 apply_preconditioner_velocity_block(VectorType & dst, VectorType
const & src)
const;
368 apply_preconditioner_pressure_block(VectorType & dst, VectorType
const & src)
const;
371 apply_inverse_negative_laplace_operator(VectorType & dst, VectorType
const & src)
const;
378 VectorType
mutable temp_vector;
380 double scaling_factor_continuity;
396 std::shared_ptr<Krylov::SolverBase<BlockVectorType>> linear_solver;
402 Preconditioner block_preconditioner;
405 std::shared_ptr<PreconditionerBase<Number>> preconditioner_momentum;
407 std::shared_ptr<Krylov::SolverBase<VectorType>> solver_velocity_block;
410 std::shared_ptr<PreconditionerBase<Number>> multigrid_preconditioner_schur_complement;
411 std::shared_ptr<PreconditionerBase<Number>> inverse_mass_preconditioner_schur_complement;
413 std::shared_ptr<ConvDiff::CombinedOperator<dim, Number>> pressure_conv_diff_operator;
415 std::shared_ptr<Poisson::LaplaceOperator<dim, Number, 1>> laplace_operator;
417 std::shared_ptr<Krylov::SolverBase<VectorType>> solver_pressure_block;
420 VectorType
mutable vec_tmp_pressure;
421 VectorType
mutable vec_tmp_velocity, vec_tmp_velocity_2;
424 VectorType
mutable tmp_scp_pressure;
425 VectorType
mutable tmp_scp_velocity, tmp_scp_velocity_2;