OGS
ProcessLib::AssembledMatrixCache Struct Referencefinal

Detailed Description

Definition at line 27 of file AssembledMatrixCache.h.

#include <AssembledMatrixCache.h>

Public Member Functions

 AssembledMatrixCache (bool const is_linear, bool const use_monolithic_scheme)
 
template<typename VectorOfLocalAssemblers >
void assemble (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix *const M, GlobalMatrix *const K, GlobalVector *const b, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, VectorMatrixAssembler &global_assembler, VectorOfLocalAssemblers const &local_assemblers, std::vector< std::size_t > const &active_element_ids)
 
bool isLinear () const
 

Private Attributes

bool const is_linear_
 
std::unique_ptr< GlobalMatrixM_ {}
 
std::unique_ptr< GlobalMatrixK_ {}
 
std::unique_ptr< GlobalVectorb_ {}
 

Constructor & Destructor Documentation

◆ AssembledMatrixCache()

ProcessLib::AssembledMatrixCache::AssembledMatrixCache ( bool const is_linear,
bool const use_monolithic_scheme )

Definition at line 15 of file AssembledMatrixCache.cpp.

17 : is_linear_{is_linear && use_monolithic_scheme}
18{
19 if (is_linear && !use_monolithic_scheme)
20 {
22 "You requested to assemble only once in combination with staggered "
23 "coupling. This use case is not yet implemented.");
24 }
25
26 if (is_linear_)
27 {
28 WARN(
29 "You specified that the process simulated by OGS is linear. With "
30 "that optimization the process will be assembled only once and the "
31 "non-linear solver will do only one iteration per time step. No "
32 "non-linearities will be resolved and OGS will not detect if there "
33 "are any non-linearities. It is your responsibility to ensure that "
34 "the assembled equation systems are linear, indeed! There is no "
35 "safety net!");
36 }
37}
#define OGS_FATAL(...)
Definition Error.h:26
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40

References is_linear_, OGS_FATAL, and WARN().

Member Function Documentation

◆ assemble()

template<typename VectorOfLocalAssemblers >
void ProcessLib::AssembledMatrixCache::assemble ( const double t,
double const dt,
std::vector< GlobalVector * > const & x,
std::vector< GlobalVector * > const & x_prev,
int const process_id,
GlobalMatrix *const M,
GlobalMatrix *const K,
GlobalVector *const b,
std::vector< NumLib::LocalToGlobalIndexMap const * > const & dof_tables,
VectorMatrixAssembler & global_assembler,
VectorOfLocalAssemblers const & local_assemblers,
std::vector< std::size_t > const & active_element_ids )

Definition at line 53 of file AssembledMatrixCache.h.

61{
62 if (bool const cache_empty = K_ == nullptr; cache_empty)
63 {
64 BaseLib::RunTime time_asm;
65 time_asm.start();
66
67 // Call global assembler for each local assembly item.
69 global_assembler, &VectorMatrixAssembler::assemble,
70 local_assemblers, active_element_ids, dof_tables, t, dt, x, x_prev,
71 process_id, M, K, b);
72
76
77 INFO("[time] Calling local assemblers took {:g} s", time_asm.elapsed());
78
79 if (is_linear_)
80 {
81 DBUG("Saving global K, M, b for later reuse.");
82
83 BaseLib::RunTime time_save;
84 time_save.start();
85
89
90 INFO("[time] Saving global K, M, b took {:g} s",
91 time_save.elapsed());
92 }
93 }
94 else
95 {
96 DBUG("Reusing saved global K, M, b.");
97
98 BaseLib::RunTime time_restore;
99 time_restore.start();
100
104
105 INFO("[time] Restoring global K, M, b took {:g} s",
106 time_restore.elapsed());
107 }
108}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
Count the running time.
Definition RunTime.h:29
double elapsed() const
Get the elapsed time in seconds.
Definition RunTime.h:42
void start()
Start the timer.
Definition RunTime.h:32
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 copy(PETScVector const &x, PETScVector &y)
Definition LinAlg.cpp:37
void finalizeVectorAssembly(VEC_T &)
General function to finalize the vector assembly.
bool finalizeMatrixAssembly(MAT_T &)
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)
std::unique_ptr< GlobalMatrix > M_
std::unique_ptr< GlobalMatrix > K_
std::unique_ptr< GlobalVector > b_

References ProcessLib::VectorMatrixAssembler::assemble(), b_, MathLib::LinAlg::copy(), DBUG(), BaseLib::RunTime::elapsed(), NumLib::SerialExecutor::executeSelectedMemberDereferenced(), MathLib::finalizeMatrixAssembly(), MathLib::finalizeVectorAssembly(), INFO(), is_linear_, K_, M_, and BaseLib::RunTime::start().

Referenced by ProcessLib::ComponentTransport::ComponentTransportProcess::assembleConcreteProcess(), and ProcessLib::HeatConduction::HeatConductionProcess::assembleConcreteProcess().

◆ isLinear()

bool ProcessLib::AssembledMatrixCache::isLinear ( ) const
inline

Member Data Documentation

◆ b_

std::unique_ptr<GlobalVector> ProcessLib::AssembledMatrixCache::b_ {}
private

Definition at line 49 of file AssembledMatrixCache.h.

49{};

Referenced by assemble().

◆ is_linear_

bool const ProcessLib::AssembledMatrixCache::is_linear_
private

Definition at line 45 of file AssembledMatrixCache.h.

Referenced by AssembledMatrixCache(), assemble(), and isLinear().

◆ K_

std::unique_ptr<GlobalMatrix> ProcessLib::AssembledMatrixCache::K_ {}
private

Definition at line 48 of file AssembledMatrixCache.h.

48{};

Referenced by assemble().

◆ M_

std::unique_ptr<GlobalMatrix> ProcessLib::AssembledMatrixCache::M_ {}
private

Definition at line 47 of file AssembledMatrixCache.h.

47{};

Referenced by assemble().


The documentation for this struct was generated from the following files: