7. Gaussian process regression and active learning#
Now we’ll look at the same problem as in the previous tutorial, but replace the hardcoded constitutive laws with purely data-driven ones. In multiscale simulations, this data comes from molecular dynamics (MD) simulations. For illustrative purposes, we sample the training data from the same hard-coded constituive laws as before and pretend it comes from an MD run. Thus, we generate a Mock of an actual MD simulation. Real MD data is noisy, so we’ll add some random noise to our mock-up data as well. As in the previous example, we start with the YAML input file:
journal_gp_input = """
options:
output: data/journal_gp
write_freq: 100
use_tstamp: True
grid:
dx: 1.e-5
dy: 1.
Nx: 100
Ny: 1
xE: ['D', 'N', 'N']
xW: ['D', 'N', 'N']
yS: ['P', 'P', 'P']
yN: ['P', 'P', 'P']
xE_D: 877.7007
xW_D: 877.7007
geometry:
type: journal
CR: 1.e-2
eps: 0.7
U: 0.1
V: 0.
numerics:
CFL: 0.25
adaptive: 1
tol: 1e-9
dt: 1e-10
max_it: 2_500
properties:
shear: 0.0794
bulk: 0.
EOS: DH
P0: 101325
rho0: 877.7007
T0: 323.15
C1: 3.5e10
C2: 1.23
gp:
press:
fix_noise: True
atol: 1.
rtol: 0.1
obs_stddev: 100.
max_steps: 5
shear:
fix_noise: True
atol: 1.
rtol: 0.1
obs_stddev: 1.
max_steps: 5
db:
dtool: True
init_size: 5
init_method: lhc
init_width: 1.e-6
"""
The first part is identical, but we recognize two new sections, gp and db, which control the settings for the Gaussian process regression and the underlying training database, respectively. We start by loading the problem as usual:
from GaPFlow import Problem
myProblem = Problem.from_string(journal_gp_input)
*************************************************************
* PROBLEM SETUP *
*************************************************************
- options:
- output : data/journal_gp
- write_freq : 100
- use_tstamp : True
- silent : False
- grid:
- Nx : 100
- dx : 1e-05
- Lx : 0.001
- Ny : 1
- dy : 1.0
- Ly : 1.0
- dim : 1
- bc_xE_P : [False, False, False]
- bc_xE_D : [True, False, False]
- bc_xE_N : [False, True, True]
- bc_xW_P : [False, False, False]
- bc_xW_D : [True, False, False]
- bc_xW_N : [False, True, True]
- bc_xE_D_val : 877.7007
- bc_xW_D_val : 877.7007
- bc_yS_P : [True, True, True]
- bc_yS_D : [False, False, False]
- bc_yS_N : [False, False, False]
- bc_yN_P : [True, True, True]
- bc_yN_D : [False, False, False]
- bc_yN_N : [False, False, False]
- geometry:
- U : 0.1
- V : 0.0
- type : journal
- flip : False
- CR : 0.01
- eps : 0.7
- numerics:
- tol : 1e-09
- max_it : 2500
- dt : 1e-10
- adaptive : True
- CFL : 0.25
- MC_order : 1
- properties:
- shear : 0.0794
- bulk : 0.0
- EOS : DH
- rho0 : 877.7007
- P0 : 101325.0
- C1 : 35000000000.0
- C2 : 1.23
- elastic:
- enabled : False
- gp:
- press_gp : True
- shear_gp : True
- press:
- tol : delta
- atol : 1.0
- rtol : 0.1
- obs_stddev : 100.0
- fix_noise : True
- max_steps : 5
- pause_steps : 100
- active_learning : True
- similarity_check : True
- allowed_skips : 0
- perturb_target : False
- pause_on_high_residual : False
- active_dims : [0, 3]
- shear:
- tol : delta
- atol : 1.0
- rtol : 0.1
- obs_stddev : 1.0
- fix_noise : True
- max_steps : 5
- pause_steps : 100
- active_learning : True
- similarity_check : True
- allowed_skips : 0
- perturb_target : False
- pause_on_high_residual : False
- active_dims_x : [0, 1, 3]
- active_dims_y : [0, 2, 3]
- db:
- dtool_path : None
- init_size : 5
- init_method : lhc
- init_width : 1e-06
- init_seed : 0
- normalizer_X : minmax
- normalizer_Y : standard
- md:
*************************************************************
* PROBLEM SETUP COMPLETED *
*************************************************************
Writing output into: data/2026-05-14_141803_journal_gp
Before we unpack what we see here, a word of caution regarding wording and notation.
There are two types of models, which can be replaced by a GP: the pressure/normal stress and the viscous shear stress. Here, we sometimes use the terms pressure and normal stress synonymously, although they are strictly speaking different things. For instance, the normal stress component is given by \(\sigma_{zz} = -p(\rho) + \tau_{zz}\), but we assume that viscous contributions to the normal stress (here: \(\tau_{zz}\)) are small. This is not a bad assumption as we have seen in Tutorial 2.
In this example, where we make use of hard-coded constitutive laws, we would be able to include both effects separately, but with actual MD data this is not the case. Thus, in this example, what we call pressure is the actual thermodynamic pressure, and we explicitly set viscous normal stresses to zero. In contrast, with actual MD data, what we call pressure is the normal stress \(\sigma_{zz}\), but we assume that it is the same in the other two directions (thus we handle it numerically as it was the pressure). Similarly, we ignore all viscous shear stress components except \(\tau_{xz}\) and \(\tau_{yz}\), whenever we use GPs, since these are the only ones we measure in an MD run.
Upon loading the problem, the sanitized configuration of the GP settings look like this:
- gp:
- press_gp : True
- shear_gp : True
- press:
- atol : 1.0
- rtol : 0.1
- obs_stddev : 100.0
- fix_noise : True
- max_steps : 5
- pause_steps : 100
- active_learning : True
- active_dims : [0, 3]
- shear:
- atol : 1.0
- rtol : 0.1
- obs_stddev : 1.0
- fix_noise : True
- max_steps : 5
- pause_steps : 100
- active_learning : True
- active_dims_x : [0, 1, 3]
- active_dims_y : [0, 2, 3]
The first two entries press_gp and shear_gp indicate that both GP models are active.
print('Pressure GP: ', myProblem.pressure.is_gp_model)
print('Wall shear stress (xz) GP: ', myProblem.wall_stress_xz.is_gp_model)
print('Wall shear stress (yz) GP: ', myProblem.wall_stress_yz.is_gp_model)
print('Bulk viscous stress GP: ', myProblem.bulk_stress.is_gp_model)
Pressure GP: True
Wall shear stress (xz) GP: True
Wall shear stress (yz) GP: False
Bulk viscous stress GP: False
Since we are looking at a one-dimensional problem, the wall shear stress in \(y\) direction is irrelevant and therefore not replaced with a surrogate.
The gap-averaged viscous stress components (bulk_stress) are never replaced by a GP model, and are set to zero in this example (see remark above).
GP models are connected to a database, which is configured with the following settings:
- db:
- dtool_path : None
- init_size : 5
- init_method : lhc
- init_width : 1e-06
- init_seed : 0
Both models read from and write to the same database, which is initially empty:
# Both models are connected to the same database...
print(myProblem.pressure.database)
print(myProblem.wall_stress_xz.database)
# ...but the database is initially empty
print(myProblem.pressure.database.size)
print(myProblem.pressure.database.Xtrain)
print(myProblem.pressure.database.Ytrain)
print(myProblem.pressure.database.training_path)
<GaPFlow.db.Database object at 0x7f5030a1c8c0>
<GaPFlow.db.Database object at 0x7f5030a1c8c0>
0
[]
[]
data/2026-05-14_141803_journal_gp/train
The database configurations specifies that 5 (init_size) datapoints should be initialized via Latin hypercube sampling (lhc).
The bounds for the LHC sampling are determined automatically from the initial conditions, but we can modify the bounds for the density
individually with the init_width argument, which gives the half width of the density interval relative to the initial condition (the default is \(\pm1\%\)).
Here, it is quite small due to the nearly incompressible fluid. Before we can run a simulation, we have to initialize the database.
Usually, this is done automatically when we call GaPFlow.problem.Problem.run(). Here, since we want to run the simulation ‘manually’, we have to call GaPFlow.problem.Problem._pre_run() first:
myProblem._pre_run()
Database contains less than 5 MD runs.
Generate new training data in data/2026-05-14_141803_journal_gp/train
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +2.479e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +5.433e-07 (h)
Target input 5: -2.371e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141804_mock-001/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +2.479e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +5.433e-07 (+0.0%) (h)
Measured input 5: -2.371e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.128e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -3.369e+04 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +1.226e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: -8.889e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: -8.889e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: +4.458e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +3.881e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +1.281e-06 (h)
Target input 5: +6.722e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141805_mock-002/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +3.881e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +1.281e-06 (+0.0%) (h)
Measured input 5: +6.722e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: -4.310e+04 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -8.351e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +3.445e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: -1.998e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: -1.998e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -4.051e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +4.503e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +2.679e-06 (h)
Target input 5: -1.527e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141805_mock-003/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +4.503e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +2.679e-06 (+0.0%) (h)
Measured input 5: -1.527e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +2.354e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -2.732e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -8.347e+00 ±0.000e+00 (τ(xx|top))
Measured output 9: +1.415e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: +1.415e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -3.198e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +5.753e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +7.559e-07 (h)
Target input 5: +4.629e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141806_mock-004/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +5.753e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +7.559e-07 (+0.0%) (h)
Measured input 5: +4.629e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.564e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -7.081e+02 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +1.235e+02 ±0.000e+00 (τ(xx|top))
Measured output 9: -6.449e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: -6.449e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -2.030e+04 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +5.189e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +1.349e-06 (h)
Target input 5: -6.831e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141806_mock-005/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +5.189e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +1.349e-06 (+0.0%) (h)
Measured input 5: -6.831e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +3.938e+04 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -2.667e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -8.481e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: +3.965e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: +3.965e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -9.111e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 0
# Reason : DB
# Database size: 5
# Objective : -1.5495
# Hyperparam :
# - Log scale : 9.25225 20.16928
# - Log amp : 18.15321
# - Log noise : -13.72819
#--------------------------------------------------
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 0
# Reason : DB
# Database size: 5
# Objective : 10.04
# Hyperparam :
# - Log scale : 11.59785 -0.31638 10.44878
# - Log amp : 0.66825
# - Log noise : -18.83422
#--------------------------------------------------
The output tells us that five Mock MD simulations “ran” with the inputs as specified. Let’s check the size of the database again.
print('Database size: ', myProblem.pressure.database.size)
print('Database features: ', myProblem.pressure.database.num_features)
print('X (shape)', myProblem.pressure.database.Xtrain.shape)
print('Y (shape)', myProblem.pressure.database.Ytrain.shape)
print('Y error (shape)', myProblem.pressure.database.Ytrain_err.shape)
Database size: 5
Database features: 7
X (shape) (5, 7)
Y (shape) (5, 13)
Y error (shape) (5, 13)
We see that the database has been filled with the requested five datapoints. Each point is determined by seven features:
the density \(\rho\)
the flux in x direction \(j_x\)
the flux in y direction \(j_y\)
the gap height \(h\)
the x gradient of the gap \(\partial h/\partial x\)
the y gradient of the gap \(\partial h/\partial y\)
an extra feature (by default zero)
We can append an arbitrary number of extra features. By default there is just one but it is not used. You can check the example on wall slip to see how the extra arguments can be used in a simulation.
We also see, that there are in total 13 outputs (or observations) stored within the database. The outputs are stored in the following order:
\(p\)
\(\textcolor{grey}{\tau_{xx}^\mathrm{bot}}\)
\(\textcolor{grey}{\tau_{yy}^\mathrm{bot}}\)
\(\textcolor{grey}{\tau_{zz}^\mathrm{bot}}\)
\(\tau_{yz}^\mathrm{bot}\)
\(\tau_{xz}^\mathrm{bot}\)
\(\textcolor{grey}{\tau_{xy}^\mathrm{bot}}\)
\(\textcolor{grey}{\tau_{xx}^\mathrm{top}}\)
\(\textcolor{grey}{\tau_{yy}^\mathrm{top}}\)
\(\textcolor{grey}{\tau_{zz}^\mathrm{top}}\)
\(\tau_{yz}^\mathrm{top}\)
\(\tau_{xz}^\mathrm{top}\)
\(\textcolor{grey}{\tau_{xy}^\mathrm{top}}\)
As mentioned above, most of the slots (in gray) are not used, because these stress components are not measured and thus zero.
The individual training data of a single “MD” run is also stored in a local dtool dataset:
import os
for f in sorted(os.listdir(myProblem.pressure.database.training_path)):
print(os.path.abspath(f))
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/20260514_141804_mock-001
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/20260514_141805_mock-002
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/20260514_141805_mock-003
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/20260514_141806_mock-004
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/20260514_141806_mock-005
The training data is stored as metadata in README.yml, which can be loaded directly into a list of dicts:
readme_list = myProblem.pressure.database.get_readme_list_local()
readme_list[0]['Y']
Loading 5 local datasets in 'data/2026-05-14_141803_journal_gp/train'.
- 66574c33-a7df-45a1-95f3-498284d22088 (20260514_141806_mock-005)
- 9d004c26-ddfc-401c-a39b-e4b350f59997 (20260514_141804_mock-001)
- 47be310c-b6ea-4406-9a18-48893480ee12 (20260514_141805_mock-002)
- 261897e4-4a38-4326-94a3-d2f7126b3514 (20260514_141806_mock-004)
- 385e172c-ddfc-4626-89a4-ae3e0602c7cb (20260514_141805_mock-003)
[39382.8975291139, -0.619900249931894, -0.619900249931894, -0.619900249931894, -0.619900249931894, -2667.113224722357, -0.619900249931894, -84.81206361689584, 39.64795321854407, 39.64795321854407, -1.8387190599359027, -9111.223401489848, -1.8387190599359027]
The pre_run() initialization also runs a first hyperparameter fit of the GP models.
The output data used in the pressure and shear stress models is fixed, but we can change which features will be used via the active_dims settings.
The defaults are density and gap height (active_dims: [0, 3]) for pressure, and density, gap height, and flux for shear stress (e.g. active_dims_x: [0, 1, 3]).
The models are now ready to make a first prediction:
press_predict = myProblem.pressure.predict(predictor=False)
shear_predict = myProblem.wall_stress_xz.predict(predictor=False)
import numpy as np
import matplotlib.pyplot as plt
from GaPFlow.viz.plotting import _plot_sol_from_field_1d
_sx, _sy = plt.rcParams['figure.figsize']
fig, ax = plt.subplots(2, 3, figsize=(2*_sx, 2*_sy))
_plot_sol_from_field_1d(myProblem.q,
press_predict[0],
shear_predict[0][0],
shear_predict[0][1],
press_predict[1],
shear_predict[1],
myProblem.pressure.variance_tol,
myProblem.wall_stress_xz.variance_tol,
ax=ax)
The uncertainty tolerance is controlled via the atol and rtol parameters.
Here, we see that the pressure prediction is very good (which is expected, as pressure only depends on density and the density is constant in the beginning).
However, the shear stress prediction exceeds the uncertainty tolerance, such that active learning is necessary to augment the database and thereby the fit. Let’s run the simulations for a few steps and see how the predictions evolve.
# This is usually what happens within the run() method but we can also trigger it manually
for _ in range(50):
myProblem.update()
New input selected (skipped 0): 9.967e-01, 5.966e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +4.389e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +4.780e-07 (h)
Target input 5: +2.199e-04 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141815_mock-006/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +4.389e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +4.780e-07 (+0.0%) (h)
Measured input 5: +2.199e-04 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.013e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -1.661e+04 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +3.031e+00 ±0.000e+00 (τ(xx|top))
Measured output 9: -4.274e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: -4.274e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -1.661e+04 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 1
# Reason : AL
# Database size: 6
# Objective : 14.176
# Hyperparam :
# - Log scale : 9.87302 -0.12639 -0.35083
# - Log amp : 0.35038
# - Log noise : -18.70423
# AL 1/ 5 : 422388.390 --> 10.734 | R (1418.123)
#--------------------------------------------------
New input selected (skipped 0): 8.358e-01, 4.000e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +4.389e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +2.034e-06 (h)
Target input 5: +6.424e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141818_mock-007/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +4.389e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +2.034e-06 (+0.0%) (h)
Measured input 5: +6.424e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.013e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -3.904e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +3.160e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: -1.856e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: -1.856e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -3.905e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 1
# Reason : AL
# Database size: 7
# Objective : 14.61
# Hyperparam :
# - Log scale : 10.07567 0.11174 0.17568
# - Log amp : 0.87562
# - Log noise : -18.59987
# AL 2/ 5 : 422388.390 --> 1.734 | R (1367.933)
#--------------------------------------------------
New input selected (skipped 0): 9.590e-01, 6.871e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +4.389e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +9.653e-07 (h)
Target input 5: -5.790e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141821_mock-008/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +4.389e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +9.653e-07 (+0.0%) (h)
Measured input 5: -5.790e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.013e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -8.226e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -6.533e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: +2.991e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: +2.991e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -8.227e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 1
# Reason : AL
# Database size: 8
# Objective : 14.954
# Hyperparam :
# - Log scale : 9.75588 0.24474 0.21036
# - Log amp : 1.14968
# - Log noise : -18.46896
# AL 3/ 5 : 422388.390 --> 1.188 | R (1369.474)
#--------------------------------------------------
New input selected (skipped 0): 9.686e-01, 7.279e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +4.389e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +1.557e-06 (h)
Target input 5: +6.997e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141824_mock-009/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +4.389e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +1.557e-06 (+0.0%) (h)
Measured input 5: +6.997e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.013e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -5.102e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +4.575e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: -2.563e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: -2.563e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -5.103e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 1
# Reason : AL
# Database size: 9
# Objective : 13.789
# Hyperparam :
# - Log scale : 12.65862 0.59784 0.43396
# - Log amp : 1.68263
# - Log noise : -18.37247
# AL 4/ 5 : 422388.390 --> 0.532 | R (1368.017)
#--------------------------------------------------
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 2
# Reason : DB
# Database size: 9
# Objective : -22.222
# Hyperparam :
# - Log scale : 10.05161 27.63369
# - Log amp : 20.39250
# - Log noise : -13.14046
#--------------------------------------------------
New input selected (skipped 0): 9.968e-01, 6.577e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +4.224e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +2.705e-06 (h)
Target input 5: -2.199e-04 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141831_mock-010/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +4.224e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +2.705e-06 (+0.0%) (h)
Measured input 5: -2.199e-04 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.049e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -3.266e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -2.602e+00 ±0.000e+00 (τ(xx|top))
Measured output 9: -1.457e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: -1.457e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -2.607e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 32
# Reason : AL
# Database size: 10
# Objective : 12.457
# Hyperparam :
# - Log scale : 13.50057 0.80896 0.50910
# - Log amp : 1.93850
# - Log noise : -18.30232
# AL 1/ 5 : 1.018 --> 0.484 | R (1483.037)
#--------------------------------------------------
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 33
# Reason : DB
# Database size: 10
# Objective : -27.067
# Hyperparam :
# - Log scale : 9.50699 22.16811
# - Log amp : 19.31988
# - Log noise : -13.03545
#--------------------------------------------------
print('Simulation step: ', myProblem.step)
print('Database size: ', myProblem.pressure.database.size)
Simulation step: 50
Database size: 10
Let’s plot the current prediction again:
fig, ax = plt.subplots(2, 3, figsize=(2*_sx, 2*_sy))
myProblem.plot(ax=ax)
Looks good. We now run the simulation again up to 2500 steps as specified in the input.
myProblem.run(keep_open=True)
-------------------------------------------------------------
Step Timestep Time CFL Residual
-------------------------------------------------------------
50 1.8984e-10 9.4921e-09 2.5000e-01 9.3031e-03
New input selected (skipped 0): 9.812e-01, 7.781e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +3.728e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +2.328e-06 (h)
Target input 5: -5.251e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141839_mock-011/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +3.728e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +2.328e-06 (+0.0%) (h)
Measured input 5: -5.251e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +3.472e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -4.952e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -1.493e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: +4.705e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: +4.705e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -1.871e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 85
# Reason : AL
# Database size: 11
# Objective : 11.744
# Hyperparam :
# - Log scale : 12.39420 1.00394 0.67471
# - Log amp : 2.32010
# - Log noise : -18.22000
# AL 1/ 5 : 1.010 --> 0.410 | R (1740.104)
#--------------------------------------------------
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 86
# Reason : DB
# Database size: 11
# Objective : -35.391
# Hyperparam :
# - Log scale : 10.86469 29.39918
# - Log amp : 21.81600
# - Log noise : -13.72910
#--------------------------------------------------
100 1.8984e-10 1.9019e-08 2.5000e-01 8.3217e-03
New input selected (skipped 0): 9.875e-01, 7.705e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +3.337e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +2.705e-06 (h)
Target input 5: -2.199e-04 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141845_mock-012/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +3.337e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +2.705e-06 (+0.0%) (h)
Measured input 5: -2.199e-04 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.125e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -5.046e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -2.080e+00 ±0.000e+00 (τ(xx|top))
Measured output 9: -1.718e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: -1.718e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: -8.265e+02 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 115
# Reason : AL
# Database size: 12
# Objective : 11.26
# Hyperparam :
# - Log scale : 13.68016 1.23302 0.76950
# - Log amp : 2.66563
# - Log noise : -18.14307
# AL 1/ 5 : 1.010 --> 0.425 | R (1870.995)
#--------------------------------------------------
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 116
# Reason : DB
# Database size: 12
# Objective : -40.272
# Hyperparam :
# - Log scale : 10.23929 25.66074
# - Log amp : 20.70479
# - Log noise : -13.64317
#--------------------------------------------------
200 1.8984e-10 3.8003e-08 2.5000e-01 3.9740e-03
300 1.8984e-10 5.6987e-08 2.5000e-01 2.2832e-03
New input selected (skipped 0): 9.895e-01, 7.809e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +2.346e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +2.705e-06 (h)
Target input 5: -2.199e-04 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141858_mock-013/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +2.346e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +2.705e-06 (+0.0%) (h)
Measured input 5: -2.199e-04 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.197e+05 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -7.034e+03 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: -1.498e+00 ±0.000e+00 (τ(xx|top))
Measured output 9: -2.009e+00 ±0.000e+00 (τ(yy|top))
Measured output 10: -2.009e+00 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: +1.162e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 311
# Reason : AL
# Database size: 13
# Objective : 11.544
# Hyperparam :
# - Log scale : 11.95012 1.40830 0.82667
# - Log amp : 2.98022
# - Log noise : -18.06385
# AL 1/ 5 : 1.001 --> 0.694 | R (2474.567)
#--------------------------------------------------
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 312
# Reason : DB
# Database size: 13
# Objective : -44.589
# Hyperparam :
# - Log scale : 8.54636 21.79786
# - Log amp : 16.85845
# - Log noise : -13.56320
#--------------------------------------------------
400 1.8983e-10 7.5970e-08 2.5000e-01 1.4579e-03
500 1.8983e-10 9.4954e-08 2.5000e-01 8.4875e-04
600 1.8983e-10 1.1394e-07 2.5000e-01 5.6530e-04
700 1.8983e-10 1.3292e-07 2.5000e-01 3.7051e-04
800 1.8983e-10 1.5190e-07 2.5000e-01 2.4393e-04
900 1.8983e-10 1.7089e-07 2.5000e-01 1.6212e-04
1000 1.8983e-10 1.8987e-07 2.5000e-01 1.0899e-04
1100 1.8983e-10 2.0885e-07 2.5000e-01 7.4229e-05
1200 1.8983e-10 2.2784e-07 2.5000e-01 5.1251e-05
New input selected (skipped 0): 9.657e-01, 8.752e-01 (max, min)
========================================================================================================================
Running MD simulation
---
__ __ ___ ____ _ __
| \/ |/ _ \ / ___| |/ /
| |\/| | | | | | | ' /
| | | | |_| | |___| . \
|_| |_|\___/ \____|_|\_\
---
Target input 1: +8.777e+02 (ρ)
Target input 2: +1.845e+01 (jx)
Target input 3: +0.000e+00 (jy)
Target input 4: +1.835e-06 (h)
Target input 5: -6.831e-03 (∂h/∂x)
Target input 6: +0.000e+00 (∂h/∂y)
Target input 7: +0.000e+00 (extra_0)
---
View log:
/home/runner/work/GaPFlow/GaPFlow/doc/tutorials/data/2026-05-14_141803_journal_gp/train/20260514_141937_mock-014/data/log.lammps
---
---
MD run completed (walltime: 0:00:00)
---
Measured input 1: +8.777e+02 (+0.0%) (ρ)
Measured input 2: +1.845e+01 (+0.0%) (jx)
Measured input 3: +0.000e+00 (----%) (jy)
Measured input 4: +1.835e-06 (+0.0%) (h)
Measured input 5: -6.831e-03 (+0.0%) (∂h/∂x)
Measured input 6: +0.000e+00 (----%) (∂h/∂y)
Measured input 7: +0.000e+00 (----%) (extra_0)
---
Measured output 1: +1.586e+06 ±1.000e+02 (p)
Measured output 2: -6.199e-01 ±0.000e+00 (τ(xx|bot))
Measured output 3: -6.199e-01 ±0.000e+00 (τ(yy|bot))
Measured output 4: -6.199e-01 ±0.000e+00 (τ(zz|bot))
Measured output 5: -6.199e-01 ±1.000e+00 (τ(yz|bot))
Measured output 6: -1.185e+04 ±1.000e+00 (τ(xz|bot))
Measured output 7: -6.199e-01 ±0.000e+00 (τ(xy|bot))
Measured output 8: +2.728e+01 ±0.000e+00 (τ(xx|top))
Measured output 9: -1.640e+01 ±0.000e+00 (τ(yy|top))
Measured output 10: -1.640e+01 ±0.000e+00 (τ(zz|top))
Measured output 11: -1.839e+00 ±1.000e+00 (τ(yz|top))
Measured output 12: +3.195e+03 ±1.000e+00 (τ(xz|top))
Measured output 13: -1.839e+00 ±0.000e+00 (τ(xy|top))
========================================================================================================================
#-----------------GP TRAINING (XZ)-----------------
# Timestep : 1206
# Reason : AL
# Database size: 14
# Objective : 13.011
# Hyperparam :
# - Log scale : 12.72492 1.34412 0.81603
# - Log amp : 3.07978
# - Log noise : -18.00582
# AL 1/ 5 : 1.000 --> 0.587 | R (3227.220)
#--------------------------------------------------
#-----------------GP TRAINING (ZZ)-----------------
# Timestep : 1207
# Reason : DB
# Database size: 14
# Objective : -66.681
# Hyperparam :
# - Log scale : 8.17860 20.50796
# - Log amp : 15.94350
# - Log noise : -16.51947
#--------------------------------------------------
1300 1.8982e-10 2.4702e-07 2.5000e-01 1.3280e-04
1400 1.8982e-10 2.6600e-07 2.5000e-01 2.7327e-04
1500 1.8982e-10 2.8498e-07 2.5000e-01 1.5709e-04
1600 1.8982e-10 3.0396e-07 2.5000e-01 8.9444e-05
1700 1.8982e-10 3.2295e-07 2.5000e-01 5.4315e-05
1800 1.8982e-10 3.4193e-07 2.5000e-01 3.4968e-05
1900 1.8982e-10 3.6091e-07 2.5000e-01 2.3665e-05
2000 1.8982e-10 3.7989e-07 2.5000e-01 1.6638e-05
2100 1.8982e-10 3.9887e-07 2.5000e-01 1.2010e-05
2200 1.8982e-10 4.1786e-07 2.5000e-01 8.8189e-06
2300 1.8982e-10 4.3684e-07 2.5000e-01 6.5443e-06
2400 1.8982e-10 4.5582e-07 2.5000e-01 4.8874e-06
2500 1.8982e-10 4.7480e-07 2.5000e-01 3.6627e-06
The active learning simulation continued to extend the database. Let’s check its growth as a function of the simulation time step:
plt.plot(myProblem.pressure.history['step'],
myProblem.pressure.history['database_size'])
plt.xlabel('Step')
plt.ylabel('Database size');
fig, ax = plt.subplots(2, 3, figsize=(2*_sx, 2*_sy))
myProblem.plot(ax=ax)
After 2500 steps, the simulation results looks close to what we expect for the journal bearing case, but has not yet converged. Feel free to run it for longer (by modifying the max_it parameter).