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