Type: | Package |
Title: | Acoustic Scattering for Complex Shapes by Using the DWBA |
Version: | 0.1.1 |
Date: | 2024-01-01 |
Author: | Juan Domingo Gonzalez [cre, aut], Edmundo Federico Lavia [aut], Guadalupe Cascallares [aut] |
Maintainer: | Juan Domingo Gonzalez <juanrst@hotmail.com> |
Description: | Uses the Distorted Wave Born Approximation (DWBA) to compute the acoustic backward scattering, the geometry of the object is formed by a volumetric mesh, composed of tetrahedrons. This computation is done efficiently through an analytical 3D integration that allows for a solution which is expressed in terms of elementary functions for each tetrahedron. It is important to note that this method is only valid for objects whose acoustic properties, such as density and sound speed, do not vary significantly compared to the surrounding medium. (See Lavia, Cascallares and Gonzalez, J. D. (2023). TetraScatt model: Born approximation for the estimation of acoustic dispersion of fluid-like objects of arbitrary geometries. arXiv preprint <doi:10.48550/arXiv.2312.16721>). |
Encoding: | UTF-8 |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Imports: | Rcpp (≥ 1.0.9) |
LinkingTo: | Rcpp, RcppArmadillo |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | yes |
Packaged: | 2024-01-29 22:36:15 UTC; juan |
Repository: | CRAN |
Date/Publication: | 2024-01-29 23:20:02 UTC |
read_mesh
Description
This function reads the mesh from a file .mesh (extension)
Usage
read_mesh(meshfile)
Arguments
meshfile |
a string with the name of the file that contains the volumetric mesh in GMF format (Gamma Mesh Format), conventionally, an ASCII file with ".mesh" extension. |
Value
a list representing the mesh, it should include
-
vertex
: a data frame with the vertices of the tetrahedra, each vertex must have three coordinates -
tetra
: a data frame containing the four vertex-index of each tetrahedron
Examples
# Generates a pseudofile that has the mesh of
# a cube with edges one metre in length, centered at the origin.
pseudofile=c("MeshVersionFormatted 2",
"","Dimension 3","","Vertices","8","-0.5 -0.5 0.5 6 ",
"-0.5 -0.5 -0.5 7 ","-0.5 0.5 0.5 9 ","-0.5 0.5 -0.5 11 ",
"0.5 -0.5 0.5 16 ","0.5 -0.5 -0.5 17 ","0.5 0.5 0.5 19 ",
"0.5 0.5 -0.5 21 ","","Edges", "12","2 1 5 ","1 3 8 ",
"4 3 10 ","2 4 12 ","6 5 15 ","5 7 18 ","8 7 20 ","6 8 22 ",
"2 6 25 ","1 5 26 ","4 8 29 ","3 7 30 ","","Triangles",
"12","2 1 3 3 ","3 4 2 3 ","5 6 8 13 ","8 7 5 13 ",
"2 6 5 23 ","5 1 2 23 ","8 4 3 27 ","3 7 8 27 ","2 4 8 31 ",
"8 6 2 31 ","3 1 5 33 ","5 7 3 33 ","","Tetrahedra",
"5","5 2 1 3 1 ","4 2 8 3 1 ","8 5 7 3 1 ","8 2 6 5 1 ",
"3 2 8 5 1 ","","End","" )
# creating an empty temporary mesh file
temp_mesh_file=tempfile(fileext = ".mesh")
# loading the file with data.
writeLines(pseudofile,temp_mesh_file)
# reading the mesh
my_mesh=read_mesh( meshfile=temp_mesh_file)
# see the bounding box of the volumetric mesh.
lapply(my_mesh$vertex,range)
# unliking the teporary file.
unlink(temp_mesh_file)
tetrascatt
Description
This function computes the volumetric backscattering from a mesh of tetrahedrons.
Usage
tetrascatt(parameters, freq, mesh, kversor)
Arguments
parameters |
a list including the parameters model, it must include
|
freq |
an array of frequencies where the scattering is computed. |
mesh |
a list representing the mesh, it must include
|
kversor |
A three component vector that indicates the direction of the incident plane wave. |
Value
List containing the frequencies, freq
, and their corresponding Target Strength values, ts
.
See Also
read_mesh
to get this kind of list from a .mesh file.
Examples
#########################################
### Set the Frequency range ########
#########################################
fmin=12
fmax=400
freqs= seq(fmin,fmax, by=1)
# for tetrascatt freq unities should be in Hz.
freq=freqs*1000
############################################################
########### Set properties of media and scatterer ######
############################################################
cw <- 1477.4 #soundspeed surrounding fluid (m/s)
rho <- 1026.8 #density surrounding fluid (kg/m^3)
g <- 1028.9/rho #density contrast
h <- 1480.3/cw #soundspeed contrast
my_parameters=list(cw=cw,g=g,h=h)
##########################################################
### Set the incident direction of the plane wave #####
##########################################################
kversor=c(1,0,0)
##########################################################
### Set the scatterer geometry #######################
##########################################################
# generates a pseudofile that has the mesh of cube of one meter
# side
pseudofile=c("MeshVersionFormatted 2",
"","Dimension 3","","Vertices","8","-0.5 -0.5 0.5 6 ",
"-0.5 -0.5 -0.5 7 ","-0.5 0.5 0.5 9 ","-0.5 0.5 -0.5 11 ",
"0.5 -0.5 0.5 16 ","0.5 -0.5 -0.5 17 ","0.5 0.5 0.5 19 ",
"0.5 0.5 -0.5 21 ","","Edges", "12","2 1 5 ","1 3 8 ",
"4 3 10 ","2 4 12 ","6 5 15 ","5 7 18 ","8 7 20 ","6 8 22 ",
"2 6 25 ","1 5 26 ","4 8 29 ","3 7 30 ","","Triangles",
"12","2 1 3 3 ","3 4 2 3 ","5 6 8 13 ","8 7 5 13 ",
"2 6 5 23 ","5 1 2 23 ","8 4 3 27 ","3 7 8 27 ","2 4 8 31 ",
"8 6 2 31 ","3 1 5 33 ","5 7 3 33 ","","Tetrahedra",
"5","5 2 1 3 1 ","4 2 8 3 1 ","8 5 7 3 1 ","8 2 6 5 1 ",
"3 2 8 5 1 ","","End","" )
# creating an empty temporary mesh file
temp_mesh_file=tempfile(fileext = ".mesh")
# loading the file with data.
writeLines(pseudofile,temp_mesh_file)
#reading the mesh
my_mesh=read_mesh( meshfile=temp_mesh_file)
# Computing the scattering
output= tetrascatt(parameters=my_parameters,freq,
mesh=my_mesh,kversor)
plot(output$freq,output$ts)
# unliking the teporary file.
unlink(temp_mesh_file)
tetrascatt_c
Description
Computes scattering from a volumetric mesh efficientlty, it is an auxiliary function called by tetrascatt function.
Usage
tetrascatt_c(cw, g, h, freq, Tet, Ver, kversor)
Arguments
cw |
sound speed in the water in m/s |
g |
density constrast value, i.e g= rho1/rhow, where rho1 and rhow are the density values of the stcatterer and the unbounded medium respectively |
h |
density sound speed constrast value i.e h= c1/cw, where c1 is the sound speed of the stcatterer |
freq |
an array of frequencies, where the scattering is computed. |
Tet |
a matrix containing the four index of each tetrahedron. |
Ver |
a matrix with the vertex of the tetrahedra, each vertex has to have three coordinates. |
kversor |
three component vector that indicates the direction of the incident plane wave. |
Value
A complex number array which contains the backward differential far-field scattering cross-section (f infinity) values at each frequency.