OGS 6.1.0-1699-ge946d4c5f
GroundwaterFlowProcess.h
Go to the documentation of this file.
1 
10 #pragma once
11 
13 #include "ProcessLib/Process.h"
14 #include "GroundwaterFlowFEM.h"
17 
18 // TODO used for output, if output classes are ready this has to be changed
20 
21 namespace ProcessLib
22 {
23 namespace GroundwaterFlow
24 {
25 class GroundwaterFlowProcess final : public Process
26 {
27 public:
29  MeshLib::Mesh& mesh,
30  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&&
31  jacobian_assembler,
32  std::vector<std::unique_ptr<ParameterBase>> const& parameters,
33  unsigned const integration_order,
34  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
35  process_variables,
36  GroundwaterFlowProcessData&& process_data,
37  SecondaryVariableCollection&& secondary_variables,
38  NumLib::NamedFunctionCaller&& named_function_caller,
39  std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux);
40 
43 
44  bool isLinear() const override { return true; }
46 
47  Eigen::Vector3d getFlux(std::size_t element_id,
48  MathLib::Point3d const& p,
49  double const t,
50  GlobalVector const& x) const override
51  {
52  // fetch local_x from primary variable
53  std::vector<GlobalIndexType> indices_cache;
54  auto const r_c_indices = NumLib::getRowColumnIndices(
55  element_id, *_local_to_global_index_map, indices_cache);
56  std::vector<double> local_x(x.get(r_c_indices.rows));
57 
58  return _local_assemblers[element_id]->getFlux(p, t, local_x);
59  }
60 
61  void postTimestepConcreteProcess(GlobalVector const& x,
62  const double t,
63  const double /*delta_t*/,
64  int const process_id) override
65  {
66  //For this single process, process_id is always zero.
67  if (process_id != 0)
68  {
69  OGS_FATAL("The condition of process_id = 0 must be satisfied for "
70  "GroundwaterFlowProcess, which is a single process." );
71  }
72  if (!_surfaceflux) // computing the surfaceflux is optional
73  {
74  return;
75  }
76 
77  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
78 
79  _surfaceflux->integrate(x, t, *this, process_id, _integration_order,
81  _surfaceflux->save(t);
82  }
83 
84 private:
86  NumLib::LocalToGlobalIndexMap const& dof_table,
87  MeshLib::Mesh const& mesh,
88  unsigned const integration_order) override;
89 
90  void assembleConcreteProcess(const double t, GlobalVector const& x,
91  GlobalMatrix& M, GlobalMatrix& K,
92  GlobalVector& b) override;
93 
95  const double t, GlobalVector const& x, GlobalVector const& xdot,
96  const double dxdot_dx, const double dx_dx, GlobalMatrix& M,
97  GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override;
98 
100 
101  std::vector<std::unique_ptr<GroundwaterFlowLocalAssemblerInterface>>
103 
104  std::unique_ptr<ProcessLib::SurfaceFluxData> _surfaceflux;
105 };
106 
107 } // namespace GroundwaterFlow
108 } // namespace ProcessLib
void assembleConcreteProcess(const double t, GlobalVector const &x, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
MeshLib::Mesh & _mesh
Definition: Process.h:261
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:123
unsigned const _integration_order
Definition: Process.h:284
std::vector< std::unique_ptr< GroundwaterFlowLocalAssemblerInterface > > _local_assemblers
void postTimestepConcreteProcess(GlobalVector const &x, const double t, const double, int const process_id) override
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition: Process.h:264
Builds expression trees of named functions dynamically at runtime.
void assembleWithJacobianConcreteProcess(const double t, GlobalVector const &x, GlobalVector const &xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) override
void initializeConcreteProcess(NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
Process specific initialization called by initialize().
Eigen::Vector3d getFlux(std::size_t element_id, MathLib::Point3d const &p, double const t, GlobalVector const &x) const override
std::unique_ptr< ProcessLib::SurfaceFluxData > _surfaceflux
Handles configuration of several secondary variables from the project file.
#define OGS_FATAL(fmt,...)
Definition: Error.h:71
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)
GroundwaterFlowProcess(MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, GroundwaterFlowProcessData &&process_data, SecondaryVariableCollection &&secondary_variables, NumLib::NamedFunctionCaller &&named_function_caller, std::unique_ptr< ProcessLib::SurfaceFluxData > &&surfaceflux)
std::vector< std::size_t > & getActiveElementIDs() const