## Functions

set_grid

Forward1D

Forward2D

Forward3D

Forward2D_fund

Forward2D_sec

Forward3D_fund

Forward3D_sec

Backward1D

Backward2D

Backward3D

Backward2D_fund

Backward3D_fund

### set_grid

set_grid is the grid class used in mSOUND and it generates a structure containing the Cartesian grid coordinates, evenly spaced time array and wavenumber matrices used within the simulation.

` ````
mgrid = set_grid(dt, t_length, dx, x_length); % 1D
mgrid = set_grid(dt, t_length, dx, x_length, dy, y_length); % 2D
mgrid = set_grid(dt, t_length, dx, x_length, dy, y_length, dz, z_length); % 3D
```

### Inputs

INPUT | DESCRIPTION |
---|---|

dx | spatial step size in the x direction [m] |

dy | spatial step size in the y direction [m] |

dz | spatial step size in the z direction [m] |

dt | temporal step size [s] |

x_length | spatial domain size in the x direction [m] |

y_length | spatial domain size in the y direction [m] |

z_length | spatial domain size in the z direction [m] |

t_length | temporal domain size [s] |

### Outputs

OUTPUT | DESCRIPTION |
---|---|

mgrid.x | coordinates in the x direction [m] |

mgrid.y | coordinates in the y direction [m] |

mgrid.z | coordinates in the z direction [m] |

mgrid.t | evenly spaced time array [s] |

mgrid.kx | wavevector in the x direction |

mgrid.ky | wavevector in the y direction |

mgrid.w | angular frequency |

mgrid.num_x | number of grid points in the x direction |

mgrid.num_y | number of grid points in the y direction |

mgrid.num_z | number of grid points in the z direction |

mgrid.num_t | number of sampling point in time |

### Forward1D

Forward1D is a 1D forward simulation function based on the transient mixed domain method and it generates time-domain results.

