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];