OGS
WellboreSimulatorProcess.cpp
Go to the documentation of this file.
1
12
13#include <cassert>
14
20
21namespace ProcessLib
22{
23namespace WellboreSimulator
24{
26 std::string name,
27 MeshLib::Mesh& mesh,
28 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&& jacobian_assembler,
29 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters,
30 unsigned const integration_order,
31 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
32 process_variables,
33 WellboreSimulatorProcessData&& process_data,
34 SecondaryVariableCollection&& secondary_variables)
35 : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
36 integration_order, std::move(process_variables),
37 std::move(secondary_variables)),
38 _process_data(std::move(process_data))
39{
40}
41
43 NumLib::LocalToGlobalIndexMap const& dof_table,
44 MeshLib::Mesh const& mesh,
45 unsigned const integration_order)
46{
48 mesh.getElements(), dof_table, _local_assemblers,
49 NumLib::IntegrationOrder{integration_order}, mesh.isAxiallySymmetric(),
51
52 auto add_secondary_variable = [&](std::string const& name,
53 int const num_components,
54 auto get_ip_values_function)
55 {
57 name,
58 makeExtrapolator(num_components, getExtrapolator(),
60 std::move(get_ip_values_function)));
61 };
62
63 add_secondary_variable(
64 "vapor_mass_flow_rate", 1,
66
67 add_secondary_variable(
68 "liquid_mass_flow_rate", 1,
70
71 add_secondary_variable(
72 "temperature", 1,
74
75 add_secondary_variable(
76 "dryness", 1,
78
79 add_secondary_variable(
80 "vapor_volume_fraction", 1,
82
84 const_cast<MeshLib::Mesh&>(mesh), "mix_density",
86}
87
89 const double t, double const dt, std::vector<GlobalVector*> const& x,
90 std::vector<GlobalVector*> const& x_prev, int const process_id,
92{
93 DBUG("Assemble WellboreSimulator Process.");
94
95 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
96
97 dof_tables.emplace_back(_local_to_global_index_map.get());
98
99 // Call global assembler for each local assembly item.
102 getActiveElementIDs(), dof_tables, t, dt, x, x_prev, process_id, &M, &K,
103 &b);
104}
105
107 const double t, double const dt, std::vector<GlobalVector*> const& x,
108 std::vector<GlobalVector*> const& x_prev, int const process_id,
109 GlobalVector& b, GlobalMatrix& Jac)
110{
111 DBUG("AssembleWithJacobian WellboreSimulator Process.");
112
113 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
114
115 dof_tables.emplace_back(_local_to_global_index_map.get());
116
117 // Call global assembler for each local assembly item.
120 _local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
121 process_id, &b, &Jac);
122}
123
125 double const t,
126 double const dt,
127 std::vector<GlobalVector*> const& x,
128 GlobalVector const& x_prev,
129 int const process_id)
130{
131 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
132 dof_tables.reserve(x.size());
133 dof_tables.push_back(_local_to_global_index_map.get());
134
137 _local_assemblers, getActiveElementIDs(), dof_tables, t, dt, x, x_prev,
138 process_id);
139}
140
142 std::vector<GlobalVector*> const& x,
143 std::vector<GlobalVector*> const& x_prev,
144 const double t,
145 const double dt,
146 int const process_id)
147{
148 std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
149 dof_tables.reserve(x.size());
150 dof_tables.push_back(_local_to_global_index_map.get());
151
154 _local_assemblers, getActiveElementIDs(), dof_tables, x, x_prev, t, dt,
155 process_id);
156}
157} // namespace WellboreSimulator
158} // namespace ProcessLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
Global vector based on Eigen vector.
Definition EigenVector.h:25
bool isAxiallySymmetric() const
Definition Mesh.h:137
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition Mesh.h:109
virtual void postTimestep(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual void computeSecondaryVariable(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id)
std::string const name
Definition Process.h:362
std::vector< std::size_t > const & getActiveElementIDs() const
Definition Process.h:167
SecondaryVariableCollection _secondary_variables
Definition Process.h:370
VectorMatrixAssembler _global_assembler
Definition Process.h:377
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition Process.h:368
NumLib::Extrapolator & getExtrapolator() const
Definition Process.h:208
Handles configuration of several secondary variables from the project file.
void addSecondaryVariable(std::string const &internal_name, SecondaryVariableFunctions &&fcts)
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix *M, GlobalMatrix *K, GlobalVector *b)
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector *b, GlobalMatrix *Jac)
virtual std::vector< double > const & getIntPtVaporMassFlowRate(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtLiquidMassFlowRate(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtTemperature(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtDryness(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const =0
virtual std::vector< double > const & getIntPtVaporVolumeFraction(const double, std::vector< GlobalVector * > const &, std::vector< NumLib::LocalToGlobalIndexMap const * > const &, std::vector< double > &cache) const =0
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_dot, const double t, const double dt, int const process_id) override
WellboreSimulatorProcess(std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > &&process_variables, WellboreSimulatorProcessData &&process_data, SecondaryVariableCollection &&secondary_variables)
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
void assembleConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
std::vector< std::unique_ptr< WellboreSimulatorLocalAssemblerInterface > > _local_assemblers
void computeSecondaryVariableConcrete(double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id) override
void assembleWithJacobianConcreteProcess(const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector &b, GlobalMatrix &Jac) override
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
void createLocalAssemblers(std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, ProviderOrOrder const &provider_or_order, ExtraCtorArgs &&... extra_ctor_args)
SecondaryVariableFunctions makeExtrapolator(const unsigned num_components, NumLib::Extrapolator &extrapolator, LocalAssemblerCollection const &local_assemblers, typename NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection >::IntegrationPointValuesMethod integration_point_values_method)
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)