OGS
SteadyStateDiffusion.h
Go to the documentation of this file.
1
11#pragma once
12
14#include "ProcessLib/Process.h"
18
19namespace ProcessLib
20{
21namespace SteadyStateDiffusion
22{
23class SteadyStateDiffusion final : public Process
24{
25public:
27 std::string name,
28 MeshLib::Mesh& mesh,
29 std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&&
30 jacobian_assembler,
31 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const&
32 parameters,
33 unsigned const integration_order,
34 std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
35 process_variables,
36 SteadyStateDiffusionData&& process_data,
37 SecondaryVariableCollection&& secondary_variables,
38 std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux);
39
42
43 bool isLinear() const override { return true; }
45
46 Eigen::Vector3d getFlux(std::size_t element_id,
47 MathLib::Point3d const& p,
48 double const t,
49 std::vector<GlobalVector*> const& x) const override
50 {
51 // fetch local_x from primary variable
52 std::vector<GlobalIndexType> indices_cache;
53 auto const r_c_indices = NumLib::getRowColumnIndices(
54 element_id, *_local_to_global_index_map, indices_cache);
55 constexpr int process_id = 0; // monolithic scheme.
56 std::vector<double> local_x(x[process_id]->get(r_c_indices.rows));
57
58 return _local_assemblers[element_id]->getFlux(p, t, local_x);
59 }
60
62 std::vector<GlobalVector*> const& x,
63 std::vector<GlobalVector*> const& /*x_prev*/,
64 const double t,
65 const double /*delta_t*/,
66 int const process_id) override
67 {
68 // For this single process, process_id is always zero.
69 if (process_id != 0)
70 {
72 "The condition of process_id = 0 must be satisfied for "
73 "SteadyStateDiffusion, which is a single process.");
74 }
75 if (!_surfaceflux) // computing the surfaceflux is optional
76 {
77 return;
78 }
79
80 _surfaceflux->integrate(x, t, *this, process_id, _integration_order,
82 }
83
84private:
86 NumLib::LocalToGlobalIndexMap const& dof_table,
87 MeshLib::Mesh const& mesh,
88 unsigned const integration_order) override;
89
90 void assembleConcreteProcess(const double t, double const dt,
91 std::vector<GlobalVector*> const& x,
92 std::vector<GlobalVector*> const& x_prev,
93 int const process_id, GlobalMatrix& M,
94 GlobalMatrix& K, GlobalVector& b) override;
95
97 const double t, double const dt, std::vector<GlobalVector*> const& x,
98 std::vector<GlobalVector*> const& x_prev, int const process_id,
99 GlobalVector& b, GlobalMatrix& Jac) override;
100
102
103 std::vector<std::unique_ptr<SteadyStateDiffusionLocalAssemblerInterface>>
105
106 std::unique_ptr<ProcessLib::SurfaceFluxData> _surfaceflux;
107};
108
109} // namespace SteadyStateDiffusion
110} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
Global vector based on Eigen vector.
Definition EigenVector.h:25
std::string const name
Definition Process.h:362
MeshLib::Mesh & _mesh
Definition Process.h:365
std::vector< std::size_t > const & getActiveElementIDs() const
Definition Process.h:167
unsigned const _integration_order
Definition Process.h:384
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition Process.h:368
Handles configuration of several secondary variables from the project file.
std::unique_ptr< ProcessLib::SurfaceFluxData > _surfaceflux
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
std::vector< std::unique_ptr< SteadyStateDiffusionLocalAssemblerInterface > > _local_assemblers
void postTimestepConcreteProcess(std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &, const double t, const double, 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
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
Eigen::Vector3d getFlux(std::size_t element_id, MathLib::Point3d const &p, double const t, std::vector< GlobalVector * > const &x) const override
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)