ExaDG
Loading...
Searching...
No Matches
create_operator.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CREATE_OPERATOR_H_
23#define EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CREATE_OPERATOR_H_
24
25// ExaDG
26#include <exadg/incompressible_navier_stokes/spatial_discretization/operator_consistent_splitting.h>
27#include <exadg/incompressible_navier_stokes/spatial_discretization/operator_coupled.h>
28#include <exadg/incompressible_navier_stokes/spatial_discretization/operator_dual_splitting.h>
29#include <exadg/incompressible_navier_stokes/spatial_discretization/operator_pressure_correction.h>
30#include <exadg/incompressible_navier_stokes/spatial_discretization/spatial_operator_base.h>
31
32namespace ExaDG
33{
34namespace IncNS
35{
39template<int dim, typename Number>
40std::shared_ptr<SpatialOperatorBase<dim, Number>>
41create_operator(std::shared_ptr<Grid<dim> const> grid,
42 std::shared_ptr<dealii::Mapping<dim> const> mapping,
43 std::shared_ptr<MultigridMappings<dim, Number>> const multigrid_mappings,
44 std::shared_ptr<BoundaryDescriptor<dim> const> boundary_descriptor,
45 std::shared_ptr<FieldFunctions<dim> const> field_functions,
46 Parameters const & parameters,
47 std::string const & field,
48 MPI_Comm const & mpi_comm)
49{
50 std::shared_ptr<SpatialOperatorBase<dim, Number>> pde_operator;
51
52 // initialize pde_operator
53 if(parameters.temporal_discretization == TemporalDiscretization::BDFCoupledSolution)
54 {
55 pde_operator = std::make_shared<OperatorCoupled<dim, Number>>(grid,
56 mapping,
57 multigrid_mappings,
58 boundary_descriptor,
59 field_functions,
60 parameters,
61 field,
62 mpi_comm);
63 }
64 else if(parameters.temporal_discretization == TemporalDiscretization::BDFDualSplitting)
65 {
66 pde_operator = std::make_shared<OperatorDualSplitting<dim, Number>>(grid,
67 mapping,
68 multigrid_mappings,
69 boundary_descriptor,
70 field_functions,
71 parameters,
72 field,
73 mpi_comm);
74 }
75 else if(parameters.temporal_discretization == TemporalDiscretization::BDFConsistentSplitting)
76 {
77 pde_operator = std::make_shared<OperatorConsistentSplitting<dim, Number>>(grid,
78 mapping,
79 multigrid_mappings,
80 boundary_descriptor,
81 field_functions,
82 parameters,
83 field,
84 mpi_comm);
85 }
86 else if(parameters.temporal_discretization == TemporalDiscretization::BDFPressureCorrection or
87 // we can not instantiate the base class and instantiate an arbitrary deriving
88 // class for InterpolateAnalyticalSolution.
89 parameters.temporal_discretization ==
90 TemporalDiscretization::InterpolateAnalyticalSolution)
91 {
92 pde_operator = std::make_shared<OperatorPressureCorrection<dim, Number>>(grid,
93 mapping,
94 multigrid_mappings,
95 boundary_descriptor,
96 field_functions,
97 parameters,
98 field,
99 mpi_comm);
100 }
101 else
102 {
103 AssertThrow(false, dealii::ExcMessage("Not implemented."));
104 }
105
106 return pde_operator;
107}
108
109} // namespace IncNS
110} // namespace ExaDG
111
112#endif /* EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_CREATE_OPERATOR_H_ */
Definition parameters.h:46
Definition driver.cpp:33
Definition boundary_descriptor.h:240
Definition field_functions.h:31