https://github.com/anowacki/cij.jl
CIJ.jl is a Julia package for dealing with linear elastic constants, particularly for geophysics problems
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.2%) to scientific vocabulary
Keywords
Repository
CIJ.jl is a Julia package for dealing with linear elastic constants, particularly for geophysics problems
Basic Info
- Host: GitHub
- Owner: anowacki
- License: other
- Language: Julia
- Default Branch: master
- Size: 514 KB
Statistics
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 4
- Releases: 0
Topics
Metadata Files
README.md
CIJ.jl
What is CIJ.jl?
A Julia package for dealing with linear elastic constants, with particular applicability to geophysics problems.
How to install
Although not registered as an official package, CIJ.jl can be added to your Julia install like so:
```julia julia> ] # Type ']' to enter pkg mode
(v1.6) pkg> add https://github.com/anowacki/CIJ.jl ```
You then need only do
julia
julia> import CIJ
and if that works, you're ready to go.
How to use
CIJ.jl, to make your life as easy as possible, does not insist on your using
a special type for elastic constants, but relies on them being AbstractArrays
of an elastic tensor's Voigt matrix.
The Voigt matrix is a 6 × 6 array representing the full
3 × 3 × 3 × 3 × tensor, subject to symmetries present
for linear elasticity.
Throughout CIJ.jl, we make no assumptions about the units of a matrix C,
but when it does matter (for instance, calculating phase velocities with
phase_vels()), then it is assumed you are dealing with density-normalised
constants (i.e., the units are m2 s-2), sometimes called
Aij instead. (This is the same as Pa/(kg m-3)),
Let's try out a simple example of what we can do:
```julia julia> C = zeros(6, 6);
julia> CIJ.is_stable(C) false ```
Here, the is_stable() function tells one whether a set of elastic constants
C is dynamically possible. It turns out, a material where all constants are
zero is not. Olivine, however, should be, so
```julia julia> C, rho = CIJ.ol(); # Return density-normalised constants, and density, for olivine
julia> is_stable(C) true ```
is not a surprise.
EC type
Whilst you can deal with plain Arrays, CIJ exports the EC type which is a
wrapper around a StaticArrays.MMatrix.
Calculations using this type are quicker. For instance, finding the compliance
matrix S from the stiffness matrix C is found by matrix inversion, and this
is about twice as fast when using ECs rather than plain Arrays.
ECs are mutable and can be treated just like any other 6 × 6 matrix,
including accessing and setting elements like C[i,j].
Construct an EC object by calling the EC() constructor:
julia
julia> EC([10i+j for i in 1:6, j in 1:6])
6×6 EC{Float64}:
11.0 12.0 13.0 14.0 15.0 16.0
12.0 22.0 23.0 24.0 25.0 26.0
13.0 23.0 33.0 34.0 35.0 36.0
14.0 24.0 34.0 44.0 45.0 46.0
15.0 25.0 35.0 45.0 55.0 56.0
16.0 26.0 36.0 46.0 56.0 66.0
Note that ECs are enforced to be symmetric, and will copy the upper half
of the input matrix into the bottom half. Subsequent modification of any
element will be reflected in both upper and lower halves automatically,
so ECs cannot be non-symmetric.
To specify the type of the elements T, use the parametric constructor,
EC{T}().
Calculating phase velocities
One of the common uses for the package is to compute the phase velocities in
a given direction through some elastic constants. This is done using the
phase_vels() function, which returns a NamedTuple, like so:
```julia julia> C, rho = CIJ.ol();
julia> az, inc = 20, 45; # Directions
julia> vp, vs1, vs2, pol, avs = CIJ.phase_vels(C, az, inc) (vp = 8590.639816324323, vs1 = 5422.968116295959, vs2 = 4602.70348828534, pol = -20.682503753509465, avs = 16.363285381017125) ```
vp, vs1 and vs2 and so on, are velocities in m s-1,
assuming C is in m2 s-2,
pol is the orientation of the fast shear wave in degrees, and avs is the
percentage shear wave anisotropy along this direction.
Converting to Voigt notation
If you have an 81-component tensor c, how do you get the Voigt matrix C?
julia
C = CIJ.cij(c)
And the other way?
julia
c = CIJ.cijkl(C)
Plotting
If you are using Julia v1.9 or later, and you have also loaded a
backend from the Makie.jl ecosystem (e.g.,
by doing import GLMakie, import CairoMakie, etc.), then you
can create plots of phase velocity surfaces by calling one of the
following functions:
CIJ.plot_hemispherefor a set of upper-hemisphere phase velocity surfaces;CIJ.plot_hemisphere!for a single surface into an existingMakie.PolarAxis;CIJ.plot_spherefor a 3D view of the phase velocity surface; andCIJ.plot_sphere!for a 3D view into an existingMakie.Axis3.
For example:
```julia julia> import GLMakie
julia> CIJ.plot_hemisphere(CIJ.ol()[1]) ```

