GaPFlow.models.Pressure#
- class GaPFlow.models.Pressure(fc: Any, prop: dict, geo: dict, data: Any | None = None, gp: dict | None = None)#
Bases:
GaussianProcessSurrogatePressure model.
Supports deterministic pressure via lookup equation of state or a 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()Run first training and inference.
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([predictor, compute_var, cooldown])Update pressure: compute deterministic stresses and, if enabled, perform GP prediction and place predicted mean and variance into the appropriate field entries.
Attributes
Test inputs for pressure GP (normalized).
Training inputs (normalized).
Training inputs (normalized).
Observation noise (normalized) for pressure.
Output scale for pressure (scalar-like jax.Array).
Training outputs for pressure GP (not normalized).
Training outputs for pressure GP (normalized).
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 constant extra field, which can be used as additional input.
Return the gap height field.
Return the topography (height and gradients).
Kernel lengthscale for pressure GP.
Kernel variance for pressure GP.
Size of the training database at the last fit.
Optimization objective (negative marginal log likelihood)
Observation standard deviation for pressure GP.
Pressure field.
Return full solution field.
Return True if model predictive variance is below tolerance.
Effective sound speed computed from the GP-based eos (if available) or from the analytic eos_sound_velocity.
Variance of the pressure field.
- property Xtest: Array#
Test inputs for pressure GP (normalized).
- property Xtrain: Array#
Training inputs (normalized).
- property Xtrain_target: Array#
Training inputs (normalized).
- property Yerr: float#
Observation noise (normalized) for pressure.
- property Yscale: Array#
Output scale for pressure (scalar-like jax.Array).
- property Yshift: Array#
Training outputs for pressure GP (not normalized).
- property Ytrain: Array#
Training outputs for pressure GP (normalized).
- 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 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() None#
Run first training and inference.
- init_database(dim: int) None#
Triggers the first database initialization.
- Parameters:
dim (int) – Dimension of the fluid problem.
- is_gp_model: bool#
- property kernel_lengthscale: Array#
Kernel lengthscale for pressure GP.
- property kernel_variance: Array#
Kernel variance for pressure GP.
- property last_fit_train_size#
Size of the training database at the last fit.
- max_steps: int#
- name: str = 'zz'#
- noise: Tuple[float, float]#
- property objective#
Optimization objective (negative marginal log likelihood)
- property obs_stddev: Array#
Observation standard deviation for pressure GP.
- 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]]#
Pressure field.
- prop: dict#
- rtol: float#
- save_state() None#
Log current GP hyperparameters and diagnostics.
- similarity_check: bool#
- property solution#
Return full solution field.
- tol: str#
- property trusted: bool#
Return True if model predictive variance is below tolerance.
- update(predictor: bool = False, compute_var: bool = False, cooldown: bool = False) None#
Update pressure: compute deterministic stresses and, if enabled, perform GP prediction and place predicted mean and variance into the appropriate field entries.
- Parameters:
predictor (bool, optional) – Whether this update is part of the predictor stage.
compute_var (bool, optional) – Flag for re-computing the variance (the default is False which uses the stored variance from previous steps).
cooldown (bool, optional) – If true, active learning is blocked to let the system cool down (default is False).
- use_active_learning: bool#
- property v_sound: ndarray[tuple[Any, ...], dtype[floating]] | Array#
Effective sound speed computed from the GP-based eos (if available) or from the analytic eos_sound_velocity.
- Returns:
Sound speed (may be a JAX array/scalar).
- Return type:
jax.Array or scalar-like
- property variance: ndarray[tuple[Any, ...], dtype[floating]]#
Variance of the pressure field.