25#ifndef DUMUX_DISCRETIZATION_CC_MPFA_O_LOCAL_ASSEMBLER_HH
26#define DUMUX_DISCRETIZATION_CC_MPFA_O_LOCAL_ASSEMBLER_HH
43template<
class P,
class EG,
class EV >
52 using ParentType::ParentType;
63 template<
class DataHandle,
class IV,
class TensorFunc >
66 assembleLocalMatrices_(handle.A(), handle.AB(), handle.CA(), handle.T(), handle.omegas(), iv, getT);
69 if (iv.numUnknowns() > 0)
81 template<
class DataHandle,
class IV,
class GetU >
82 void assembleU(DataHandle& handle,
const IV& iv,
const GetU& getU)
84 auto& u = handle.uj();
88 typename IV::Traits::IndexSet::LocalIndexType i = 0;
89 for (; i < iv.numScvs(); i++)
90 u[i] = getU( this->
elemVolVars()[iv.localScv(i).gridScvIndex()] );
91 for (
const auto& data : iv.dirichletData())
92 u[i++] = getU( this->
elemVolVars()[data.volVarIndex()] );
118 template<
class IV,
class TensorFunc >
119 void assembleLocalMatrices_(
typename IV::Traits::MatVecTraits::AMatrix& A,
120 typename IV::Traits::MatVecTraits::BMatrix& B,
121 typename IV::Traits::MatVecTraits::CMatrix& C,
122 typename IV::Traits::MatVecTraits::DMatrix& D,
123 typename IV::Traits::MatVecTraits::OmegaStorage& wijk,
124 IV& iv,
const TensorFunc& getT)
126 using LocalIndexType =
typename IV::Traits::IndexSet::LocalIndexType;
127 static constexpr int dim = IV::Traits::GridView::dimension;
128 static constexpr int dimWorld = IV::Traits::GridView::dimensionworld;
135 if (iv.numUnknowns() == 0)
141 for (LocalIndexType faceIdx = 0; faceIdx < iv.numFaces(); ++faceIdx)
143 const auto& curLocalScvf = iv.localScvf(faceIdx);
144 const auto& curGlobalScvf = this->
fvGeometry().scvf(curLocalScvf.gridScvfIndex());
145 const auto& neighborScvIndices = curLocalScvf.neighboringLocalScvIndices();
148 const auto& posLocalScv = iv.localScv(neighborScvIndices[0]);
149 const auto& posGlobalScv = this->
fvGeometry().scv(posLocalScv.gridScvIndex());
150 const auto& posVolVars = this->
elemVolVars()[posGlobalScv];
151 const auto& posElement = iv.element(neighborScvIndices[0]);
152 const auto tensor = getT(this->
problem(), posElement, posVolVars, this->
fvGeometry(), posGlobalScv);
158 const auto posScvLocalDofIdx = posLocalScv.localDofIndex();
159 for (LocalIndexType localDir = 0; localDir < dim; localDir++)
161 const auto& otherLocalScvf = iv.localScvf( posLocalScv.localScvfIndex(localDir) );
162 const auto otherLocalDofIdx = otherLocalScvf.localDofIndex();
163 D[faceIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir];
164 D[faceIdx][posScvLocalDofIdx] += wijk[faceIdx][0][localDir];
176 for (LocalIndexType faceIdx = 0; faceIdx < iv.numFaces(); ++faceIdx)
178 const auto& curLocalScvf = iv.localScvf(faceIdx);
179 const auto& curGlobalScvf = this->
fvGeometry().scvf(curLocalScvf.gridScvfIndex());
180 const auto curIsDirichlet = curLocalScvf.isDirichlet();
181 const auto curLocalDofIdx = curLocalScvf.localDofIndex();
184 const auto& neighborScvIndices = curLocalScvf.neighboringLocalScvIndices();
185 const auto& posLocalScv = iv.localScv(neighborScvIndices[0]);
186 const auto& posGlobalScv = this->
fvGeometry().scv(posLocalScv.gridScvIndex());
187 const auto& posVolVars = this->
elemVolVars()[posGlobalScv];
188 const auto& posElement = iv.element(neighborScvIndices[0]);
189 const auto tensor = getT(this->
problem(), posElement, posVolVars, this->
fvGeometry(), posGlobalScv);
196 for (
unsigned int localDir = 0; localDir < dim; localDir++)
198 const auto& otherLocalScvf = iv.localScvf( posLocalScv.localScvfIndex(localDir) );
199 const auto otherLocalDofIdx = otherLocalScvf.localDofIndex();
203 if (!otherLocalScvf.isDirichlet())
205 C[faceIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir];
207 A[curLocalDofIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir];
212 D[faceIdx][otherLocalDofIdx] -= wijk[faceIdx][0][localDir];
214 B[curLocalDofIdx][otherLocalDofIdx] += wijk[faceIdx][0][localDir];
218 const auto posScvLocalDofIdx = posLocalScv.localDofIndex();
219 D[faceIdx][posScvLocalDofIdx] += wijk[faceIdx][0][localDir];
222 B[curLocalDofIdx][posScvLocalDofIdx] -= wijk[faceIdx][0][localDir];
226 if (!curGlobalScvf.boundary())
229 for (
unsigned int idxInOutside = 0; idxInOutside < curGlobalScvf.numOutsideScvs(); ++idxInOutside)
231 const auto idxOnScvf = idxInOutside+1;
232 const auto& negLocalScv = iv.localScv( neighborScvIndices[idxOnScvf] );
233 const auto& negGlobalScv = this->
fvGeometry().scv(negLocalScv.gridScvIndex());
234 const auto& negVolVars = this->
elemVolVars()[negGlobalScv];
235 const auto& negElement = iv.element( neighborScvIndices[idxOnScvf] );
236 const auto negTensor = getT(this->
problem(), negElement, negVolVars, this->
fvGeometry(), negGlobalScv);
239 const auto& scvf = dim < dimWorld ? this->
fvGeometry().flipScvf(curGlobalScvf.index(), idxInOutside)
245 wijk[faceIdx][idxOnScvf] *= -1.0;
248 for (
int localDir = 0; localDir < dim; localDir++)
250 const auto otherLocalScvfIdx = negLocalScv.localScvfIndex(localDir);
251 const auto& otherLocalScvf = iv.localScvf(otherLocalScvfIdx);
252 const auto otherLocalDofIdx = otherLocalScvf.localDofIndex();
254 if (!otherLocalScvf.isDirichlet())
255 A[curLocalDofIdx][otherLocalDofIdx] += wijk[faceIdx][idxOnScvf][localDir];
257 B[curLocalDofIdx][otherLocalDofIdx] -= wijk[faceIdx][idxOnScvf][localDir];
260 B[curLocalDofIdx][negLocalScv.localDofIndex()] += wijk[faceIdx][idxOnScvf][localDir];
A class that contains helper functions as well as functionality which is common to different mpfa sch...
Defines the general interface of classes used for the assembly of the local systems of equations invo...
Dune::FieldVector< typename Tensor::field_type, Scv::myDimension > computeMpfaTransmissibility(const Scv &scv, const Scvf &scvf, const Tensor &T, typename Scv::ctype extrusionFactor)
Free function to evaluate the Mpfa transmissibility associated with the flux (in the form of flux = T...
Definition: mpfa/computetransmissibility.hh:51
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Defines the general interface of the local assembler classes for the assembly of the interaction volu...
Definition: localassemblerbase.hh:56
const FVElementGeometry & fvGeometry() const
Definition: localassemblerbase.hh:83
const ElementVolumeVariables & elemVolVars() const
Definition: localassemblerbase.hh:84
const Problem & problem() const
Definition: localassemblerbase.hh:82
A class that contains helper functions as well as functionality which is common to different mpfa sch...
Definition: localassemblerhelper.hh:46
static void solveLocalSystem(const FVElementGeometry &fvGeometry, DataHandle &handle, IV &iv)
Solves a previously assembled iv-local system of equations and stores the resulting transmissibilitie...
Definition: localassemblerhelper.hh:82
static void resizeMatrix(Matrix &M, size_type rows, size_type cols)
resizes a matrix to the given sizes (specialization for dynamic matrix type)
Definition: localassemblerhelper.hh:222
static void resizeVector(Vector &v, size_type size)
resizes a vector to the given size (specialization for dynamic matrix type)
Definition: localassemblerhelper.hh:238
Specialization of the interaction volume-local assembler class for the schemes using an mpfa-o type a...
Definition: discretization/cellcentered/mpfa/omethod/localassembler.hh:46
void assembleMatrices(DataHandle &handle, IV &iv, const TensorFunc &getT)
Assembles the matrices involved in the flux expressions and the local system of equations within an i...
Definition: discretization/cellcentered/mpfa/omethod/localassembler.hh:64
void assembleU(DataHandle &handle, const IV &iv, const GetU &getU)
Assembles the vector of primary (cell) unknowns and (maybe) Dirichlet boundary conditions within an i...
Definition: discretization/cellcentered/mpfa/omethod/localassembler.hh:82
This file contains free functions to evaluate the transmissibilities associated with flux evaluations...