Stochastic Coefficients

Coefficients are assumed to be represented by a Karhunen-Loeve expansion (KLE) that have the following general structure and API.

API

ExtendableASGFEM.AbstractStochasticCoefficientType
abstract type AbstractStochasticCoefficient{T}

A stochastic coefficient is assumed to have the Karhunen-Loeve expansion form

$a(y,x) = a_0(x) + \sum_{m=1}^\infty y_m a_m(x)$ with (centered independent) random variables $y_m$ and basis functions $a_m(x)$ that need to be specified (together with their gradients) and expectation value $a_0$ (in general they steam from a spectral analysis of the covariance operator of $a$).

source
ExtendableASGFEM.expa_PCE_mopMethod
expa_PCE_mop(
    TB::TensorizedBasis{T, ONBType},
    SC::AbstractStochasticCoefficient{T};
    N_truncate,
    factor
) -> Tuple{ExtendableASGFEM.var"#closure#52"{_A, TensorizedBasis{T, ONBType, MIType}, ExtendableASGFEM.var"#lambda_mu#51"{T1, N_truncate, factor, SC, mu_fac_storage, multi_indices, eval_amu_storage, eval_am}, Int64} where {_A, T, ONBType, MIType, T1, N_truncate, factor, SC, mu_fac_storage, multi_indices, eval_amu_storage, eval_am}, ExtendableASGFEM.var"#lambda_mu#51"{_A, Int64, Int64, <:AbstractStochasticCoefficient{T}} where {_A, T}}

prepares two functions

lambda_mu!(result, input, qpinfo)
expa!(result, input, qpinfo)

that calculate λ_μ, which are orthogonal decomposition coefficient functions of exp(a) ≈ ∑ λ_μ H_μ w.r.t. to the multi-indices μ and their associated orthogonal basis functions H_μ in TB, as well as (an approximation based on this decomposition of) exp(a).

source
ExtendableASGFEM.get_a!Method
get_a!(
    SC::AbstractStochasticCoefficient{T};
    factor
) -> ExtendableASGFEM.var"#closure#36"{Int64, <:AbstractStochasticCoefficient{T}} where T

prepares a function of interface

a!(result, x, y)

that evaluates the coefficient (times a factor) at space coordinates x and random variables y into result (a vector of length 1).

source
ExtendableASGFEM.get_am_xMethod
get_am_x(
    m,
    SC::AbstractStochasticCoefficient{T}
) -> ExtendableASGFEM.var"#closure#45"{_A, <:AbstractStochasticCoefficient{T}} where {_A, T}

prepares a function of interface

get_am_x!(result, input, qpinfo)

that evaluates a_m(qpinfo.x) input (used to define ExtendableFEM operator kernels).

source
ExtendableASGFEM.get_expa!Method
get_expa!(
    SC::AbstractStochasticCoefficient;
    factor
) -> ExtendableASGFEM.var"#closure#40"{Int64, ExtendableASGFEM.var"#closure#36"{Int64, var"#s182", _A}} where {T, var"#s182"<:AbstractStochasticCoefficient{T}, _A}

prepares a function of interface

get_expa!(result, x, y)

that evaluates the exponential of the coefficient (times a factor) at space coordinates x and random variables y into result (a vector of length 1).

source
ExtendableASGFEM.get_grada!Method
get_grada!(
    SC::AbstractStochasticCoefficient{T};
    factor
) -> ExtendableASGFEM.var"#closure#38"{Int64, <:AbstractStochasticCoefficient{T}} where T

prepares a function of interface

get_grada!(result, x, y)

that evaluates the spatial gradient of the coefficient (times a factor) at space coordinates x and random variables y into result (a vector of same length as x).

source
ExtendableASGFEM.get_grada_x_sigmaMethod
get_grada_x_sigma(
    dim,
    SC::AbstractStochasticCoefficient{T},
    y
) -> ExtendableASGFEM.var"#closure#47"{_A, <:AbstractStochasticCoefficient{T}} where {_A, T}

prepares a function of interface

get_grada_x_sigma!(result, input, qpinfo)

that evaluates ∇a(qpinfo.x) ⋅ σ(qpinfo.x) (used to define ExtendableFEM operator kernels and σ is expected to be some vector-valued quantity of same length).

source
ExtendableASGFEM.get_gradam_x_uMethod
get_gradam_x_u(
    m,
    SC::AbstractStochasticCoefficient{T}
) -> ExtendableASGFEM.var"#closure#44"{_A, <:AbstractStochasticCoefficient{T}} where {_A, T}

prepares a function of interface

get_gradam_x_u!(result, input, qpinfo)

that evaluates ∇a_m(qpinfo.x) u(qpinfo.x) (used to define ExtendableFEM operator kernels and input is expected to be some scalar quantity).

source
ExtendableASGFEM.plot_amMethod
plot_am(
    xgrid::ExtendableGrids.ExtendableGrid,
    m,
    SC::AbstractStochasticCoefficient;
    Plotter,
    kwargs...
) -> Any

returns a scalarplot of the m-th coefficient functiona a_m interpolated on the given grid. The Plotter backend can be changed with the Plotter argument (e.g. GLMakie, CairoMakie, PyPlot, Plots).

source

StochasticCoefficientCosinus

An example of a particular KLE with cosinus type basis function is given by the following subtype.

ExtendableASGFEM.StochasticCoefficientCosinusMethod
StochasticCoefficientCosinus(
;
    T,
    τ,
    start,
    decay,
    mean,
    maxm
) -> StochasticCoefficientCosinus{Float64}

constructor for StochasticCoefficientCosinus of type T (default = Float64), where decay (default = 2) steers the decay of the coefficient basis functions (the larger the faster), mean (default = 0) is the mean value of the coefficient, maxm (default = 100) is the maximal number of stochastic random variables, and τ (default = 1) is a uniform scaling factors

source