implementations.problem_classes.Quench module¶
- class Quench(Cv=1000.0, K=1000.0, u_thresh=0.03, u_max=0.06, Q_max=1.0, leak_range=(0.45, 0.55), leak_type='linear', leak_transition='step', order=2, stencil_type='center', bc='neumann-zero', nvars=128, newton_tol=1e-08, newton_maxiter=99, lintol=1e-08, liniter=99, direct_solver=True, inexact_linear_ratio=None, min_lintol=1e-12, reference_sol_type='scipy')[source]¶
Bases:
ProblemThis is a toy problem [1] to emulate a magnet that has been cooled to temperatures where superconductivity is possible. However, there is a leak! Some point in the domain is constantly heated and when this has heated up its environment sufficiently, there will be a runaway effect heating up the entire magnet. This effect has actually lead to huge magnets being destroyed at CERN in the past and hence warrants investigation.
The model we use is a 1d heat equation with Neumann-zero boundary conditions, meaning this magnet is totally insulated from its environment except for the leak. We add a non-linear term that heats parts of the domain that exceed a certain temperature threshold as well as the leak itself.
The problem is discretised with finite difference in space and treated fully-implicitly.
- Parameters:
Cv (float, optional) – Volumetric heat capacity.
K (float, optional) – Thermal conductivity.
u_thresh (float, optional) – Threshold for temperature.
u_max (float, optional) – Maximum temperature.
Q_max (float, optional) – Maximum heat source power density.
leak_range (tuple of float) – Range of the leak.
leak_type (str, optional) – Type of leak, choose between
'linear'or'exponential'.leak_transition (str, optional) – Indicates how the heat in the leak propagates, choose between
'step'and'Gaussian'.order (int, optional) – Order of the finite difference discretization.
stencil_type (str, optional) – Type of stencil for finite differences.
bc (str, optional) – Type of boundary conditions. Default is
'neumann-zero'.nvars (int, optional) – Spatial resolution.
newton_tol (float, optional) – Tolerance for Newton to terminate.
newton_maxiter (int, optional) – Maximum number of Newton iterations to be done.
lintol (float, optional) – Tolerance for linear solver to be done.
liniter (int, optional) – Maximum number of linear iterations inside the Newton solver.
direct_solver (bool, optional) – Indicates if a direct solver should be used.
inexact_linear_ratio (float, optional) – Ratio of tolerance of linear solver to the Newton residual, overrides lintol
min_lintol (float, optional) – Minimal tolerance for the linear solver
reference_sol_type (str, optional) – Indicates which method should be used to compute a reference solution. Choose between
'scipy','SDC', or'DIRK'.
- A¶
FD discretization matrix of the ND grad operator.
- Type:
sparse matrix (CSC)
- Id¶
Identity matrix of the same dimension as A.
- Type:
sparse matrix (CSC)
- dx¶
Distance between two spatial nodes.
- Type:
float
- xv¶
Spatial grid values.
- Type:
np.1darray
- leak¶
Indicates the leak.
- Type:
np.1darray of bool
References
- dtype_f¶
alias of
mesh
- dtype_u¶
alias of
mesh
- get_non_linear_Jacobian(u)[source]¶
Evaluate the non-linear part of the Jacobian only.
- Parameters:
u (dtype_u) – Current values of the numerical solution.
- Returns:
The derivative of the non-linear part of the solution w.r.t. to the solution.
- Return type:
scipy.sparse.csc
- class QuenchIMEX(Cv=1000.0, K=1000.0, u_thresh=0.03, u_max=0.06, Q_max=1.0, leak_range=(0.45, 0.55), leak_type='linear', leak_transition='step', order=2, stencil_type='center', bc='neumann-zero', nvars=128, newton_tol=1e-08, newton_maxiter=99, lintol=1e-08, liniter=99, direct_solver=True, inexact_linear_ratio=None, min_lintol=1e-12, reference_sol_type='scipy')[source]¶
Bases:
QuenchThis is a toy problem [1] to emulate a magnet that has been cooled to temperatures where superconductivity is possible. However, there is a leak! Some point in the domain is constantly heated and when this has heated up its environment sufficiently, there will be a runaway effect heating up the entire magnet. This effect has actually lead to huge magnets being destroyed at CERN in the past and hence warrants investigation.
The model we use is a 1d heat equation with Neumann-zero boundary conditions, meaning this magnet is totally insulated from its environment except for the leak. We add a non-linear term that heats parts of the domain that exceed a certain temperature threshold as well as the leak itself.
The problem is discretised with finite difference in space and treated semi-implicitly.
- dtype_f¶
alias of
imex_mesh