KASKADE 7 development version
Loading...
Searching...
No Matches

Classes and functions for constructing matrix representations of differential operators. More...

Classes

class  Kaskade::CachingBoundaryDetector< GridView >
class  Kaskade::ForwardingBoundaryDetector
class  Kaskade::TrivialBoundaryDetector
class  Kaskade::VariationalFunctionalAssembler< F, SparseIndex, BoundaryDetector, QuadRule >
 A class for assembling Galerkin representation matrices and right hand sides for variational functionals depending on multiple variables. More...
struct  Kaskade::FluxDensityConcept
 Flux density concept. More...
class  Kaskade::RadiativeFluxDensity< Emissivity >
 Radiative flux density. More...
class  Kaskade::HomogeneousRadiativeFluxDensity
 Homogeneous radiative flux density. More...

Enumerations

enum  { Kaskade::Assembler::VALUE =0x1 , Kaskade::Assembler::RHS =0x2 , Kaskade::Assembler::MATRIX =0x4 , Kaskade::Assembler::EVERYTHING =0x7 }
 What to assemble. More...

Functions

template<class Space>
NumaBCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Kaskade::fluxCoupling (Space const &space, double distance, double gamma)
 Computes a Robin-type coupling matrix for nonmatching interfaces in short distance.
template<class Space, class Density, int m = 1, class Scalar = double>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, m, m > > Kaskade::massMatrix (Space const &space, Density const &rho)
 Creates a mass matrix for the given FE space.
template<class Space, class Conductivity, int m = 1, class Scalar = double>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, m, m > > Kaskade::stiffnessMatrix (Space const &space, Conductivity const &kappa)
 Creates a stiffness matrix for the given FE space.
template<class Space, class FluxDensity>
std::pair< NumaBCRSMatrix< Dune::FieldMatrix< double, 1, 1 > >, Dune::BlockVector< Dune::FieldVector< double, 1 > > > Kaskade::radiativeTransfer (Space const &space, FluxDensity const &fluxDensity, int n)
 Assembles a Galerkin matrix and a right hand side contribution for direction-dependent fluxes, as they occur in radiative transfer.

Detailed Description

Classes and functions for constructing matrix representations of differential operators.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

What to assemble.

Binary flags to be or'ed for supplying assembly requests. An integer bitfield is supplied when calling the assemble() method of any VariationalFunctionalAssembler, to tell the assembler which parts (right hand side, matrix, functional value) are to be computed. This information is passed on to the DomainCache and BoundaryCache objects of the VariationalFunctional, such that they can restrict the computation to actually required values.

Enumerator
VALUE 
RHS 
MATRIX 
EVERYTHING 

Definition at line 29 of file assemblerFlags.hh.

Function Documentation

◆ fluxCoupling()

template<class Space>
NumaBCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Kaskade::fluxCoupling ( Space const & space,
double distance,
double gamma )

Computes a Robin-type coupling matrix for nonmatching interfaces in short distance.

If the domain \( \Omega \) consists of disjoint parts which touch at some interface region, but the boundary meshes of the parts do not match at the interface, the continuity of the solution across the interface can be (approximately) enforced by penalizing the jump. This is equivalent to prescribing a (large) flux acting against the jump. In thermal simulations, this would be a large heat flux from the warm side of the interface to the cold side. Making the flux proportional to the jump results in a Robin-type coupling condition. The influx to part 1 equals the outflux from part 2, and both are proportional to the jump:

\[ n^T_1 \kappa_1 \nabla u_1 = - n^T_2 \kappa_2 \nabla u_2 = \gamma (u_2-u_1)] \]

While not enforcing strict continuity \( u_1 = u_2 \) across this interface, this approach models quite realistically the thermal contact of two bodies in contact, where \( \gamma^{-1} \) is the thermal resistance of the contact interface.

This approach is closely related to penalty approaches for enforcing continuity. Make sure that the penalty \( \gamma \) satisfies \( \gamma \le \mathcal{O}(h^{-1}) \) in order to avoid locking on nonmatching grids (see Gustafsson & Stenberg 2025, arXiv:2505.21776).

In a finite element discretization, this coupling condition leads to a symmetric positive semidefinite boundary matrix \( B \) that needs to be added to the stiffness matrix. It has, however, a different sparsity pattern, as points with a large (or infinite) mesh distance are coupled.

Template Parameters
Spacethe finite element space type used for discretization of, e.g., temperature
Parameters
spacethe finite element space used for discretization
distancea threshold for normal distance within which the boundaries are assumed to be in direct contact. Boundary parts with a normal distance exceeding this threshold are ignored.
gammathe contact heat transfer coefficient, which can also be interpreted as contact heat conductivity times the contact gap width. Has to be nonnegative.
Returns
the boundary coupling matrix \( B \)

The implementation is provided in fluxCoupling.hpp. Include that file if you need the implementation for compiling, otherwise use this file for the forward declaration.