` ````
p = Forward1D(mgrid, medium, source_p, sensor_mask, reflection_order);
p = Forward1D(mgrid, medium, source_p, sensor_mask, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | excitation signal [Pa] |

sensor_mask | a set of Cartesian points where the waveform is recorded |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 1D simulations, the medium properties should be given as matrices with a size (1, mgrid.num_x+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. The excitation pressure source_p is indexed as (time, source_position).

3. sensor_mask
contains the positions in Cartesian coordinate with a matrix size (1, mgrid.num_x+1)
with the recording positions marked with logical value 1 while other positions are marked with 0.

4. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

5. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

### Outputs

Time-domain results recorded at the sensor positions given by sensor_mask.

### Forward2D

Forward2D is a 2D forward simulation function based on the transient mixed domain method and it generates time-domain results.

` ````
p = Forward2D(mgrid, medium, source_p, sensor_mask, reflection_order);
p = Forward2D(mgrid, medium, source_p, sensor_mask, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | excitation signal [Pa] |

sensor_mask | a set of Cartesian points where the waveform is recorded |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'NRL' | apply the non-reflecting layer |

'animation' | play the animation during the simulation |

'record_animation' | record the animation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 2D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. The excitation pressure source_p is indexed as (time, source_position).

3. sensor_mask
contains the positions in Cartesian coordinate with a matrix size (mgrid.num_x, mgrid.num_y+1)
with the recording positions marked with logical value 1 while other positions are marked with 0.

4. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

5. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

6. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

7. record_animation will record the animation and save the animation
file as ‘animation.avi’.

### Outputs

Time-domain results recorded at the sensor positions given by sensor_mask.

### Forward3D

Forward3D is a 3D forward simulation function based on the transient mixed domain method and it generates time-domain results.

` ````
p = Forward3D(mgrid, medium, source_p, sensor_mask, reflection_order);
p = Forward3D(mgrid, medium, source_p, sensor_mask, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | excitation signal [Pa] |

sensor_mask | a set of Cartesian points where the waveform is recorded |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'NRL' | apply the non-reflecting layer |

'animation' | play the animation during the simulation |

'record_animation' | record the animation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 3D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y, mgrid.num_z+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. The excitation pressure source_p is indexed as (time, source_position).

3. sensor_mask
contains the positions in Cartesian coordinate with a matrix size (mgrid.num_x, mgrid.num_y, mgrid.num_z+1)
with the recording positions marked with logical value 1 while other positions are marked with 0.

4. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

5. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

6. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

7. record_animation will record the animation and save the animation
file as ‘animation.avi’.

### Outputs

Time-domain results recorded at the sensor positions given by sensor_mask.

### Forward2D_fund

Forward2D_fund is a 2D forward simulation function based on the frequency-specific mixed domain method and it generates the pressure field at the center frequency. Only use this function when the excitation is a continuous wave (sinusoidal wave) and linear or weakly nonlinear wave propagation is considered.

` ````
p = Forward2D_fund(mgrid, medium, source_p, omega_c, reflection_order);
p = Forward2D_fund(mgrid, medium, source_p, omega_c, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | excitation signal [Pa] |

omega_c | center frequency [rad] |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | PROPERTIES |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'NRL' | apply the non-reflecting layer |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 2D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

3. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

4. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

### Outputs

Pressure field distribution at the center frequency.

### Forward2D_sec

Forward2D_sec is a 2D forward simulation function based on the frequency-specific mixed domain method and it generates the pressure field at the second harmonics. To generate the second harmonics pressure field, users must run the function Forward2D_fund first to obtain the pressure field at the center frequency P_fundamental. When calculating the second harmonics pressure field, density heterogeneity is by dafault not considered. It can be considered, however, by invoking "correction". Only use this function when the excitation is a continuous wave (sinusoidal wave) and weakly nonlinear wave propagation is considered. Multiple reflections are not consdiered in this function.

` ````
p = Forward2D_sec(mgrid, medium, P_fundamental, omega_c);
p = Forward2D_sec(mgrid, medium, P_fundamental, omega_c, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

P_fundamental | pressure at the center frequency [Pa] |

omega_c | center frequency [rad] |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'NRL' | apply the non-reflecting layer |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 2D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

3. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

### Outputs

Pressure field distribution at the second harmonics.

### Forward3D_fund

Forward3D_fund is a 3D forward simulation function based on the frequency-specific mixed domain method and it generates the pressure field at the center frequency. Only use this function when the excitation is a continuous wave (sinusoidal wave) and linear or weakly nonlinear wave propagation is considered.

` ````
p = Forward3D_fund(mgrid, medium, source_p, omega_c);
p = Forward3D_fund(mgrid, medium, source_p, omega_c, reflection_order);
p = Forward3D_fund(mgrid, medium, source_p, omega_c, reflection_order, c_ref, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | excitation signal [Pa] |

omega_c | center frequency [rad] |

reflection_order | the maximum order of reflection included in the simulation |

c_ref | a set of reference sound velocities covering the sound velocity distribution of the medium |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | use the wave solver for strongly inhomogeneous media |

'layer' | use the wave solver for layered media |

'riemann' | use a lower order numerical scheme for faster computation |

'NRL' | apply the non-reflecting layer |

'single' | cast data type to single to reduce data size and speed up the computation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 3D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y, mgrid.num_z).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the background speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

3. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended. c_ref
must be entered when correction is enabled.

4. layer should only be used when the layer interface is perpendicular to the z-axis.
This function is applicable to arbitrary inhomogeneities.

5. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

### Outputs

Pressure field distribution at the center frequency.

### Forward3D_sec

Forward3D_sec is a 3D forward simulation function based on the frequency-specific mixed domain method and it generates the pressure field at the second harmonics. To generate the second harmonics pressure field, users must run the function Forward3D_fund first to obtain the pressure field at the fundamental frequency P_fundamental. Only use this function when the excitation is a continuous wave (sinusoidal wave) and weakly nonlinear wave propagation is considered. Multiple reflections are currently not considered in this function.

` ````
p = Forward3D_sec(mgrid, medium, P_fundamental, omega_c);
p = Forward3D_sec(mgrid, medium, P_fundamental, omega_c, c_ref, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

P_fundamental | pressure at the fundamental frequency [Pa] |

omega_c | fundamental frequency [rad] |

c_ref | a set of reference sound velocities covering the sound velocity distribution of the medium |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | use the wave solver for strongly inhomogeneous media |

'NRL' | apply the non-reflecting layer |

'riemann' | use a lower order numerical scheme for faster computation |

'single' | cast data type to single to reduce data size and speed up the computation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 3D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y, mgrid.num_z).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the background speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended. c_ref
must be entered when correction is enabled.

3. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

### Outputs

Pressure field distribution at the second harmonics.

### Backward1D

Backward1D is a 1D backward simulation function based on the transient mixed domain method and it generates time-domain results.

` ````
p = Backward1D(mgrid, medium, source_p, sensor_mask, reflection_order);
p = Backward1D(mgrid, medium, source_p, sensor_mask, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | pressure field to be backward propagated |

sensor_mask | a set of Cartesian points where the waveform is recorded |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'no_refl_correction' | turn off the reflection correction in backward propagation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 1D simulations, the medium properties should be given as matrices with a size (mgrid.num_x+1, 1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. The excitation pressure source_p is indexed as (time, source_position).

3. sensor_mask
contains the positions in Cartesian coordinate with a matrix size (mgrid.num_x+1, 1)
with the recording positions marked with logical value 1 while other positions are marked with 0.

4. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

5. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

6. For a heterogeneous medium, when using full-wave-solver-generated data or measured data as the input for backward projection, the mixed domain method could
produce spurious reflections. An algorithm, therefore, is designed to mitigate this issue. This correction algorithm,
however, roughly doubles the computational time. There are a few scenarios where this correction algorithm can be disabled without
sacrificing much of the accuracy. This can be done by activating "no_refl_correction". For example, when multiple reflection is
not considered in the backward projection, i.e., when "reflection_order"=0, the correction algorithm can be turned off.
Even if "reflection_order" is not equal to 0, the correction algorithm can be turned off for weakly heterogeneous media such as
soft tissue. When the speed of sound and density are constants, the correcton algorithm will be turned off automatically.

### Outputs

Time-domain results recorded at the sensor positions given by sensor_mask.

### Backward2D

Backward2D is a 2D backward simulation function based on the transient mixed domain method and it generates time-domain results.

` ````
p = Backward2D(mgrid, medium, source_p, sensor_mask, reflection_order);
p = Backward2D(mgrid, medium, source_p, sensor_mask, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | pressure field to be backward propagated |

sensor_mask | a set of Cartesian points where the waveform is recorded |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'no_refl_correction' | turn off the reflection correction in backward propagation |

'NRL' | apply the non-reflecting layer |

'animation' | play the animation during the simulation |

'record_animation' | record the animation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 2D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. The excitation pressure source_p is indexed as (time, source_position).

3. sensor_mask
contains the positions in Cartesian coordinate with a matrix size (mgrid.num_x, mgrid.num_y+1)
with the recording positions marked with logical value 1 while other positions are marked with 0.

4. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

5. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

6. For a heterogeneous medium, when using full-wave-solver-generated data or measured data as the input for backward projection, the mixed domain method could
produce spurious reflections. An algorithm, therefore, is designed to mitigate this issue. This correction algorithm,
however, roughly doubles the computational time. There are a few scenarios where this correction algorithm can be disabled without
sacrificing much of the accuracy. This can be done by activating "no_refl_correction". For example, when multiple reflection is
not considered in the backward projection, i.e., when "reflection_order"=0, the correction algorithm can be turned off.
Even if "reflection_order" is not equal to 0, the correction algorithm can be turned off for weakly heterogeneous media such as
soft tissue. When the speed of sound and density are constants, the correcton algorithm will be turned off automatically.

7. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

8. record_animation will record the animation and save the animation
file as ‘animation.avi’.

### Outputs

Time-domain results recorded at the sensor positions given by sensor_mask.

### Backward3D

Backward3D is a 3D backward simulation function based on the transient mixed domain method and it generates time-domain results.

` ````
p = Backward3D(mgrid, medium, source_p, sensor_mask, reflection_order);
p = Backward3D(mgrid, medium, source_p, sensor_mask, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | pressure field to be backward propagated |

sensor_mask | a set of Cartesian points where the waveform is recorded |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'no_refl_correction' | turn off the reflection correction in backward propagation |

'NRL' | apply the non-reflecting layerr |

'animation' | play the animation during the simulation |

'record_animation' | record the animation |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 3D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y, mgrid.num_z+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. The excitation pressure source_p is indexed as (time, source_position).

3. sensor_mask
contains the positions in Cartesian coordinate with a matrix size (mgrid.num_x, mgrid.num_y, mgrid.num_z+1)
with the recording positions marked with logical value 1 while other positions are marked with 0.

4. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

5. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

6. For a heterogeneous medium, when using full-wave-solver-generated data or measured data as the input for backward projection, the mixed domain
method could produce spurious reflections. An algorithm, therefore, is designed to mitigate this issue. This correction
algorithm, however, roughly doubles the computational time. There are a few scenarios where this correction algorithm can be
disabled without sacrificing much of the accuracy. This can be done by activating "no_refl_correction". For example,
when multiple reflection is not considered in the backward projection, i.e., when "reflection_order"=0, the correction algorithm
can be turned off. Even if "reflection_order" is not equal to 0, the correction algorithm can be turned off for weakly
heterogeneous media such as soft tissue.
When the speed of sound and density are constants, the correcton algorithm will be turned off automatically.

7. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

8. record_animation will record the animation and save the animation
file as ‘animation.avi’.

### Outputs

Time-domain results recorded at the sensor positions given by sensor_mask.

### Backward2D_fund

Backward2D_fund is a 2D backward simulation function based on the frequency-specific mixed domain method and it generates the pressure field at the center frequency. Only use this function when the excitation is a continuous wave (sinusoidal wave) and linear wave propagation is considered.

` ````
p = Backward2D_fund(mgrid, medium, source_p, omega_c, reflection_order);
p = Backward2D_fund(mgrid, medium, source_p, omega_c, reflection_order...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | pressure field to be backward propagated |

omega_c | center frequency [rad] |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'no_refl_correction' | turn off the reflection correction in backward propagation |

'NRL' | apply the non-reflecting layerr |

### Remarks

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 2D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

3. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

4. For a heterogeneous medium, when using full-wave-solver-generated data or measured data as the input for backward projection, the mixed domain
method could produce spurious reflections. An algorithm, therefore, is designed to mitigate this issue. This correction
algorithm, however, roughly doubles the computational time. There are a few scenarios where this correction algorithm can be
disabled without sacrificing much of the accuracy. This can be done by activating "no_refl_correction". For example,
when multiple reflection is not considered in the backward projection, i.e., when "reflection_order"=0, the correction algorithm
can be turned off. Even if "reflection_order" is not equal to 0, the correction algorithm can be turned off for weakly
heterogeneous media such as soft tissue.
When the speed of sound and density are constants, the correcton algorithm will be turned off automatically.

5. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

### Outputs

Pressure field distribution at the center frequency.

### Backward3D_fund

Backward3D_fund is a 3D backward simulation function based on the frequency-specific mixed domain method and it generates the pressure field at the center frequency. Only use this function when the excitation is a continuous wave (sinusoidal wave) and linear wave propagation is considered.

` ````
p = Backward3D_fund(mgrid, medium, source_p, omega_c, reflection_order);
p = Backward3D_fund(mgrid, medium, source_p, omega_c, reflection_order, ...);
```

### Inputs

INPUT | DESCRIPTION |
---|---|

mgrid | structure returned by set_grid |

medium | input structure including the medium properties |

source_p | pressure field to be backward propagated |

omega_c | center frequency [rad] |

reflection_order | the maximum order of reflection included in the simulation |

OPTIONAL INPUT | DESCRIPTION |
---|---|

'correction' | apply phase and amplitude corrections for strongly heterogeneous media |

'no_refl_correction' | turn off the reflection correction in backward propagation |

'NRL' | apply the non-reflecting layer |

### Details

1. medium
is a structure containing spatially distributed speed of sound, density, nonlinear coefficient,
attenuation coefficient, and power law exponent.
For 3D simulations, the medium properties should be given as matrices with a size (mgrid.num_x, mgrid.num_y, mgrid.num_z+1).
For homogeneous media, the medium properties can be described by a single scalar.
medium.c0
is the reference speed of sound and generally, it is chosen as the minimum value of
medium.c.

2. reflection_order
indicates the maximum order of reflection to be included in the simulation. This number is
recommended to be 2 for lossy biological media in order to achieve the best tradeoff between accuracy and computation time.

3. For simulations with large speed of sound or density contrast (contrast ratio being larger than 1.05),
correction is recommended.

4. For a heterogeneous medium, when using full-wave-solver-generated data or measured data as the input for backward projection, the mixed domain
method could produce spurious reflections. An algorithm, therefore, is designed to mitigate this issue. This correction
algorithm, however, roughly doubles the computational time. There are a few scenarios where this correction algorithm can be
disabled without sacrificing much of the accuracy. This can be done by activating "no_refl_correction". For example,
when multiple reflection is not considered in the backward projection, i.e., when "reflection_order"=0, the correction algorithm
can be turned off. Even if "reflection_order" is not equal to 0, the correction algorithm can be turned off for weakly
heterogeneous media such as soft tissue.
When the speed of sound and density are constants, the correcton algorithm will be turned off automatically.

5. By invoking NRL, non-reflecting layers are added to the computational
domain and would minimize the spatial aliasing error. If the non-reflecting layer is activated,
medium.NRL_gamma and medium.NRL_alpha
must be given.

### Outputs

Pressure field distribution at the center frequency.