OGS 6.2.0-97-g4a610c866
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<ParameterLib::ParameterBase>> const&
33  parameters,
34  unsigned const integration_order,
35  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>&&
36  process_variables,
37  GroundwaterFlowProcessData&& process_data,
38  SecondaryVariableCollection&& secondary_variables,
39  NumLib::NamedFunctionCaller&& named_function_caller,
40  std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux);
41 
44 
45  bool isLinear() const override { return true; }
47 
48  Eigen::Vector3d getFlux(std::size_t element_id,
49  MathLib::Point3d const& p,
50  double const t,
51  GlobalVector const& x) const override
52  {
53  // fetch local_x from primary variable
54  std::vector<GlobalIndexType> indices_cache;
55  auto const r_c_indices = NumLib::getRowColumnIndices(
56  element_id, *_local_to_global_index_map, indices_cache);
57  std::vector<double> local_x(x.get(r_c_indices.rows));
58 
59  return _local_assemblers[element_id]->getFlux(p, t, local_x);
60  }
61 
62  void postTimestepConcreteProcess(GlobalVector const& x,
63  const double t,
64  const double /*delta_t*/,
65  int const process_id) override
66  {
67  //For this single process, process_id is always zero.
68  if (process_id != 0)
69  {
70  OGS_FATAL("The condition of process_id = 0 must be satisfied for "
71  "GroundwaterFlowProcess, which is a single process." );
72  }
73  if (!_surfaceflux) // computing the surfaceflux is optional
74  {
75  return;
76  }
77 
78  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
79 
80  _surfaceflux->integrate(x, t, *this, process_id, _integration_order,
82  _surfaceflux->save(t);
83  }
84 
85 private:
87  NumLib::LocalToGlobalIndexMap const& dof_table,
88  MeshLib::Mesh const& mesh,
89  unsigned const integration_order) override;
90 
91  void assembleConcreteProcess(const double t, GlobalVector const& x,
92  GlobalMatrix& M, GlobalMatrix& K,
93  GlobalVector& b) override;
94 
96  const double t, GlobalVector const& x, GlobalVector const& xdot,
97  const double dxdot_dx, const double dx_dx, GlobalMatrix& M,
98  GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override;
99 
101 
102  std::vector<std::unique_ptr<GroundwaterFlowLocalAssemblerInterface>>
104 
105  std::unique_ptr<ProcessLib::SurfaceFluxData> _surfaceflux;
106 };
107 
108 } // namespace GroundwaterFlow
109 } // namespace ProcessLib
void assembleConcreteProcess(const double t, GlobalVector const &x, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
MeshLib::Mesh & _mesh
Definition: Process.h:262
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:124
unsigned const _integration_order
Definition: Process.h:285
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:265
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:63
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< 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)
std::vector< std::size_t > & getActiveElementIDs() const