edg_acoustics.boundary_condition
This module provides boundary condition functionalities for the edg_acoustics package.
The edg_acoustics.boundary_condition provide more necessary functionalities
(based upon edg_acoustics.acoustics_simulation) to setup boundary condition for a specific scenario.
Please note that most of used mesh functions and classes in edg_acoustics are present in the main edg_acoustics namespace
rather than in edg_acoustics.boundary_condition.
Todo
For future development, the module can be extended to include other types of boundary conditions.
maybe add flux boundary conditions.
Module Contents
Classes
Abstract base class for boundary conditions. |
|
Setup absorptive boundary condition of a DG acoustics simulation for a specific scenario. |
Attributes
maximum resolvable frequency. |
- class edg_acoustics.boundary_condition.BoundaryCondition[source]
Bases:
abc.ABCAbstract base class for boundary conditions.
- static init_ADEvariables(BCpara, BCnode)[source]
Initiate ADE variables, normal velocity, characteristic waves (outgoing and incoming).
- Parameters:
BCnode (list[dict]) – see
edg_acoustics.AcousticsSimulation.BCnode.BCpara (list[dict]) – see
edg_acoustics.AbsorbBC.BCpara.
- Returns:
BCvar (list [dict]) – see
edg_acoustics.AbsorbBC.BCvar.
- static check_BCpara(BCnode, BCpara, freq_max)[source]
Check if BCpara is compatible with AcousticsSimulation.BCnode and satisfies physical admissibility condition.
Given an acoustics simulation data structure with a set of boundary conditions specified in acoustics_simulation.BCnode, check if the list of boundary conditions specification and parameters are compatible. By compatible we mean that all boundary conditions (keys) in BCpara exist in acoustics_simulation.BCnode, and vice-versa. Also, to satisfy the causality and reality conditions, multi-pole model parameters \(\zeta_i\) (stored in first row of numpy.array BCpara[BC_label] need to be positive. To satisfy the passivity condition, the magnitude of the reflection coefficient from the multi-pole model need to be smaller than 1, that is, \(|R(\omega)|\leq 1\), where
\[R(\omega)\approx{R}_\infty+\sum_{k=1}^{S}\frac{A_k}{\zeta_k+\mathrm{i}\omega}+ \sum_{l=1}^{T} \frac{1}{2}\Big( \frac{B_l-\mathrm{i}C_l}{\alpha_l-\mathrm{i}\beta_l+\mathrm{i}\omega}+\frac{B_l+\mathrm{i}C_l}{\alpha_l+\mathrm{i}\beta_l+\mathrm{i}\omega} \Big)\]- Parameters:
BCnode (list[dict]) – see
edg_acoustics.AcousticsSimulation.BCnode.BCpara (list[dict]) – see
edg_acoustics.AbsorbBC.BCpara.freq_max (float) – maximum resolvable frequency of the simulation. <default>:
edg_acoustics.boundary_condition.FREQ_MAX
- Raises:
AssertionError – If BCpara.[index][‘label’] is not present in the acoustics_simulation.BCnode.[index][‘label’], an error is raised. If a label is present in the acoustics_simulation.BCnode.[index][‘label’] but not in BCpara, an error is raised. If the labels in BCpara and BCnode are not the same, an error is raised.
AssertionError – If the reflection coefficient is not smaller than 1, an error is raised.
AssertionError – If the number of BC types is not the same in the BC_labels and BC_para, an error is raised.
AssertionError – If the causality and reality conditions are not met, an error is raised.
- static compute_Re(omega, paras)[source]
Computes the reflection coefficient given the passed parameter of the multi-pole model at the frequencies of omega.
- Parameters:
omega (numpy.ndarray) – angular frequency.
paras (dict) – see
edg_acoustics.boundary_condition.AbsorbBC.BCpara.
- Returns:
Re (numpy.ndarray) – reflection coefficient at the frequencies of omega.
- class edg_acoustics.boundary_condition.AbsorbBC(BCnode, BCpara, freq_max=FREQ_MAX)[source]
Bases:
BoundaryConditionSetup absorptive boundary condition of a DG acoustics simulation for a specific scenario.
AbsorbBCis used to load the boundary condition parameters, and to initiate the ADE variables.- Parameters:
BCnode (list[dict]) – see
edg_acoustics.AcousticsSimulation.BCnode.freq_max (float) – maximum resolvable frequency of the simulation. <default>:
edg_acoustics.boundary_condition.FREQ_MAX
- BCpara
a list of boundary conditon parameters from the multi-pole model. Each element is a dictionary with keys (values) [‘label’(int),’RI’(float),’RP’(numpy.ndarray),’CP’(numpy.ndarray)]. ‘RI’ refers to the limit value of the reflection coefficient as the frequency approaches infinity, i.e., \(R_\infty\). ‘RP’ refers to real pole pairs, i.e., \(A\) (stored in 1st row), \(\zeta\) (stored in 2nd row). ‘CP’ refers to complex pole pairs, i.e., \(B\) (stored in 1st row), \(C\) (stored in 2nd row), \(\alpha\) (stored in 3rd row), \(\beta\) (stored in 4th row).
More details about the multi-pole model parameters and boundary condition can be found in reference https://doi.org/10.1121/10.0001128.
BCpara[:][‘label’] must contain the same integer elements as acoustics_simulation.BCnode[:][‘label’], i.e., all boundary conditions in the simulation must have an associated boundary condition parameters.