GaPFlow.models.BulkStress#
- class GaPFlow.models.BulkStress(fc: Any, prop: dict, geo: dict, data: Any | None = None, gp: dict | None = None)#
Bases:
GaussianProcessSurrogateBulk (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)
Log current GP hyperparameters and diagnostics.
update()Compute and store bulk viscous stress using viscous model.
Attributes
Test inputs.
Training inputs (normalized).
Training inputs (normalized).
Observations standard error.
Observations scaling factor.
Observations shift.
Training observations (only active dimensions, scaled).
Cumulative time spent for inference from the GP (making predictions)
Cumulative time spent for training of the GP (fitting hyperparameters)
The database holding the training data for the GP surrogate model.
Return ∂p/∂x.
Return ∂p/∂y.
Return constant extra field, which can be used as additional input.
Return the gap height field.
Return the topography (height and gradients).
Kernel lengthscale(s).
Kernel variance.
Size of the training database at the last fit.
Optimization objective (negative marginal log likelihood)
Observation noise standard deviation.
Return the pressure field.
Return full solution field.
Return the bulk viscous stress field.
Return True if model predictive variance is below tolerance.
- 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#