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
44
45namespace Dumux::Experimental {
46
56template<class TypeTag, class Assembler, class Implementation>
57class CVFELocalAssemblerBase : public Experimental::FVLocalAssemblerBase<TypeTag, Assembler, Implementation>
58{
63 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
64 using SolutionVector = typename Assembler::SolutionVector;
65
66 static constexpr int numEq = GetPropType<TypeTag, Properties::ModelTraits>::numEq();
68
69public:
70
71 using ParentType::ParentType;
72
75
76
78 {
80 this->elemBcTypes().update(this->asImp_().problem(), this->element(), this->fvGeometry());
81 }
82
87 template <class ResidualVector, class StageParams, class PartialReassembler = DefaultPartialReassembler, class CouplingFunction = Noop>
88 void assembleJacobianAndResidual(JacobianMatrix& jac, ResidualVector& res, GridVariables& gridVariables,
89 const StageParams& stageParams, ResidualVector& temporal, ResidualVector& spatial,
90 ResidualVector& constrainedDofs,
91 const PartialReassembler* partialReassembler = nullptr,
92 const CouplingFunction& maybeAssembleCouplingBlocks = noop)
93 {
94 this->asImp_().bindLocalViews();
95 const auto eIdxGlobal = Dumux::gridDiscretization(this->asImp_().problem()).elementMapper().index(this->element());
96
97 this->localResidual().spatialWeight(1.0);
98 this->localResidual().temporalWeight(1.0);
99
100 const auto sWeight = stageParams.spatialWeight(stageParams.size()-1);
101 const auto tWeight = stageParams.temporalWeight(stageParams.size()-1);
102
103 const auto flux = this->evalLocalFluxAndSourceResidual(this->curElemVolVars());
104 const auto storage = this->localResidual().evalStorage(this->fvGeometry(), this->curElemVolVars());
105 ElementResidualVector origResidual(flux.size());
106 origResidual = 0.0;
107 for (const auto& scv : scvs(this->fvGeometry()))
108 {
109 spatial[scv.dofIndex()] += flux[scv.localDofIndex()];
110 temporal[scv.dofIndex()] += storage[scv.localDofIndex()];
111 if (!stageParams.skipSpatial(stageParams.size()-1))
112 origResidual[scv.localDofIndex()] += flux[scv.localDofIndex()]*sWeight;
113 if (!stageParams.skipTemporal(stageParams.size()-1))
114 origResidual[scv.localDofIndex()] += storage[scv.localDofIndex()]*tWeight;
115 res[scv.dofIndex()] += origResidual[scv.localDofIndex()];
116 }
117
118 this->localResidual().spatialWeight(sWeight, stageParams.skipSpatial(stageParams.size()-1));
119 this->localResidual().temporalWeight(tWeight, stageParams.skipTemporal(stageParams.size()-1));
120
121 if (partialReassembler && partialReassembler->elementColor(eIdxGlobal) == EntityColor::green)
122 {
123 // assemble the coupling blocks for coupled models (does nothing if not coupled)
124 maybeAssembleCouplingBlocks(origResidual);
125 }
126 else if (!this->elementIsGhost())
127 {
128 this->asImp_().assembleJacobian(jac, gridVariables, origResidual, partialReassembler); // forward to the internal implementation
129
130 // assemble the coupling blocks for coupled models (does nothing if not coupled)
131 maybeAssembleCouplingBlocks(origResidual);
132 }
133 else
134 {
135 // Treatment of ghost elements
136 assert(this->elementIsGhost());
137
138 // handle dofs per codimension
140 Dune::Hybrid::forEach(std::make_integer_sequence<int, dim+1>{}, [&](auto d)
141 {
142 constexpr int codim = dim - d;
143 const auto& localCoeffs = gridDiscretization.feCache().get(this->element().type()).localCoefficients();
144 for (int idx = 0; idx < localCoeffs.size(); ++idx)
145 {
146 const auto& localKey = localCoeffs.localKey(idx);
147
148 // skip if we are not handling this codim right now
149 if (localKey.codim() != codim)
150 continue;
151
152 // do not change the non-ghost entities
153 auto entity = this->element().template subEntity<codim>(localKey.subEntity());
154 if (entity.partitionType() == Dune::InteriorEntity || entity.partitionType() == Dune::BorderEntity)
155 continue;
156
157 // Set identity rows for ALL DOFs of this ghost entity.
158 // Entities with multiple DOFs (e.g. PQ3 edge interior DOFs with 2 per edge)
159 // require iterating over all DOF indices via asMultiMapper(dofMapper()).indices(entity).
160 using BlockType = typename JacobianMatrix::block_type;
161 for (const auto dofIndex : asMultiMapper(gridDiscretization.dofMapper()).indices(entity))
162 {
163 BlockType &J = jac[dofIndex][dofIndex];
164 for (int j = 0; j < BlockType::rows; ++j)
165 J[j][j] = 1.0;
166 res[dofIndex] = 0;
167 constrainedDofs[dofIndex] = 1;
168 }
169 }
170 });
171 }
172
173 auto applyDirichlet = [&] (const auto& scvI,
174 const auto& dirichletValues,
175 const auto eqIdx,
176 const auto pvIdx)
177 {
178 res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx];
179 constrainedDofs[scvI.dofIndex()][eqIdx] = 1;
180
181 auto& row = jac[scvI.dofIndex()];
182 for (auto col = row.begin(); col != row.end(); ++col)
183 row[col.index()][eqIdx] = 0.0;
184
185 jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0;
186
187 // if a periodic dof has Dirichlet values also apply the same Dirichlet values to the other dof
188 if (Dumux::gridDiscretization(this->asImp_().problem()).dofOnPeriodicBoundary(scvI.dofIndex()))
189 {
190 for (const auto periodicDof :
191 Dumux::Deprecated::rangeOfPeriodicallyMappedDofs(Dumux::gridDiscretization(this->asImp_().problem()), scvI.dofIndex()))
192 {
193 res[periodicDof][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx];
194 constrainedDofs[periodicDof][eqIdx] = 1;
195 const auto end = jac[periodicDof].end();
196 for (auto it = jac[periodicDof].begin(); it != end; ++it)
197 (*it) = periodicDof != it.index() ? 0.0 : 1.0;
198 }
199 }
200 };
201
202 this->asImp_().enforceDirichletConstraints(applyDirichlet);
203 }
204
209 void assembleJacobian(JacobianMatrix& jac, GridVariables& gridVariables)
210 {
211 this->asImp_().bindLocalViews();
212 this->asImp_().assembleJacobian(jac, gridVariables); // forward to the internal implementation
213
214 auto applyDirichlet = [&] (const auto& scvI,
215 const auto& dirichletValues,
216 const auto eqIdx,
217 const auto pvIdx)
218 {
219 auto& row = jac[scvI.dofIndex()];
220 for (auto col = row.begin(); col != row.end(); ++col)
221 row[col.index()][eqIdx] = 0.0;
222
223 jac[scvI.dofIndex()][scvI.dofIndex()][eqIdx][pvIdx] = 1.0;
224 };
225
226 this->asImp_().enforceDirichletConstraints(applyDirichlet);
227 }
228
232 template <class ResidualVector>
233 void assembleResidual(ResidualVector& res)
234 {
235 this->asImp_().bindLocalViews();
236 const auto residual = this->evalLocalResidual();
237
238 for (const auto& localDof : localDofs(this->fvGeometry()))
239 res[localDof.dofIndex()] += residual[localDof.index()];
240
241 auto applyDirichlet = [&] (const auto& scvI,
242 const auto& dirichletValues,
243 const auto eqIdx,
244 const auto pvIdx)
245 {
246 res[scvI.dofIndex()][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx];
247 };
248
249 this->asImp_().enforceDirichletConstraints(applyDirichlet);
250 }
251
255 template<class ResidualVector>
256 void assembleCurrentResidual(ResidualVector& spatialRes, ResidualVector& temporalRes)
257 {
258 this->asImp_().bindLocalViews();
259 const auto flux = this->evalLocalFluxAndSourceResidual(this->curElemVolVars());
260 const auto storage = this->localResidual().evalStorage(this->fvGeometry(), this->curElemVolVars());
261 for (const auto& scv : scvs(this->fvGeometry()))
262 {
263 spatialRes[scv.dofIndex()] += flux[scv.localDofIndex()];
264 temporalRes[scv.dofIndex()] += storage[scv.localDofIndex()];
265 }
266 }
267
269 template<typename ApplyFunction>
270 void enforceDirichletConstraints(const ApplyFunction& applyDirichlet)
271 {
272 // enforce Dirichlet boundary conditions
273 this->asImp_().evalDirichletBoundaries(applyDirichlet);
274 // take care of internal Dirichlet constraints (if enabled)
275 this->asImp_().enforceInternalDirichletConstraints(applyDirichlet);
276 }
277
281 template< typename ApplyDirichletFunctionType >
282 void evalDirichletBoundaries(ApplyDirichletFunctionType applyDirichlet)
283 {
284 // enforce Dirichlet boundaries by overwriting partial derivatives with 1 or 0
285 // and set the residual to (privar - dirichletvalue)
286 if (this->elemBcTypes().hasDirichlet())
287 {
288 for (const auto& scvI : scvs(this->fvGeometry()))
289 {
290 const auto bcTypes = this->elemBcTypes().get(this->fvGeometry(), scvI);
291 if (bcTypes.hasDirichlet())
292 {
293 const auto dirichletValues = this->asImp_().problem().dirichlet(this->element(), scvI);
294
295 // set the Dirichlet conditions in residual and jacobian
296 for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
297 {
298 if (bcTypes.isDirichlet(eqIdx))
299 {
300 const auto pvIdx = bcTypes.eqToDirichletIndex(eqIdx);
301 assert(0 <= pvIdx && pvIdx < numEq);
302 applyDirichlet(scvI, dirichletValues, eqIdx, pvIdx);
303 }
304 }
305 }
306 }
307 }
308 }
309
314 template<class... Args>
315 void maybeUpdateCouplingContext(Args&&...) {}
316
321 template<class... Args>
323};
324
334template<class TypeTag, class Assembler, DiffMethod diffMethod = DiffMethod::numeric, class Implementation = void>
336
343template<class TypeTag, class Assembler, class Implementation>
344class CVFELocalAssembler<TypeTag, Assembler, DiffMethod::numeric, Implementation>
345: public CVFELocalAssemblerBase<TypeTag, Assembler,
346 NonVoidOr<CVFELocalAssembler<TypeTag, Assembler, DiffMethod::numeric, Implementation>, Implementation>>
347{
352 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
355
356 static constexpr int numEq = GetPropType<TypeTag, Properties::ModelTraits>::numEq();
358
359 static constexpr bool enableGridFluxVarsCache
360 = GridVariables::GridFluxVariablesCache::cachingEnabled;
361 static constexpr bool solutionDependentFluxVarsCache
362 = GridVariables::GridFluxVariablesCache::FluxVariablesCache::isSolDependent;
363
364public:
365
368 using ParentType::ParentType;
369
370 template <class PartialReassembler = DefaultPartialReassembler>
371 void assembleJacobian(JacobianMatrix& A, GridVariables& gridVariables,
372 const ElementResidualVector& origResiduals,
373 const PartialReassembler* partialReassembler = nullptr)
374 {
375 if (this->isImplicit())
376 assembleJacobianImplicit_(A, gridVariables, origResiduals, partialReassembler);
377 else
378 assembleJacobianExplicit_(A, gridVariables, origResiduals, partialReassembler);
379 }
380
381private:
388 template <class PartialReassembler = DefaultPartialReassembler>
389 void assembleJacobianImplicit_(JacobianMatrix& A, GridVariables& gridVariables,
390 const ElementResidualVector& origResiduals,
391 const PartialReassembler* partialReassembler = nullptr)
392 {
393 // get some aliases for convenience
394 const auto& element = this->element();
395 const auto& fvGeometry = this->fvGeometry();
396 const auto& curSol = this->asImp_().curSol();
397
398 auto&& curElemVolVars = this->curElemVolVars();
399 auto&& elemFluxVarsCache = this->elemFluxVarsCache();
400
402 // //
403 // Calculate derivatives of all dofs in stencil with respect to the dofs in the element. In the //
404 // neighboring elements we do so by computing the derivatives of the fluxes which depend on the //
405 // actual element. In the actual element we evaluate the derivative of the entire residual. //
406 // //
408
409 // if all volvars in the stencil have to be updated or if it's enough to only update the
410 // volVars for the scv whose associated dof has been deflected
411 static const bool updateAllVolVars = getParamFromGroup<bool>(
412 this->asImp_().problem().paramGroup(), "Assembly.BoxVolVarsDependOnAllElementDofs", false
413 );
414
415 // create the element solution
416 const auto& gridDiscretization = Dumux::gridDiscretization(fvGeometry);
417 auto elemSol = elementSolution(element, curSol, gridDiscretization);
418
419 // create the vector storing the partial derivatives
420 ElementResidualVector partialDerivs(Dumux::Detail::LocalDofs::numLocalDofs(fvGeometry));
421
422 auto deflectionPolicy = Dumux::Detail::CVFE::makeVariablesDeflectionPolicy(
423 gridVariables.curGridVolVars(),
424 curElemVolVars,
425 fvGeometry,
426 updateAllVolVars
427 );
428
429 auto assembleDerivative = [&, this](const auto& localDof)
430 {
431 // dof index and corresponding actual pri vars
432 const auto dofIdx = localDof.dofIndex();
433 const auto localIdx = localDof.index();
434 deflectionPolicy.store(localDof);
435
436 // calculate derivatives w.r.t to the privars at the dof at hand
437 for (int pvIdx = 0; pvIdx < numEq; pvIdx++)
438 {
439 partialDerivs = 0.0;
440
441 auto evalResiduals = [&](PrimaryVariable priVar)
442 {
443 // update the volume variables and compute element residual
444 elemSol[localIdx][pvIdx] = priVar;
445 deflectionPolicy.update(elemSol, localDof, this->asImp_().problem());
446 if constexpr (solutionDependentFluxVarsCache)
447 {
448 elemFluxVarsCache.update(element, fvGeometry, curElemVolVars);
449 if constexpr (enableGridFluxVarsCache)
450 gridVariables.gridFluxVarsCache().updateElement(element, fvGeometry, curElemVolVars);
451 }
452 this->asImp_().maybeUpdateCouplingContext(localDof, elemSol, pvIdx);
453 return this->evalLocalResidual();
454 };
455
456 // derive the residuals numerically
457 static const NumericEpsilon<PrimaryVariable, numEq> eps_{this->asImp_().problem().paramGroup()};
458 static const int numDiffMethod = getParamFromGroup<int>(this->asImp_().problem().paramGroup(), "Assembly.NumericDifferenceMethod");
459 NumericDifferentiation::partialDerivative(evalResiduals, elemSol[localIdx][pvIdx], partialDerivs, origResiduals,
460 eps_(elemSol[localIdx][pvIdx], pvIdx), numDiffMethod);
461
462 // update the global stiffness matrix with the current partial derivatives
463 for (const auto& localDofJ : localDofs(fvGeometry))
464 {
465 // don't add derivatives for green dofs
466 if (!partialReassembler
467 || partialReassembler->dofColor(localDofJ.dofIndex()) != EntityColor::green)
468 {
469 for (int eqIdx = 0; eqIdx < numEq; eqIdx++)
470 {
471 // A[i][col][eqIdx][pvIdx] is the rate of change of
472 // the residual of equation 'eqIdx' at dof 'i'
473 // depending on the primary variable 'pvIdx' at dof
474 // 'col'.
475 A[localDofJ.dofIndex()][dofIdx][eqIdx][pvIdx] += partialDerivs[localDofJ.index()][eqIdx];
476 }
477 }
478 }
479
480 // restore the original state of the scv's volume variables
481 deflectionPolicy.restore(localDof);
482
483 // restore the original element solution
484 elemSol[localIdx][pvIdx] = curSol[localDof.dofIndex()][pvIdx];
485 this->asImp_().maybeUpdateCouplingContext(localDof, elemSol, pvIdx);
486 }
487 };
488
489 // calculation of the derivatives
490 for (const auto& localDof : localDofs(fvGeometry))
491 assembleDerivative(localDof);
492
493 // restore original state of the flux vars cache in case of global caching.
494 // In the case of local caching this is obsolete because the elemFluxVarsCache used here goes out of scope after this.
495 if constexpr (enableGridFluxVarsCache)
496 gridVariables.gridFluxVarsCache().updateElement(element, fvGeometry, curElemVolVars);
497
498 // evaluate additional derivatives that might arise from the coupling (no-op if not coupled)
499 this->asImp_().maybeEvalAdditionalDomainDerivatives(origResiduals, A, gridVariables);
500 }
501
507 template <class PartialReassembler = DefaultPartialReassembler>
508 void assembleJacobianExplicit_(JacobianMatrix& A, GridVariables& gridVariables,
509 const ElementResidualVector& origResiduals,
510 const PartialReassembler* partialReassembler = nullptr)
511 {
512 if (partialReassembler)
513 DUNE_THROW(Dune::NotImplemented, "partial reassembly for explicit time discretization");
514
515 // get some aliases for convenience
516 const auto& element = this->element();
517 const auto& fvGeometry = this->fvGeometry();
518 const auto& curSol = this->asImp_().curSol();
519 auto&& curElemVolVars = this->curElemVolVars();
520
521 // create the element solution
522 const auto& gridDiscretization = Dumux::gridDiscretization(fvGeometry);
523 auto elemSol = elementSolution(element, curSol, gridDiscretization);
524
525 // create the vector storing the partial derivatives
526 ElementResidualVector partialDerivs(Dumux::Detail::LocalDofs::numLocalDofs(fvGeometry));
527
528 // calculation of the derivatives
529 for (const auto& scv : scvs(fvGeometry))
530 {
531 // dof index and corresponding actual pri vars
532 const auto dofIdx = scv.dofIndex();
533 auto& curVolVars = this->getVolVarAccess(gridVariables.curGridVolVars(), curElemVolVars, scv);
534 const VolumeVariables origVolVars(curVolVars);
535
536 // calculate derivatives w.r.t to the privars at the dof at hand
537 for (int pvIdx = 0; pvIdx < numEq; pvIdx++)
538 {
539 partialDerivs = 0.0;
540
541 auto evalStorage = [&](PrimaryVariable priVar)
542 {
543 elemSol[scv.localDofIndex()][pvIdx] = priVar;
544 curVolVars.update(elemSol, this->asImp_().problem(), element, scv);
545 return this->evalStorage();
546 };
547
548 // derive the residuals numerically
549 static const NumericEpsilon<PrimaryVariable, numEq> eps_{this->asImp_().problem().paramGroup()};
550 static const int numDiffMethod = getParamFromGroup<int>(this->asImp_().problem().paramGroup(), "Assembly.NumericDifferenceMethod");
551 NumericDifferentiation::partialDerivative(evalStorage, elemSol[scv.localDofIndex()][pvIdx], partialDerivs, origResiduals,
552 eps_(elemSol[scv.localDofIndex()][pvIdx], pvIdx), numDiffMethod);
553
554 // update the global stiffness matrix with the current partial derivatives
555 for (int eqIdx = 0; eqIdx < numEq; eqIdx++)
556 {
557 // A[i][col][eqIdx][pvIdx] is the rate of change of
558 // the residual of equation 'eqIdx' at dof 'i'
559 // depending on the primary variable 'pvIdx' at dof
560 // 'col'.
561 A[dofIdx][dofIdx][eqIdx][pvIdx] += partialDerivs[scv.localDofIndex()][eqIdx];
562 }
563
564 // restore the original state of the scv's volume variables
565 curVolVars = origVolVars;
566
567 // restore the original element solution
568 elemSol[scv.localDofIndex()][pvIdx] = curSol[scv.dofIndex()][pvIdx];
569 }
570 }
571 }
572};
573
574} // end namespace Dumux
575
576#endif
A linear system assembler (residual and Jacobian) for general discretization schemes.
Definition assembly/assembler.hh:85
GetPropType< TypeTag, Properties::SolutionVector > SolutionVector
Definition assembly/assembler.hh:98
void assembleJacobian(JacobianMatrix &A, GridVariables &gridVariables, const ElementResidualVector &origResiduals, const PartialReassembler *partialReassembler=nullptr)
Definition experimental/assembly/cvfelocalassembler.hh:371
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition experimental/assembly/cvfelocalassembler.hh:367
typename ParentType::LocalResidual LocalResidual
Definition experimental/assembly/cvfelocalassembler.hh:366
A base class for all local CVFE assemblers.
Definition experimental/assembly/cvfelocalassembler.hh:58
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:209
void bindLocalViews()
Definition experimental/assembly/cvfelocalassembler.hh:77
void assembleResidual(ResidualVector &res)
Assemble the residual only.
Definition experimental/assembly/cvfelocalassembler.hh:233
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:88
typename ParentType::LocalResidual LocalResidual
Definition experimental/assembly/cvfelocalassembler.hh:73
typename LocalResidual::ElementResidualVector ElementResidualVector
Definition experimental/assembly/cvfelocalassembler.hh:74
void evalDirichletBoundaries(ApplyDirichletFunctionType applyDirichlet)
Evaluates Dirichlet boundaries.
Definition experimental/assembly/cvfelocalassembler.hh:282
void assembleCurrentResidual(ResidualVector &spatialRes, ResidualVector &temporalRes)
Assemble the residual only.
Definition experimental/assembly/cvfelocalassembler.hh:256
void maybeUpdateCouplingContext(Args &&...)
Update the coupling context for coupled models.
Definition experimental/assembly/cvfelocalassembler.hh:315
void maybeEvalAdditionalDomainDerivatives(Args &&...)
Update the additional domain derivatives for coupled models.
Definition experimental/assembly/cvfelocalassembler.hh:322
void enforceDirichletConstraints(const ApplyFunction &applyDirichlet)
Enforce Dirichlet constraints.
Definition experimental/assembly/cvfelocalassembler.hh:270
An assembler for Jacobian and residual contribution per element (CVFE methods).
Definition experimental/assembly/cvfelocalassembler.hh:335
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:56
detects which entries in the Jacobian have to be recomputed
Definition partialreassembler.hh:418
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.
Type traits for classes providing a grid discretization.
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:165
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
decltype(auto) gridDiscretization(const T &t, Args &&... args)
The grid discretization.
Definition griddiscretization.hh:65
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:46
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.