OGS 6.2.1-97-g73d1aeda3
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  std::string name,
30  MeshLib::Mesh& mesh,
31  std::unique_ptr<ProcessLib::AbstractJacobianAssembler>&&
32  jacobian_assembler,
33  std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const&
34  parameters,
35  unsigned const integration_order,
36  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
37  process_variables,
38  GroundwaterFlowProcessData&& process_data,
39  SecondaryVariableCollection&& secondary_variables,
40  NumLib::NamedFunctionCaller&& named_function_caller,
41  std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux);
42 
45 
46  bool isLinear() const override { return true; }
48 
49  Eigen::Vector3d getFlux(std::size_t element_id,
50  MathLib::Point3d const& p,
51  double const t,
52  GlobalVector const& x) const override
53  {
54  // fetch local_x from primary variable
55  std::vector<GlobalIndexType> indices_cache;
56  auto const r_c_indices = NumLib::getRowColumnIndices(
57  element_id, *_local_to_global_index_map, indices_cache);
58  std::vector<double> local_x(x.get(r_c_indices.rows));
59 
60  return _local_assemblers[element_id]->getFlux(p, t, local_x);
61  }
62 
63  void postTimestepConcreteProcess(GlobalVector const& x,
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  {
71  OGS_FATAL("The condition of process_id = 0 must be satisfied for "
72  "GroundwaterFlowProcess, which is a single process." );
73  }
74  if (!_surfaceflux) // computing the surfaceflux is optional
75  {
76  return;
77  }
78 
79  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
80 
81  _surfaceflux->integrate(x, t, *this, process_id, _integration_order,
83  _surfaceflux->save(t);
84  }
85 
86 private:
88  NumLib::LocalToGlobalIndexMap const& dof_table,
89  MeshLib::Mesh const& mesh,
90  unsigned const integration_order) override;
91 
92  void assembleConcreteProcess(const double t, GlobalVector const& x,
93  GlobalMatrix& M, GlobalMatrix& K,
94  GlobalVector& b) override;
95 
97  const double t, GlobalVector const& x, GlobalVector const& xdot,
98  const double dxdot_dx, const double dx_dx, GlobalMatrix& M,
99  GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override;
100 
102 
103  std::vector<std::unique_ptr<GroundwaterFlowLocalAssemblerInterface>>
105 
106  std::unique_ptr<ProcessLib::SurfaceFluxData> _surfaceflux;
107 };
108 
109 } // namespace GroundwaterFlow
110 } // namespace ProcessLib
void assembleConcreteProcess(const double t, GlobalVector const &x, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
MeshLib::Mesh & _mesh
Definition: Process.h:287
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:125
unsigned const _integration_order
Definition: Process.h:310
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:290
Builds expression trees of named functions dynamically at runtime.
GroundwaterFlowProcess(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, GroundwaterFlowProcessData &&process_data, SecondaryVariableCollection &&secondary_variables, NumLib::NamedFunctionCaller &&named_function_caller, std::unique_ptr< ProcessLib::SurfaceFluxData > &&surfaceflux)
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:63
NumLib::LocalToGlobalIndexMap::RowColumnIndices getRowColumnIndices(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table, std::vector< GlobalIndexType > &indices)
std::string const name
Definition: Process.h:284
std::vector< std::size_t > & getActiveElementIDs() const