https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AdvectiveFluxCalculatorBase.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "ElementUserObject.h"
14
29{
30public:
32
34
35 virtual void timestepSetup() override;
36
37 virtual void meshChanged() override;
38
39 virtual void initialize() override;
40
41 virtual void threadJoin(const UserObject & uo) override;
42
43 virtual void finalize() override;
44
45 virtual void execute() override;
46
57 virtual void executeOnElement(
58 dof_id_type global_i, dof_id_type global_j, unsigned local_i, unsigned local_j, unsigned qp);
59
65 Real getFluxOut(dof_id_type node_i) const;
66
73 const std::map<dof_id_type, Real> & getdFluxOutdu(dof_id_type node_i) const;
74
81 const std::vector<std::vector<Real>> & getdFluxOutdKjk(dof_id_type node_i) const;
82
91 unsigned getValence(dof_id_type node_i) const;
92
93protected:
102 virtual void buildCommLists();
103
108 virtual void exchangeGhostedInfo();
109
118 virtual Real computeVelocity(unsigned i, unsigned j, unsigned qp) const = 0;
119
124 virtual Real computeU(unsigned i) const = 0;
125
128
136 void limitFlux(Real a, Real b, Real & limited, Real & dlimited_db) const;
137
146 Real rPlus(dof_id_type sequential_i,
147 std::vector<Real> & dlimited_du,
148 std::vector<Real> & dlimited_dk) const;
149
158 Real rMinus(dof_id_type sequential_i,
159 std::vector<Real> & dlimited_du,
160 std::vector<Real> & dlimited_dk) const;
161
167
173 std::vector<std::vector<Real>> _kij;
174
176 std::vector<Real> _flux_out;
177
180 std::vector<std::map<dof_id_type, Real>> _dflux_out_du;
181
187 std::vector<std::vector<std::vector<Real>>> _dflux_out_dKjk;
188
192 std::vector<unsigned> _valence;
193
195 std::vector<Real> _u_nodal;
196
199
202
204 std::size_t _number_of_nodes;
205
207 processor_id_type _my_pid;
208
215 std::map<processor_id_type, std::vector<dof_id_type>> _nodes_to_receive;
216
223 std::map<processor_id_type, std::vector<dof_id_type>> _nodes_to_send;
224
232 std::map<processor_id_type, std::vector<std::pair<dof_id_type, dof_id_type>>> _pairs_to_receive;
233
241 std::map<processor_id_type, std::vector<std::pair<dof_id_type, dof_id_type>>> _pairs_to_send;
242
250
253 {
254 PPlus,
255 PMinus,
256 QPlus,
257 QMinus
258 };
259
271 Real PQPlusMinus(dof_id_type sequential_i,
272 const PQPlusMinusEnum pq_plus_minus,
273 std::vector<Real> & derivs,
274 std::vector<Real> & dpq_dk) const;
275
282 void zeroedConnection(std::map<dof_id_type, Real> & the_map, dof_id_type node_i) const;
283
285 std::vector<std::vector<Real>> _dij;
287 std::vector<std::vector<Real>> _dDij_dKij;
289 std::vector<std::vector<Real>> _dDij_dKji;
291 std::vector<std::vector<Real>> _dDii_dKij;
293 std::vector<std::vector<Real>> _dDii_dKji;
294
295 std::vector<std::vector<Real>> _lij;
296 std::vector<Real> _rP;
297 std::vector<Real> _rM;
298
300 std::vector<std::vector<Real>> _drP;
302 std::vector<std::vector<Real>> _drM;
304 std::vector<std::vector<Real>> _drP_dk;
306 std::vector<std::vector<Real>> _drM_dk;
307
309 std::vector<std::vector<Real>> _fa;
313 std::vector<std::vector<std::map<dof_id_type, Real>>> _dfa;
318 std::vector<std::vector<std::vector<Real>>> _dFij_dKik;
323 std::vector<std::vector<std::vector<Real>>> _dFij_dKjk;
324};
Base class to compute Advective fluxes.
PQPlusMinusEnum
Signals to the PQPlusMinus method what should be computed.
std::vector< std::vector< Real > > _drM
drM[i][j] = d(rM[i])/d(u[j]). Here j indexes the j^th node connected to i
std::vector< std::vector< Real > > _fa
fa[sequential_i][j] sequential_j is the j^th connection to sequential_i
FluxLimiterTypeEnum
Determines Flux Limiter type (Page 135 of Kuzmin and Turek) "None" means that limitFlux=0 always,...
Real rPlus(dof_id_type sequential_i, std::vector< Real > &dlimited_du, std::vector< Real > &dlimited_dk) const
Returns the value of R_{i}^{+}, Eqn (49) of KT.
std::vector< Real > _u_nodal
_u_nodal[i] = value of _u at sequential node number i
std::vector< std::vector< Real > > _dDij_dKji
dDij_dKji[i][j] = d(D[i][j])/d(K[j][i]) for i!=j
std::vector< std::vector< Real > > _kij
Kuzmin-Turek K_ij matrix.
virtual void executeOnElement(dof_id_type global_i, dof_id_type global_j, unsigned local_i, unsigned local_j, unsigned qp)
This is called by multiple times in execute() in a double loop over _current_elem's nodes (local_i an...
std::vector< std::vector< std::vector< Real > > > _dFij_dKik
dFij_dKik[sequential_i][j][k] = d(fa[sequential_i][j])/d(K[sequential_i][k]).
std::vector< std::vector< Real > > _lij
virtual void buildCommLists()
When using multiple processors, other processors will compute:
std::map< processor_id_type, std::vector< std::pair< dof_id_type, dof_id_type > > > _pairs_to_send
_pairs_to_send[proc_id] indicates the k(i, j) pairs that we will send to proc_id _pairs_to_send is fi...
std::vector< std::vector< Real > > _dDii_dKij
dDii_dKij[i][j] = d(D[i][i])/d(K[i][j])
virtual void threadJoin(const UserObject &uo) override
PorousFlowConnectedNodes _connections
Holds the sequential and global nodal IDs, and info regarding mesh connections between them.
std::map< processor_id_type, std::vector< dof_id_type > > _nodes_to_receive
_nodes_to_receive[proc_id] = list of sequential nodal IDs.
std::vector< std::vector< Real > > _dij
Vectors used in finalize()
virtual Real computeVelocity(unsigned i, unsigned j, unsigned qp) const =0
Computes the transfer velocity between current node i and current node j at the current qp in the cur...
void zeroedConnection(std::map< dof_id_type, Real > &the_map, dof_id_type node_i) const
Clears the_map, then, using _kij, constructs the_map so that the_map[node_id] = 0....
std::vector< std::map< dof_id_type, Real > > _dflux_out_du
_dflux_out_du[i][j] = d(flux_out[i])/d(u[j]).
std::vector< std::vector< Real > > _drP_dk
drP_dk[i][j] = d(rP[i])/d(K[i][j]). Here j indexes the j^th node connected to i
std::vector< std::vector< std::vector< Real > > > _dflux_out_dKjk
_dflux_out_dKjk[sequential_i][j][k] = d(flux_out[sequential_i])/d(K[j][k]).
Real rMinus(dof_id_type sequential_i, std::vector< Real > &dlimited_du, std::vector< Real > &dlimited_dk) const
Returns the value of R_{i}^{-}, Eqn (49) of KT.
Real getFluxOut(dof_id_type node_i) const
Returns the flux out of lobal node id.
std::vector< std::vector< Real > > _drM_dk
drM_dk[i][j] = d(rM[i])/d(K[i][j]). Here j indexes the j^th node connected to i
std::map< processor_id_type, std::vector< std::pair< dof_id_type, dof_id_type > > > _pairs_to_receive
_pairs_to_receive[proc_id] indicates the k(i, j) pairs that will be sent to us from proc_id _pairs_to...
std::vector< std::vector< Real > > _dDii_dKji
dDii_dKji[i][j] = d(D[i][i])/d(K[j][i])
virtual Real computeU(unsigned i) const =0
Computes the value of u at the local node id of the current element (_current_elem)
std::vector< std::vector< std::vector< Real > > > _dFij_dKjk
dFij_dKjk[sequential_i][j][k] = d(fa[sequential_i][j])/d(K[sequential_j][k]).
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _flux_limiter_type
std::vector< bool > _u_nodal_computed_by_thread
_u_nodal_computed_by_thread(i) = true if _u_nodal[i] has been computed in execute() by the thread on ...
const std::map< dof_id_type, Real > & getdFluxOutdu(dof_id_type node_i) const
Returns r where r[j] = d(flux out of global node i)/du(global node j) used in Jacobian computations.
std::vector< std::vector< Real > > _dDij_dKij
dDij_dKij[i][j] = d(D[i][j])/d(K[i][j]) for i!=j
std::vector< unsigned > _valence
_valence[i] = number of times, in a loop over elements seen by this processor (viz,...
processor_id_type _my_pid
processor ID of this object
std::size_t _number_of_nodes
Number of nodes held by the _connections object.
const Real _allowable_MB_wastage
A mooseWarning is issued if mb_wasted = (_connections.sizeSequential() - _connections....
std::map< processor_id_type, std::vector< dof_id_type > > _nodes_to_send
_nodes_to_send[proc_id] = list of sequential nodal IDs.
Real PQPlusMinus(dof_id_type sequential_i, const PQPlusMinusEnum pq_plus_minus, std::vector< Real > &derivs, std::vector< Real > &dpq_dk) const
Returns the value of P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} (depending on pq_plus_minus) which ...
const std::vector< std::vector< Real > > & getdFluxOutdKjk(dof_id_type node_i) const
Returns r where r[j][k] = d(flux out of global node i)/dK[connected node j][connected node k] used in...
virtual void exchangeGhostedInfo()
Sends and receives multi-processor information regarding u_nodal and k_ij.
void limitFlux(Real a, Real b, Real &limited, Real &dlimited_db) const
flux limiter, L, on Page 135 of Kuzmin and Turek
bool _resizing_needed
whether _kij, etc, need to be sized appropriately (and valence recomputed) at the start of the timest...
std::vector< std::vector< Real > > _drP
drP[i][j] = d(rP[i])/d(u[j]). Here j indexes the j^th node connected to i
std::vector< std::vector< std::map< dof_id_type, Real > > > _dfa
dfa[sequential_i][j][global_k] = d(fa[sequential_i][j])/du[global_k].
unsigned getValence(dof_id_type node_i) const
Returns the valence of the global node i Valence is the number of times the node is encountered in a ...
std::vector< Real > _flux_out
_flux_out[i] = flux of "heat" from sequential node i
const InputParameters & parameters() const
Class designed to hold node ID information and information about nodal connectivity.