Code for simulating thermophones, based upon
Guiraud, Pierre, et al. "Multilayer modeling of thermoacoustic sound generation for thermophone analysis and design." Journal of Sound and Vibration 455 (2019): 275-298. DOI
The implemented model considers:
- Constant volumetric generation
- Boundary generation
- Convective losses
This simulator uses the non-free Multiprecision Computing Toolbox for MATLAB (aka mp
toolbox) to perform some computations that require increased precision.
Contents:
-
Download:
-
Install:
-
On Windows - install, on Mac/Linux - extract.
-
Add the toolbox to MATLAB's PATH using the
path
tool or:addpath('path/to/AdvanpixMCT-4.7.0-1.13589')
-
-
Trial reset:
A method for doing this has only been discovered on Windows so far, and consists of going to%APPDATA%/MathWorks/MATLAB
, then opening each of theR20###
folders and deleting the empty folder ofCommandHistory
.
-
Layer definitions
Data of each material layer is included in a matrix calledMDM
(Material Data Matrix). Each row represents the properties of a different layer of the thermophone design, in the order in which they appear. The column inputs are as follows:Col. # Symbol Description Units 1 L Thickness [m] 2 ρ Density [kg m⁻³] 3 B Bulk modulus [Pa] 4 αT Coeff. thermal expansion [K⁻¹] 5 λ 1ˢᵗ viscosity coeff. [kg m⁻¹ s⁻¹] 6 μ 2ⁿᵈ viscosity coeff. [kg m⁻¹ s⁻¹] 7 cp Specific heat, constant pressure [J kg⁻¹ K⁻¹] 8 cv Specific heat, constant volume [J kg⁻¹ K⁻¹] 9 κ Thermal conductivity [W m⁻¹ K⁻¹] Col. # Symbol Description Units 10 SL Lt. edge boundary generation [W] 11 S0 Internal generation [W] 12 SR Rt. edge boundary generation [W] Col. # Symbol Description Units 13 hL Lt. edge heat transfer coeff. [W m⁻¹ K⁻²] 14 T0 Internal mean temperature [K] 15 hR Rt. edge heat transfer coeff. [W m⁻¹ K⁻²] MDM = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14;...%(layer 1) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14;...%(layer 2) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14;...%(layer 3) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]; %(layer 4)
-
Running in
parfor
mode
IfsolutionFunc
is configured to run usingparfor
, it is necessary to initialize themp
toolbox on each node (i.e. worker of the parallel pool) using the following commands:gcp(); % Create a pool with the default settings (if needed) spmd % Issue commands to all workers in pool (Single Program, Multiple Data) warning('off', 'MATLAB:nearlySingularMatrix') % Precision warning toggle mp.Digits(50); % mp toolbox precision setup end
-
Enabling/disabling the progress bar
A progress bar visualizes the progress of loopfor
orparfor
A progress bar is always associated with some overhead, however, in cases where individual loop iterations are very short (i.e. the "business logic" takes a short time to execute), the overhead can be the main performance sink - as happens in this case - which is why it is commented out in the code.The
ParforProgressbar
utility is bundled with the code as a Git submodule. To enableprogressbar
one must add it to MATLAB's path (e.g.addpath(fullfile(pwd, 'progressbar'));
), and uncomment the lines related toppm
insolutionFunc.m
(3 lines in total).