Todo
make gamma inhomogeneous?

◆ massMatrix()

template<class Space, class Density, int m = 1, class Scalar = double>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, m, m > > Kaskade::massMatrix ( Space const & space,
Density const & rho )

Creates a mass matrix for the given FE space.

Template Parameters
Spacea FEFunctionSpace instance
mthe number of components of the variable, usually m=1 for scalar problems
Scalarthe scalar arithmetic type to use
Densityeither a scalar value or a function view type
Parameters
spacethe finite element space to use
rhothe density (a scalar or a function view object)
Warning
explicit instantiations for common template parameters are provided in the Kaskade 7 library. For unusual template parameters, include fem/matrices.hpp, where the function is actually implemented. This incurs higher compile times, though.

◆ radiativeTransfer()

template<class Space, class FluxDensity>
std::pair< NumaBCRSMatrix< Dune::FieldMatrix< double, 1, 1 > >, Dune::BlockVector< Dune::FieldVector< double, 1 > > > Kaskade::radiativeTransfer ( Space const & space,
FluxDensity const & fluxDensity,
int n )

Assembles a Galerkin matrix and a right hand side contribution for direction-dependent fluxes, as they occur in radiative transfer.

For a parabolic equation such as the heat equation

\[ \rho c \dot T = \mathrm{div}(\kappa\nabla T) \quad \textsf{in} \; \Omega \]

with Neumann boundary condition

\[ n^T \kappa \nabla T = f \quad \textsf{on}\; \partial \Omega, \]

the dependence of the influx \( f \) on \( T \) may be nonlocal and be given as an integral over the visible outer hemisphere. This occurs, e.g., in radiative transfer if the ambient background temperature is heterogeneous or if the domain \( \Omega \) is nonconvex, such that the boundary \( \partial\Omega \) is partially visible from other parts of the boundary.

Here, we assume that the flux \( f = f_c + B T|_{\partial\Omega}\) depends linearly on \( T \), and can for each boundary point \( x \) be expressed as a surface integral over the visible hemisphere \( S = \{ s\in \R^d \mid \|s\|=1 \wedge s^T n > 0 \} \):

\[ f(x) = \frac{1}{|S|}\int_S (1-\chi) f_c(s) + \chi n^T s (f_x(x,y) T(x) + f_y(x,y) T(y)) \,ds. \]

\( \chi \) is the characteristic function of directions in which an opposite surface point \( y\in\partial\Omega \) is visible, \( f_c \) is the environmental influx, and \( f_x, f_y \) are the linear coefficients for outflux and influx possibly depending on the line \( y - x \).

If \( T \) is discretized by finite elements, the method of lines turns the parabolic equation into a large scale ODE \( M \dot T = A T + B T + b \), where \( B \) is the linear part of the flux, and \( b \) is the constant part of the flux. This function computes \( B \) and \( b \) by integrating over \( \partial \Omega \) and \( S \), for given \( f_c, f_x, f_y \).

As the linear part of the flux can be non-local, the sparsity pattern of \( B \) is in general not a subset of that of \( A \).

Note that \( B \) is symmetric - the reason is that the hemisphere integration surface area of a surface patch around \( y \) is proportional to the cosine of the angle between the normal at \( y \) and the view direction \( y-x \). (This is more apparent if the computation was phrased in terms of a double integral over the surface and so-called view factors, but that is less suited for the current purpose.)

Template Parameters
Spacea finite element space used for temperature representation based on a grid of dimension d.
FluxDensitya class modeling the FluxDensityConcept, providing \( f_c, f_x, f_y \)
Parameters
[in]spacea finite element space for representing temperature fields \( \delta T \)
over \( \Omega \)
[in]fluxDensityan object computing the flux coefficients \( f_c, f_x, f_y \)
[in]nthe number of quadrature points to use for integrating over the hemisphere. This is merely a hint, and the actual computation may deviate slightly from that value.
Returns
the pair \( (B , b) \)

◆ stiffnessMatrix()

template<class Space, class Conductivity, int m = 1, class Scalar = double>
NumaBCRSMatrix< Dune::FieldMatrix< Scalar, m, m > > Kaskade::stiffnessMatrix ( Space const & space,
Conductivity const & kappa )

Creates a stiffness matrix for the given FE space.

Template Parameters
Spacea FEFunctionSpace instance
mthe number of components of the variable, usually m=1 for scalar problems
Scalarthe scalar arithmetic type to use
Conductivityeither a symmetric dim x dim matrix or a function view type
Parameters
spacethe finite element space to use
rhothe density (a scalar or a function view object)
Warning
explicit instantiations for common template parameters are provided in the Kaskade 7 library. For unusual template parameters, include fem/matrices.hpp, where the function is actually implemented. This incurs higher compile times, though.

Referenced by Kaskade::Parameter< Grid, nComponents >::MultigridSolver().