julia
julia> CIJ.plot_sphere(CIJ.ol()[1], :avs)

Getting help
Functions are documented, so at the REPL type ? to get a help?> prompt,
and type the name of the function:
```julia help?> CIJ.phase_vels
phase_vels(C, az, inc) -> vp, vs1, vs2, pol, avs
Calculate the phase velocities for the 6x6 elasticity matrix C along the direction (az, inc), in degrees, and return P-wave velocity vp, the fast and slow shear wave velocities, vs1 and vs2, the polarisation of the fast shear wave pol, and the shear wave velocity anisotropy, avs. Velocities are in m/s if the tensor C is in m^2/s^2 (i.e., is a density-normalised tensor, sometimes called A).
az is the azimuth in degrees measured from the x1 towards to -x2 axis.
inc is the inclination in degrees from the x1-x2 plane towards the x3 axis. ```
Other software
- If you use MATLAB, then you should use MSAT.
- If you use Fortran, then you should investigate the module
anisotropy_ajnwhich is in the seismo-fortran repo.
Why the name?
Linear elastic constants are a fourth-rank tensor, relating the stress σ in a material to the strain ε with the relationship
σij = cijkl εkl,
where i, j, k and l are indices taking values 1 to 3 and representing the three cartesian directions in space. This leads to there being 3 × 3× 3 × 3 = 81 numbers in the tensor c, which is somewhat unwieldy.
However, certain symmetries mean one can reduce this to 21, and represent the 4-tensor with a symmetric 2-tensor or matrix instead; the so-called 'Voigt notation'. Typically, the lowercase 4-tensor cijkl becomes the uppercase matrix Cij, and thus the package is born.
Acknowledgments
Credit goes to James Wookey and Mike Kendall for the original set of Fortran routines on which the code is based, and which lives on in the seismo-fortran repo.
Owner
- Name: Andy Nowacki
- Login: anowacki
- Kind: user
- Website: http://homepages.see.leeds.ac.uk/~earanow/
- Repositories: 57
- Profile: https://github.com/anowacki
Lecturer at the School of Earth and Environment, University of Leeds, studying the Earth's deep interior.
GitHub Events
Total
- Delete event: 3
- Issue comment event: 1
- Push event: 5
- Pull request event: 9
- Create event: 4
Last Year
- Delete event: 3
- Issue comment event: 1
- Push event: 5
- Pull request event: 9
- Create event: 4
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 1
- Total pull requests: 17
- Average time to close issues: N/A
- Average time to close pull requests: 3 days
- Total issue authors: 1
- Total pull request authors: 4
- Average comments per issue: 0.0
- Average comments per pull request: 0.12
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 12
Past Year
- Issues: 0
- Pull requests: 6
- Average time to close issues: N/A
- Average time to close pull requests: 8 days
- Issue authors: 0
- Pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.17
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 6
Top Authors
Issue Authors
- anowacki (1)
Pull Request Authors
- dependabot[bot] (11)
- github-actions[bot] (7)
- anowacki (7)
- JuliaTagBot (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/cache v1 composite
- actions/checkout v2 composite
- codecov/codecov-action v1 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite