version 3.11-dev
Loading...
Searching...
No Matches
experimental/assembly/cvfelocalassembler.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14#ifndef DUMUX_EXPERIMENTAL_CVFE_LOCAL_ASSEMBLER_HH
15#define DUMUX_EXPERIMENTAL_CVFE_LOCAL_ASSEMBLER_HH
16
17#include <dune/common/exceptions.hh>
18#include <dune/common/hybridutilities.hh>
19#include <dune/common/reservedvector.hh>
20#include <dune/grid/common/gridenums.hh>
21#include <dune/istl/matrixindexset.hh>
22#include <dune/istl/bvector.hh>
23
30#include <dumux/common/typetraits/localdofs_.hh>
31
37
40
41#include <dumux/assembly/cvfevolvarsdeflectionpolicy_.hh>
42
43namespace Dumux::Experimental {
44
54template<class TypeTag, class Assembler, class Implementation>
55class CVFELocalAssemblerBase : public Experimental::FVLocalAssemblerBase<TypeTag, Assembler, Implementation>
56{
61 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
62 using SolutionVector = typename Assembler::SolutionVector;
63
64 static constexpr int numEq = GetPropType<TypeTag, Properties::ModelTraits>::numEq();
66
67public:
68
69 using ParentType::ParentType;
70
73
74
76 {
78 this->elemBcTypes().update(this->asImp_().problem(), this->element(), this->fvGeometry());
79 }
80
85 template <class ResidualVector, class StageParams, class PartialReassembler = DefaultPartialReassembler, class CouplingFunction = Noop>
86 void assembleJacobianAndResidual(JacobianMatrix& jac, ResidualVector& res, GridVariables& gridVariables,
87 const StageParams& stageParams, ResidualVector& temporal, ResidualVector& spatial,
88 ResidualVector& constrainedDofs,
89 const PartialReassembler* partialReassembler = nullptr,
90 const CouplingFunction& maybeAssembleCouplingBlocks = noop)
91 {
92 this->asImp_().bindLocalViews();
93 const auto eIdxGlobal = Deprecated::gridGeometry(this->asImp_().problem()).elementMapper().index(this->element());
94
95 this->localResidual().spatialWeight(1.0);
96 this->localResidual().temporalWeight(1.0);
97
98 const auto sWeight = stageParams.spatialWeight(stageParams.size()-1);
99 const auto tWeight = stageParams.temporalWeight(stageParams.size()-1);
100
101 const auto flux = this->evalLocalFluxAndSourceResidual(this->curElemVolVars());
102 const auto storage = this->localResidual().evalStorage(this->fvGeometry(), this->curElemVolVars());
103 ElementResidualVector origResidual(flux.size());
104 origResidual = 0.0;
105 for (const auto& scv : scvs(this->fvGeometry()))
106 {
107 spatial[scv.dofIndex()] += flux[scv.localDofIndex()];
108 temporal[scv.dofIndex()] += storage[scv.localDofIndex()];
109 origResidual[scv.localDofIndex()] += flux[scv.localDofIndex()]*sWeight + storage[scv.localDofIndex()]*tWeight;
110 res[scv.dofIndex()] += origResidual[scv.localDofIndex()];
111 }
112
113 this->localResidual().spatialWeight(sWeight);
114 this->localResidual().temporalWeight(tWeight);
115
116 if (partialReassembler && partialReassembler->elementColor(eIdxGlobal) == EntityColor::green)
117 {
118 // assemble the coupling blocks for coupled models (does nothing if not coupled)
119 maybeAssembleCouplingBlocks(origResidual);
120 }
121 else if (!this->elementIsGhost())
122 {
123 this->asImp_().assembleJacobian(jac, gridVariables, origResidual, partialReassembler); // forward to the internal implementation
124
125 // assemble the coupling blocks for coupled models (does nothing if not coupled)
126 maybeAssembleCouplingBlocks(origResidual);
127 }
128 else
129 {
130 // Treatment of ghost elements
131 assert(this->elementIsGhost());
132
133 // handle dofs per codimension
134 const auto& gridDiscretization = Deprecated::gridGeometry(this->asImp_().problem());
135 Dune::Hybrid::forEach(std::make_integer_sequence<int, dim+1>{}, [&](auto d)
136 {
137 constexpr int codim = dim - d;
138 const auto& localCoeffs = gridDiscretization.feCache().get(this->element().type()).localCoefficients();
139 for (int idx = 0; idx < localCoeffs.size(); ++idx)
140 {
141 const auto& localKey = localCoeffs.localKey(idx);
142
143 // skip if we are not handling this codim right now
144 if (localKey.codim() != codim)
145 continue;
146
147 // do not change the non-ghost entities
148 auto entity = this->element().template subEntity<codim>(localKey.subEntity());
149 if (entity.partitionType() == Dune::InteriorEntity || entity.partitionType() == Dune::BorderEntity)
150 continue;
151
152 // Set identity rows for ALL DOFs of this ghost entity.
153 // Entities with multiple DOFs (e.g. PQ3 edge interior DOFs with 2 per edge)
154 // require iterating over all DOF indices via asMultiMapper(dofMapper()).indices(entity).
155 using BlockType = typename JacobianMatrix::block_type;
156 for (const auto dofIndex : asMultiMapper(gridDiscretization.dofMapper()).indices(entity))
157 {
158 BlockType &J = jac[dofIndex][dofIndex];
159 for (int j = 0; j < BlockType::rows; ++j)
160 J[j][j] = 1.0;
161 res[dofIndex] = 0;
162 constrainedDofs[dofIndex] = 1;
163 }
164 }
165 });
166 }
167
168 auto applyDirichlet = [&] (const auto& scvI,
169 const auto& dirichletValues,
170 const auto eqIdx,
171 const auto pvIdx)
172 {
173 res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx];
174 constrainedDofs[scvI.dofIndex()][eqIdx] = 1;
175
176 auto& row = jac[scvI.dofIndex()];
177 for (auto col = row.begin(); col != row.end(); ++col)
178 row[col.index()][eqIdx] = 0.0;
179
180 jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0;
181
182 // if a periodic dof has Dirichlet values also apply the same Dirichlet values to the other dof
183 if (Deprecated::gridGeometry(this->asImp_().problem()).dofOnPeriodicBoundary(scvI.dofIndex()))
184 {
185 const auto periodicDof = Deprecated::gridGeometry(this->asImp_().problem()).periodicallyMappedDof(scvI.dofIndex());
186 res[periodicDof][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx];
187 constrainedDofs[periodicDof][eqIdx] = 1;
188 const auto end = jac[periodicDof].end();
189 for (auto it = jac[periodicDof].begin(); it != end; ++it)
190 (*it) = periodicDof != it.index() ? 0.0 : 1.0;
191 }
192 };
193
194 this->asImp_().enforceDirichletConstraints(applyDirichlet);
195 }
196
201 void assembleJacobian(JacobianMatrix& jac, GridVariables& gridVariables)
202 {
203 this->asImp_().bindLocalViews();
204 this->asImp_().assembleJacobian(jac, gridVariables); // forward to the internal implementation
205
206 auto applyDirichlet = [&] (const auto& scvI,
207 const auto& dirichletValues,
208 const auto eqIdx,
209 const auto pvIdx)
210 {
211 auto& row = jac[scvI.dofIndex()];
212 for (auto col = row.begin(); col != row.end(); ++col)
213 row[col.index()][eqIdx] = 0.0;
214
215 jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0;
216 };
217
218 this->asImp_().enforceDirichletConstraints(applyDirichlet);
219 }
220
224 template <class ResidualVector>
225 void assembleResidual(ResidualVector& res)
226 {
227 this->asImp_().bindLocalViews();
228 const auto residual = this->evalLocalResidual();
229
230 for (const auto& localDof : localDofs(this->fvGeometry()))
231 res[localDof.dofIndex()] += residual[localDof.index()];
232
233 auto applyDirichlet = [&] (const auto& scvI,
234 const auto& dirichletValues,
235 const auto eqIdx,
236 const auto pvIdx)
237 {
238 res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx];
239 };
240
241 this->asImp_().enforceDirichletConstraints(applyDirichlet);
242 }
243
247 template<class ResidualVector>
248 void assembleCurrentResidual(ResidualVector& spatialRes, ResidualVector& temporalRes)
249 {
250 this->asImp_().bindLocalViews();
251 const auto flux = this->evalLocalFluxAndSourceResidual(this->curElemVolVars());
252 const auto storage = this->localResidual().evalStorage(this->fvGeometry(), this->curElemVolVars());
253 for (const auto& scv : scvs(this->fvGeometry()))
254 {
255 spatialRes[scv.dofIndex()] += flux[scv.localDofIndex()];
256 temporalRes[scv.dofIndex()] += storage[scv.localDofIndex()];
257 }
258 }
259
261 template<typename ApplyFunction>
262 void enforceDirichletConstraints(const ApplyFunction& applyDirichlet)
263 {
264 // enforce Dirichlet boundary conditions
265 this->asImp_().evalDirichletBoundaries(applyDirichlet);
266 // take care of internal Dirichlet constraints (if enabled)
267 this->asImp_().enforceInternalDirichletConstraints(applyDirichlet);
268 }
269
273 template< typename ApplyDirichletFunctionType >
274 void evalDirichletBoundaries(ApplyDirichletFunctionType applyDirichlet)
275 {
276 // enforce Dirichlet boundaries by overwriting partial derivatives with 1 or 0
277 // and set the residual to (privar - dirichletvalue)
278 if (this->elemBcTypes().hasDirichlet())
279 {
280 for (const auto& scvI : scvs(this->fvGeometry()))
281 {
282 const auto bcTypes = this->elemBcTypes().get(this->fvGeometry(), scvI);
283 if (bcTypes.hasDirichlet())
284 {
285 const auto dirichletValues = this->asImp_().problem().dirichlet(this->element(), scvI);
286
287 // set the Dirichlet conditions in residual and jacobian
288 for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
289 {
290 if (bcTypes.isDirichlet(eqIdx))
291 {
292 const auto pvIdx = bcTypes.eqToDirichletIndex(eqIdx);
293 assert(0 <= pvIdx && pvIdx < numEq);
294 applyDirichlet(scvI, dirichletValues, eqIdx, pvIdx);
295 }
296 }
297 }
298 }
299 }
300 }
301
306 template<class... Args>
307 void maybeUpdateCouplingContext(Args&&...) {}
308
313 template<class... Args>
315};
316
326template<class TypeTag, class Assembler, DiffMethod diffMethod = DiffMethod::numeric, class Implementation = void>
328
335template<class TypeTag, class Assembler, class Implementation>
336class CVFELocalAssembler<TypeTag, Assembler, DiffMethod::numeric, Implementation>
337: public CVFELocalAssemblerBase<TypeTag, Assembler,
338 NonVoidOr<CVFELocalAssembler<TypeTag, Assembler, DiffMethod::numeric, Implementation>, Implementation>>
339{
344 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
347
348 static constexpr int numEq = GetPropType<TypeTag, Properties::ModelTraits>::numEq();
350
351 static constexpr bool enableGridFluxVarsCache
352 = GridVariables::GridFluxVariablesCache::cachingEnabled;
353 static constexpr bool solutionDependentFluxVarsCache
354 = GridVariables::GridFluxVariablesCache::FluxVariablesCache::isSolDependent;
355
356public:
357
360 using ParentType::ParentType;
361
362 template <class PartialReassembler = DefaultPartialReassembler>
363 void assembleJacobian(JacobianMatrix& A, GridVariables& gridVariables,
364 const ElementResidualVector& origResiduals,
365 const PartialReassembler* partialReassembler = nullptr)
366 {
367 if (this->isImplicit())
368 assembleJacobianImplicit_(A, gridVariables, origResiduals, partialReassembler);
369 else
370 assembleJacobianExplicit_(A, gridVariables, origResiduals, partialReassembler);
371 }
372
373private:
380 template <class PartialReassembler = DefaultPartialReassembler>
381 void assembleJacobianImplicit_(JacobianMatrix& A, GridVariables& gridVariables,
382 const ElementResidualVector& origResiduals,
383 const PartialReassembler* partialReassembler = nullptr)
384 {
385 // get some aliases for convenience
386 const auto& element = this->element();
387 const auto& fvGeometry = this->fvGeometry();
388 const auto& curSol = this->asImp_().curSol();
389
390 auto&& curElemVolVars = this->curElemVolVars();
391 auto&& elemFluxVarsCache = this->elemFluxVarsCache();
392
394 // //
395 // Calculate derivatives of all dofs in stencil with respect to the dofs in the element. In the //
396 // neighboring elements we do so by computing the derivatives of the fluxes which depend on the //
397 // actual element. In the actual element we evaluate the derivative of the entire residual. //
398 // //
400
401 // if all volvars in the stencil have to be updated or if it's enough to only update the
402 // volVars for the scv whose associated dof has been deflected
403 static const bool updateAllVolVars = getParamFromGroup<bool>(
404 this->asImp_().problem().paramGroup(), "Assembly.BoxVolVarsDependOnAllElementDofs", false
405 );
406
407 // create the element solution
408 const auto& gridDiscretization = Deprecated::gridGeometry(fvGeometry);
409 auto elemSol = elementSolution(element, curSol, gridDiscretization);
410
411 // create the vector storing the partial derivatives
412 ElementResidualVector partialDerivs(Dumux::Detail::LocalDofs::numLocalDofs(fvGeometry));
413
414 auto deflectionPolicy = Dumux::Detail::CVFE::makeVariablesDeflectionPolicy(
415 gridVariables.curGridVolVars(),
416 curElemVolVars,
417 fvGeometry,
418 updateAllVolVars
419 );
420
421 auto assembleDerivative = [&, this](const auto& localDof)
422 {
423 // dof index and corresponding actual pri vars
424 const auto dofIdx = localDof.dofIndex();
425 const auto localIdx = localDof.index();
426 deflectionPolicy.store(localDof);
427
428 // calculate derivatives w.r.t to the privars at the dof at hand
429 for (int pvIdx = 0; pvIdx < numEq; pvIdx++)
430 {
431 partialDerivs = 0.0;
432
433 auto evalResiduals = [&](Scalar priVar)
434 {
435 // update the volume variables and compute element residual
436 elemSol[localIdx][pvIdx] = priVar;
437 deflectionPolicy.update(elemSol, localDof, this->asImp_().problem());
438 if constexpr (solutionDependentFluxVarsCache)
439 {
440 elemFluxVarsCache.update(element, fvGeometry, curElemVolVars);
441 if constexpr (enableGridFluxVarsCache)
442 gridVariables.gridFluxVarsCache().updateElement(element, fvGeometry, curElemVolVars);
443 }
444 this->asImp_().maybeUpdateCouplingContext(localDof, elemSol, pvIdx);
445 return this->evalLocalResidual();
446 };
447
448 // derive the residuals numerically
449 static const NumericEpsilon<Scalar, numEq> eps_{this->asImp_().problem().paramGroup()};
450 static const int numDiffMethod = getParamFromGroup<int>(this->asImp_().problem().paramGroup(), "Assembly.NumericDifferenceMethod");
451 NumericDifferentiation::partialDerivative(evalResiduals, elemSol[localIdx][pvIdx], partialDerivs, origResiduals,
452 eps_(elemSol[localIdx][pvIdx], pvIdx), numDiffMethod);
453
454 // update the global stiffness matrix with the current partial derivatives
455 for (const auto& localDofJ : localDofs(fvGeometry))
456 {
457 // don't add derivatives for green dofs
458 if (!partialReassembler
459 || partialReassembler->dofColor(localDofJ.dofIndex()) != EntityColor::green)
460 {
461 for (int eqIdx = 0; eqIdx < numEq; eqIdx++)
462 {
463 // A[i][col][eqIdx][pvIdx] is the rate of change of
464 // the residual of equation 'eqIdx' at dof 'i'
465 // depending on the primary variable 'pvIdx' at dof
466 // 'col'.
467 A[localDofJ.dofIndex()][dofIdx][eqIdx][pvIdx] += partialDerivs[localDofJ.index()][eqIdx];
468 }
469 }
470 }
471
472 // restore the original state of the scv's volume variables
473 deflectionPolicy.restore(localDof);
474
475 // restore the original element solution
476 elemSol[localIdx][pvIdx] = curSol[localDof.dofIndex()][pvIdx];
477 this->asImp_().maybeUpdateCouplingContext(localDof, elemSol, pvIdx);
478 }
479 };
480
481 // calculation of the derivatives
482 for (const auto& localDof : localDofs(fvGeometry))
483 assembleDerivative(localDof);
484
485 // restore original state of the flux vars cache in case of global caching.
486 // In the case of local caching this is obsolete because the elemFluxVarsCache used here goes out of scope after this.
487 if constexpr (enableGridFluxVarsCache)
488 gridVariables.gridFluxVarsCache().updateElement(element, fvGeometry, curElemVolVars);
489
490 // evaluate additional derivatives that might arise from the coupling (no-op if not coupled)
491 this->asImp_().maybeEvalAdditionalDomainDerivatives(origResiduals, A, gridVariables);
492 }
493
499 template <class PartialReassembler = DefaultPartialReassembler>
500 void assembleJacobianExplicit_(JacobianMatrix& A, GridVariables& gridVariables,
501 const ElementResidualVector& origResiduals,
502 const PartialReassembler* partialReassembler = nullptr)
503 {
504 if (partialReassembler)
505 DUNE_THROW(Dune::NotImplemented, "partial reassembly for explicit time discretization");
506
507 // get some aliases for convenience
508 const auto& element = this->element();
509 const auto& fvGeometry = this->fvGeometry();
510 const auto& curSol = this->asImp_().curSol();
511 auto&& curElemVolVars = this->curElemVolVars();
512
513 // create the element solution
514 const auto& gridDiscretization = Deprecated::gridGeometry(fvGeometry);
515 auto elemSol = elementSolution(element, curSol, gridDiscretization);
516
517 // create the vector storing the partial derivatives
518 ElementResidualVector partialDerivs(Dumux::Detail::LocalDofs::numLocalDofs(fvGeometry));
519
520 // calculation of the derivatives
521 for (const auto& scv : scvs(fvGeometry))
522 {
523 // dof index and corresponding actual pri vars
524 const auto dofIdx = scv.dofIndex();
525 auto& curVolVars = this->getVolVarAccess(gridVariables.curGridVolVars(), curElemVolVars, scv);
526 const VolumeVariables origVolVars(curVolVars);
527
528 // calculate derivatives w.r.t to the privars at the dof at hand
529 for (int pvIdx = 0; pvIdx < numEq; pvIdx++)
530 {
531 partialDerivs = 0.0;
532
533 auto evalStorage = [&](Scalar priVar)
534 {
535 elemSol[scv.localDofIndex()][pvIdx] = priVar;
536 curVolVars.update(elemSol, this->asImp_().problem(), element, scv);
537 return this->evalStorage();
538 };
539
540 // derive the residuals numerically
541 static const NumericEpsilon<Scalar, numEq> eps_{this->asImp_().problem().paramGroup()};
542 static const int numDiffMethod = getParamFromGroup<int>(this->asImp_().problem().paramGroup(), "Assembly.NumericDifferenceMethod");
543 NumericDifferentiation::partialDerivative(evalStorage, elemSol[scv.localDofIndex()][pvIdx], partialDerivs, origResiduals,
544 eps_(elemSol[scv.localDofIndex()][pvIdx], pvIdx), numDiffMethod);
545
546 // update the global stiffness matrix with the current partial derivatives
547 for (int eqIdx = 0; eqIdx < numEq; eqIdx++)
548 {
549 // A[i][col][eqIdx][pvIdx] is the rate of change of
550 // the residual of equation 'eqIdx' at dof 'i'
551 // depending on the primary variable 'pvIdx' at dof
552 // 'col'.
553 A[dofIdx][dofIdx][eqIdx][pvIdx] += partialDerivs[scv.localDofIndex()][eqIdx];
554 }
555
556 // restore the original state of the scv's volume variables
557 curVolVars = origVolVars;
558
559 // restore the original element solution
560 elemSol[scv.localDofIndex()][pvIdx] = curSol[scv.dofIndex()][pvIdx];
561 }
562 }
563 }
564};
565
566} // end namespace Dumux
567
568#endif
A linear system assembler (residual and Jacobian) for general discretization schemes.
Definition assembly/assembler.hh:83
GetPropType< TypeTag, Properties::SolutionVector > SolutionVector
Definition assembly/assembler.hh:96
void assembleJacobian(JacobianMatrix &A, GridVariables &gridVariables, const ElementResidualVector &origResiduals, const PartialReassembler *partialReassembler=nullptr)
Definition experimental/assembly/cvfelocalassembler.hh:363
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition experimental/assembly/cvfelocalassembler.hh:359
typename ParentType::LocalResidual LocalResidual
Definition experimental/assembly/cvfelocalassembler.hh:358
A base class for all local CVFE assemblers.
Definition experimental/assembly/cvfelocalassembler.hh:56
void assembleJacobian(JacobianMatrix &jac, GridVariables &gridVariables)
Computes the derivatives with respect to the given element and adds them to the global matrix.
Definition experimental/assembly/cvfelocalassembler.hh:201
void bindLocalViews()
Definition experimental/assembly/cvfelocalassembler.hh:75
void assembleResidual(ResidualVector &res)
Assemble the residual only.
Definition experimental/assembly/cvfelocalassembler.hh:225
void assembleJacobianAndResidual(JacobianMatrix &jac, ResidualVector &res, GridVariables &gridVariables, const StageParams &stageParams, ResidualVector &temporal, ResidualVector &spatial, ResidualVector &constrainedDofs, const PartialReassembler *partialReassembler=nullptr, const CouplingFunction &maybeAssembleCouplingBlocks=noop)
Computes the derivatives with respect to the given element and adds them to the global matrix....
Definition experimental/assembly/cvfelocalassembler.hh:86
typename ParentType::LocalResidual LocalResidual
Definition experimental/assembly/cvfelocalassembler.hh:71
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition experimental/assembly/cvfelocalassembler.hh:72
void evalDirichletBoundaries(ApplyDirichletFunctionType applyDirichlet)
Evaluates Dirichlet boundaries.
Definition experimental/assembly/cvfelocalassembler.hh:274
void assembleCurrentResidual(ResidualVector &spatialRes, ResidualVector &temporalRes)
Assemble the residual only.
Definition experimental/assembly/cvfelocalassembler.hh:248
void maybeUpdateCouplingContext(Args &&...)
Update the coupling context for coupled models.
Definition experimental/assembly/cvfelocalassembler.hh:307
void maybeEvalAdditionalDomainDerivatives(Args &&...)
Update the additional domain derivatives for coupled models.
Definition experimental/assembly/cvfelocalassembler.hh:314
void enforceDirichletConstraints(const ApplyFunction &applyDirichlet)
Enforce Dirichlet constraints.
Definition experimental/assembly/cvfelocalassembler.hh:262
An assembler for Jacobian and residual contribution per element (CVFE methods).
Definition experimental/assembly/cvfelocalassembler.hh:327
A base class for all local assemblers.
Definition experimental/assembly/fvlocalassemblerbase.hh:38
ElementVolumeVariables & curElemVolVars()
The current element volume variables.
Definition experimental/assembly/fvlocalassemblerbase.hh:234
void bindLocalViews()
Convenience function bind and prepare all relevant variables required for the evaluation of the local...
Definition experimental/assembly/fvlocalassemblerbase.hh:163
ElementResidualVector evalLocalResidual() const
Convenience function to evaluate the complete local residual for the current element....
Definition experimental/assembly/fvlocalassemblerbase.hh:104
bool elementIsGhost() const
Returns if element is a ghost entity.
Definition experimental/assembly/fvlocalassemblerbase.hh:222
ElementResidualVector evalLocalFluxAndSourceResidual() const
Convenience function to evaluate the flux and source terms (i.e, the terms without a time derivative)...
Definition experimental/assembly/fvlocalassemblerbase.hh:133
const Problem & problem() const
The problem.
Definition experimental/assembly/fvlocalassemblerbase.hh:210
LocalResidual & localResidual()
The local residual for the current element.
Definition experimental/assembly/fvlocalassemblerbase.hh:242
const Element & element() const
The current element.
Definition experimental/assembly/fvlocalassemblerbase.hh:218
FVElementGeometry & fvGeometry()
The global finite volume geometry.
Definition experimental/assembly/fvlocalassemblerbase.hh:230
Implementation & asImp_()
Definition experimental/assembly/fvlocalassemblerbase.hh:274
ElementBoundaryTypes & elemBcTypes()
The element's boundary types.
Definition experimental/assembly/fvlocalassemblerbase.hh:246
std::decay_t< decltype(std::declval< Assembler >().localResidual())> LocalResidual
Definition experimental/assembly/fvlocalassemblerbase.hh:57
The grid variables class for general schemes, storing variables and data.
Definition discretization/gridvariables.hh:27
ReservedBlockVector< NumEqVector, Dumux::Detail::LocalDofs::maxNumLocalDofs< ElementDiscretization >()> ElementResidualVector
the container storing all element residuals
Definition assembly/localresidual.hh:56
static void partialDerivative(const Function &function, Scalar x0, FunctionEvalType &derivative, const FunctionEvalType &fx0, const int numericDifferenceMethod=1)
Computes the derivative of a function with respect to a function parameter.
Definition numericdifferentiation.hh:50
detects which entries in the Jacobian have to be recomputed
Definition partialreassembler.hh:420
Defines all properties used in Dumux.
Type traits.
The local element solution class for control-volume finite element methods.
Helpers for deprecation.
An enum class to define various differentiation methods available in order to compute the derivatives...
An enum class to define the colors of elements and vertices required for partial Jacobian reassembly.
A base class for all local assemblers.
DiffMethod
Differentiation methods in order to compute the derivatives of the residual i.e. the entries in the j...
Definition diffmethod.hh:25
@ numeric
Definition diffmethod.hh:26
@ green
does not need to be reassembled
Definition entitycolor.hh:40
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethods::cctpfa||GridGeometry::discMethod==DiscretizationMethods::ccmpfa, CCElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for cell-centered schemes.
Definition cellcentered/elementsolution.hh:101
@ element
Definition fieldtype.hh:23
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:149
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
Class representing dofs on elements for control-volume finite element schemes.
Adapter to expose a multi-DOF mapper interface for single- and multi-DOF mappers.
Definition assembly/assembler.hh:44
constexpr auto asMultiMapper(const Mapper &mapper)
Definition multimapperview.hh:48
constexpr auto noop
Function that performs no operation.
Definition common/typetraits/typetraits.hh:29
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
auto localDofs(const FVElementGeometry &fvGeometry)
range over local dofs
Definition localdof.hh:50
A class for numeric differentiation.
An adapter class for local assemblers using numeric differentiation.
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
Detects which entries in the Jacobian have to be recomputed.