GaPFlow.models.BulkStress#

class GaPFlow.models.BulkStress(fc: Any, prop: dict, geo: dict, data: Any | None = None, gp: dict | None = None)#

Bases: GaussianProcessSurrogate

Bulk (gap-averaged) viscous stress model.

This model currently operates deterministically (no GP surrogate).

__init__(fc: Any, prop: dict, geo: dict, data: Any | None = None, gp: dict | None = None) None#

Constructor

Parameters:
  • fc (muGrid.GlobalFieldCollection) – Field collection that provides access to ‘pressure’, ‘topography’, etc.

  • prop (dict) – Physical fluid properties (e.g., shear viscosity).

  • geo (dict) – Geometry parameters.

  • data (Database or None, optional) – Training database if using GP surrogates.

  • gp (dict or None, optional) – GP configuration dictionary (if using GP surrogates).

Methods

__init__(fc, prop, geo[, data, gp])

Constructor

build_gp(params, X, yerr)

Default GP build method.

init_database(dim)

Triggers the first database initialization.

predict([predictor, compute_var, cooldown])

Perform GP prediction, optionally updating the model via active learning (only in predictor step of the predictor-corrector time integration scheme)

save_state()

Log current GP hyperparameters and diagnostics.

update()

Compute and store bulk viscous stress using viscous model.

Attributes

Xtest

Test inputs.

Xtrain

Training inputs (normalized).

Xtrain_target

Training inputs (normalized).

Yerr

Observations standard error.

Yscale

Observations scaling factor.

Yshift

Observations shift.

Ytrain

Training observations (only active dimensions, scaled).

cumtime_infer

Cumulative time spent for inference from the GP (making predictions)

cumtime_train

Cumulative time spent for training of the GP (fitting hyperparameters)

database

The database holding the training data for the GP surrogate model.

dp_dx

Return ∂p/∂x.

dp_dy

Return ∂p/∂y.

extra

Return constant extra field, which can be used as additional input.

has_multi_output

height

Return the gap height field.

height_and_slopes

Return the topography (height and gradients).

kernel_lengthscale

Kernel lengthscale(s).

kernel_variance

Kernel variance.

last_fit_train_size

Size of the training database at the last fit.

name

objective

Optimization objective (negative marginal log likelihood)

obs_stddev

Observation noise standard deviation.

pressure

Return the pressure field.

solution

Return full solution field.

stress

Return the bulk viscous stress field.

trusted

Return True if model predictive variance is below tolerance.

is_gp_model

active_dims

use_active_learning

fix_noise

rtol

atol

tol

max_steps

pause_steps

similarity_check

allowed_skips

perturb_target

pause_on_high_residual

params_init

noise

prop

geo

abstract property Xtest#

Test inputs.

property Xtrain: Array#

Training inputs (normalized).

property Xtrain_target: Array#

Training inputs (normalized).

abstract property Yerr#

Observations standard error.

abstract property Yscale#

Observations scaling factor.

abstract property Yshift#

Observations shift.

abstract property Ytrain#

Training observations (only active dimensions, scaled).

active_dims: list[int]#
allowed_skips: int#
atol: float#
build_gp(params: dict, X: Array, yerr: float | Array) GaussianProcess#

Default GP build method.

Parameters:
  • params (dict) – Dictionary with hyperparameters

  • X (jax.Array) – Input data.

  • yerr (jax.Array) – Observation noise (standard deviation).

Returns:

Single-output GP model.

Return type:

tinygp.GaussianProcess

property cumtime_infer#

Cumulative time spent for inference from the GP (making predictions)

property cumtime_train#

Cumulative time spent for training of the GP (fitting hyperparameters)

property database#

The database holding the training data for the GP surrogate model.

property dp_dx: ndarray[tuple[Any, ...], dtype[floating]]#

Return ∂p/∂x.

property dp_dy: ndarray[tuple[Any, ...], dtype[floating]]#

Return ∂p/∂y.

property extra#

Return constant extra field, which can be used as additional input.

fix_noise: bool#
geo: dict#
property has_multi_output#
property height#

Return the gap height field.

property height_and_slopes: Array#

Return the topography (height and gradients).

init_database(dim: int) None#

Triggers the first database initialization.

Parameters:

dim (int) – Dimension of the fluid problem.

is_gp_model: bool#
abstract property kernel_lengthscale#

Kernel lengthscale(s).

abstract property kernel_variance#

Kernel variance.

property last_fit_train_size#

Size of the training database at the last fit.

max_steps: int#
name: str = 'bulk'#
noise: Tuple[float, float]#
property objective#

Optimization objective (negative marginal log likelihood)

abstract property obs_stddev#

Observation noise standard deviation.

params_init: dict#
pause_on_high_residual: bool#
pause_steps: int#
perturb_target: bool#
predict(predictor: bool = True, compute_var: bool = True, cooldown: bool = False) Tuple[Array, Array]#

Perform GP prediction, optionally updating the model via active learning (only in predictor step of the predictor-corrector time integration scheme)

Parameters:
  • predictor (bool, optional) – Whether to perform active learning updates (only in predictor step, default is True).

  • compute_var (bool, optional) – If true (default), preditive variance is re-computed.

  • cooldown (bool, optional) – If true, active learning is blocked to let the system cool down (default is False).

Returns:

  • m (jax.Array) – Predictive mean.

  • v (jax.Array) – Predictive variance.

property pressure: ndarray[tuple[Any, ...], dtype[floating]]#

Return the pressure field.

prop: dict#
rtol: float#
save_state() None#

Log current GP hyperparameters and diagnostics.

similarity_check: bool#
property solution#

Return full solution field.

property stress: ndarray[tuple[Any, ...], dtype[floating]]#

Return the bulk viscous stress field.

tol: str#
property trusted: bool#

Return True if model predictive variance is below tolerance.

update() None#

Compute and store bulk viscous stress using viscous model.

use_active_learning: bool#