Cooling Coffee Cup Model#
import numpy as np
import matplotlib.pyplot as plt
import uqtestfuns as uqtf
The cooling coffee cup model simulates the temperature evolution of a coffee cup as it cools to an ambient temperature by solving an initial value problem As a UQ test function, the model is expressed as a two-dimensional, vector-valued function.
The model appeared in [THE18, RWE+20] as an introductory example for metamodeling.
Some realizations of the temperature evolutions are shown in figure below.
Test function instance#
To create a default instance of the test function:
my_testfun = uqtf.CoffeeCup()
Check if it has been correctly instantiated:
print(my_testfun)
Function ID : CoffeeCup
Input Dimension : 2 (fixed)
Output Dimension : 150
Parameterized : True
Description : Cooling coffee cup model from Tennøe et al. (2018)
Applications : metamodeling
Description#
The temperature evolution of a coffee cup, \(T(t)\), as it cools down to an ambient temperature, \(T_{\text{amb}}\), is described by the following initial value problem (IVP)[1]:
with an initial condition (IC):
where \(\kappa\) is the thermal conductivity of the cup.
The test function is the solution to the IVP:
where:
\(\boldsymbol{x} = \left( \kappa, T_{\text{amb}} \right)\) is a two-dimensional vector of uncertain input variables, defined further below.
\(\boldsymbol{p} = \{ T_0, t_e, n_{ts} \}\) is a set of fixed parameters of the problem, also defined further below.
Probabilistic input#
The probabilistic input model for the test function is shown below.
Show code cell source
print(my_testfun.prob_input)
Function ID : CoffeeCup
Input ID : Tennoee2018
Input Dimension : 2
Description : Probabilistic input model for the cooling coffee cup
model from Tennøe et al. (2018)
Marginals :
No. Name Distribution Parameters Description
----- -------- -------------- ------------- -------------------------------
1 kappa uniform [0.025 0.075] Thermal conductivity of the cup
2 temp_amb uniform [15. 25.] Ambient temperature [degC]
Copulas : Independence
Parameters#
The default values of the parameters are shown below.
Show code cell source
print(my_testfun.parameters)
Function ID : CoffeeCup
Parameter ID : Tennoee2018
Description : Parameter set for the cooling cup coffee cup model Tennøe
et al. (2018)
No. Keyword Value Type Description
----- --------- ----------- ------ --------------------------
1 temp_0 9.50000e+01 float Initial temperature [degC]
2 t_e 2.00000e+02 float End of transient [s]
3 n_ts 1.50000e+02 int Number of time steps
Notes on numerical algorithms#
The IVP described above is solved numerically using
solve_ivp()
fro SciPy with its default method and parameter values.
The default parameter values for these methods can be overridden by providing a dictionary with new parameter values.
For example, to change the method used to solve the IVP:
fun.parameters.add("solve_ivp", {"method": "RK23"}) # 'solve_ivp' as the parameter keyword
Note
In this example, method is acceptable keyword-named argument for solve_ivp();
indeed, the key-value pairs specified for the parameters of solve_ivp()
must be recognized by the method.
References#
Simen Tennøe, Geir Halnes, and Gaute T. Einevoll. Uncertainpy: a Python toolbox for uncertainty quantification and sensitivity analysis in computational neuroscience. Frontiers in Neuroinformatics, 2018. doi:10.3389/fninf.2018.00049.
Robin A. Richardson, David W. Wright, Wouter Edeling, Vytautas Jancauskas, Jalal Lakhlili, and Peter V. Coveney. EasyVVUQ: a library for verification, validation and uncertainty quantification in high performance computing. Journal of Open Research Software, 8(1):11, 2020. doi:10.5334/jors.303.