![]() |
MechSys
1.0
Computing library for simulations in continuum and discrete mechanics
|
#include <iostream>
#include <sstream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <blitz/tinyvec-et.h>
#include <blitz/tinymat.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_eigen.h>
#include <mechsys/util/fatal.h>
#include <mechsys/util/util.h>
#include <mechsys/util/array.h>
#include <mechsys/linalg/vector.h>
#include <mechsys/linalg/matrix.h>
#include <mechsys/linalg/laexpr.h>
Go to the source code of this file.
Namespaces | |
namespace | OrthoSys |
Orthogonal Cartesian system. | |
Typedefs | |
typedef LinAlg::Vector< double > | Vec_t |
typedef LinAlg::Matrix< double > | Mat_t |
typedef blitz::TinyMatrix < double, 3, 3 > | Mat3_t |
typedef blitz::TinyVector < double, 3 > | Vec3_t |
typedef blitz::TinyVector < size_t, 3 > | iVec3_t |
typedef blitz::TinyVector < bool, 3 > | bVec3_t |
typedef blitz::TinyVector < double, 9 > | ATensor2 |
Assymmetric 2nd order tensor: for deformation gradient (F), velocity gradient (l), ... | |
Functions | |
void | dgetrf_ (const int *m, const int *n, double *a, const int *lda, int *ipiv, int *info) |
void | dgetri_ (const int *n, double *a, const int *lda, int *ipiv, double *work, const int *lwork, int *info) |
void | dgesvd_ (const char *jobu, const char *jobvt, const int *M, const int *N, double *A, const int *lda, double *S, double *U, const int *ldu, double *VT, const int *ldvt, double *work, const int *lwork, const int *info) |
void | dgesv_ (int *Np, int *NRHSp, double *A, int *LDAp, int *IPIVp, double *B, int *LDBp, int *INFOp) |
double | dot (Vec_t const &V, Vec_t const &W) |
size_t | size (Vec_t const &V) |
void | set_to_zero (Vec_t &V) |
void | set_to_zero (Mat_t &M) |
size_t | num_rows (Vec_t const &V) |
size_t | num_rows (Mat_t const &M) |
size_t | num_cols (Mat_t const &M) |
String | PrintVector (Vec_t const &V, char const *Fmt="%13g", Array< long > const *SkipR=NULL, double Tol=1.0e-13) |
String | PrintMatrix (Mat_t const &M, char const *Fmt="%13g", Array< long > const *SkipRC=NULL, double Tol=1.0e-13, bool NumPy=false) |
void | WriteSMAT (Mat_t const &M, char const *FileKey, double Tol=1.0e-14) |
double | CompareVectors (Vec_t const &A, Vec_t const &B) |
double | CompareMatrices (Mat_t const &A, Mat_t const &B) |
double | CheckDiagonal (Mat_t const &M, bool CheckUnitDiag=false) |
double | Det (Mat_t const &M) |
void | Identity (size_t NRows, Mat_t &I) |
void | Svd (Mat_t const &M, Mat_t &U, Vec_t &S, Mat_t &Vt) |
void | Inv (Mat_t const &M, Mat_t &Mi, double Tol=1.0e-10) |
void | Sol (Mat_t &M, Vec_t &X) |
void | Sol (Mat_t const &M, Vec_t const &B, Vec_t &X) |
double | Norm (Vec_t const &V) |
void | Dyad (Vec_t const &A, Vec_t const &B, Mat_t &M) |
void | Mult (Vec_t const &A, Mat_t const &M, Vec_t &B) |
void | Vec2ColMat (Vec_t const &V, Mat_t &M) |
void | Eig (Mat_t &M, Vec_t &L, Mat_t *Q=NULL, bool Qtrans=false) |
String | PrintVector (Vec3_t const &V, char const *Fmt="%13g", double Tol=1.0e-13) |
String | PrintMatrix (Mat3_t const &M, char const *Fmt="%13g", double Tol=1.0e-13) |
double | CompareVectors (Vec3_t const &A, Vec3_t const &B) |
double | CompareMatrices (Mat3_t const &A, Mat3_t const &B) |
void | Trans (Mat3_t const &M, Mat3_t &Mt) |
double | Det (Mat3_t const &M) |
void | Identity (Mat3_t &I) |
void | Inv (Mat3_t const &M, Mat3_t &Mi, double Tol=1.0e-10) |
void | Sol (Mat3_t const &M, Vec3_t const &B, Vec3_t &X, double Tol=1.0e-10) |
void | Eig (Mat3_t &M, Vec3_t &L) |
void | Eig (Mat3_t &M, Vec3_t &L, Vec3_t &V0, Vec3_t &V1, Vec3_t &V2, bool SortAsc=false, bool SortDesc=false) |
double | Norm (Vec3_t const &V) |
void | Dyad (Vec3_t const &A, Vec3_t const &B, Mat3_t &M) |
void | Dyad (double s, Vec3_t const &A, Vec3_t const &B, Mat3_t &M) |
void | Mult (Vec3_t const &A, Mat3_t const &M, Vec3_t &B) |
void | Mult (Mat3_t const &A, Mat3_t const &B, Mat3_t &M) |
void | set_to_zero (Vec3_t &V) |
void | set_to_zero (Mat3_t &M) |
int | OrthoSys::__init_ortho_sys () |
void | Ten2Mat (Vec_t const &Ten, Mat3_t &Mat) |
void | Ten2Mat (Vec_t const &Ten, Mat_t &Mat) |
void | Mat2Ten (Mat3_t const &Mat, Vec_t &Ten, size_t NumComponents, bool CheckSymmetry=true, double Tol=1.0e-10) |
void | UnitVecDeriv (Vec_t const &n, Vec_t &nu, Mat_t &dnudn, double Tol=1.0e-8) |
void | UnitVecDeriv (Vec3_t const &n, Vec3_t &nu, Mat3_t &dnudn, double Tol=1.0e-8) |
void | Sym (double a, ATensor2 const &T, size_t NCp, Vec_t &S) |
void | Dot (ATensor2 const &A, ATensor2 const &B, ATensor2 &C) |
void | AddSkewTimesOp1 (ATensor2 const &L, Vec_t const &S, Vec_t &R, double Tol=1.0e-14) |
double | Det (ATensor2 const &F) |
void | CalcLCauchyGreen (ATensor2 const &F, size_t NCp, Vec_t &b, double Tol=1.0e-14) |
void | Mult (Vec_t const &Sig, Vec3_t const &n, Vec3_t &t) |
void | Dev (Vec_t const &Ten, Vec_t &DevTen) |
double | Tra (Vec_t const &Ten) |
void | Pow2 (Vec_t const &Ten, Vec_t &Ten2) |
double | Det (Vec_t const &Ten) |
void | Inv (Vec_t const &T, Vec_t &Ti, double Tol=1.0e-10) |
void | CharInvs (Vec_t const &Ten, double &I1, double &I2, double &I3) |
void | CharInvs (Vec_t const &Ten, double &I1, double &I2, double &I3, Vec_t &dI1dTen, Vec_t &dI2dTen, Vec_t &dI3dTen) |
void | DerivInv (Vec_t const &A, Vec_t &Ai, Mat_t &dInvA_dA, double Tol=1.0e-10) |
void | Eig (Vec_t const &Ten, Vec3_t &L, Vec3_t &V0, Vec3_t &V1, Vec3_t &V2, bool SortAsc=false, bool SortDesc=false) |
void | EigenProj (Vec_t const &Ten, Vec3_t &L, Vec3_t &v0, Vec3_t &v1, Vec3_t &v2, Vec_t &P0, Vec_t &P1, Vec_t &P2, bool SortAsc=false, bool SortDesc=false) |
void | EigenProjAnalytic (Vec_t const &Ten, Vec3_t &L, Vec_t &P0, Vec_t &P1, Vec_t &P2) |
void | Calc_I (size_t NCp, Vec_t &I) |
void | Calc_IIsym (size_t NCp, Mat_t &IIsym) |
void | Calc_IdyI (size_t NCp, Mat_t &IdyI) |
void | Calc_Psd (size_t NCp, Mat_t &Psd) |
void | Calc_Piso (size_t NCp, Mat_t &Piso) |
void | EigenProjDerivs (Vec_t const &A, Vec3_t &L, Vec3_t &v0, Vec3_t &v1, Vec3_t &v2, Vec_t &P0, Vec_t &P1, Vec_t &P2, Mat_t &dP0dA, Mat_t &dP1dA, Mat_t &dP2dA, double Pertubation=1.0e-7, double Tol=1.0e-14, bool SortAsc=false, bool SortDesc=false) |
double | Calc_pcam (Vec_t const &Sig) |
double | Calc_ev (Vec_t const &Eps) |
double | Calc_qcam (Vec_t const &Sig) |
double | Calc_ed (Vec_t const &Eps) |
double | Calc_poct (Vec_t const &Sig) |
double | Calc_evoct (Vec_t const &Eps) |
double | Calc_qoct (Vec_t const &Sig) |
double | Calc_edoct (Vec_t const &Eps) |
void | Calc_pqoct (Vec_t const &Sig, double &p, double &q) |
void | OctInvs (Vec_t const &Sig, double &p, double &q, double &t, double qTol=1.0e-8) |
void | OctInvs (Vec_t const &Sig, double &p, double &q, Vec_t &s, double qTol=1.0e-8, bool ApplyPertub=false) |
void | OctInvs (Vec_t const &Sig, double &p, double &q, double &t, double &th, Vec_t &s, double qTol=1.0e-8, Vec_t *dthdSig=NULL, bool ApplyPertub=false) |
void | OctInvs (Vec3_t const &L, double &p, double &q, double &t, double qTol=1.0e-8) |
void | OctInvs (Vec3_t const &L, double &p, double &q, double &t, Vec3_t &dpdL, Vec3_t &dqdL, Vec3_t &dtdL, double qTol=1.0e-8) |
void | pqth2L (double p, double q, double th, Vec3_t &L, char const *Type="oct") |
void | OctDerivs (Vec3_t const &L, double &p, double &q, double &t, Mat3_t &dpqthdL, double qTol=1.0e-8) |
void | InvOctDerivs (Vec3_t const &Lsorted, double &p, double &q, double &t, Mat3_t &dLdpqth, double qTol=1.0e-8) |
double | Phi2M (double Phi, char const *Type="oct") |
double | M2Phi (double M, char const *Type="oct") |
double | Calc_K (double E, double nu) |
double | Calc_G (double E, double nu) |
double | Calc_lam (double E, double nu) |
double | Calc_G_ (double K, double nu) |
double | Calc_E (double K, double G) |
double | Calc_E_ (double K, double nu) |
double | Calc_nu (double K, double G) |
Variables | |
Vec3_t | OrthoSys::O |
Origin. | |
Vec3_t | OrthoSys::e0 |
Vec3_t | OrthoSys::e1 |
Vec3_t | OrthoSys::e2 |
Basis. | |
Mat3_t | OrthoSys::I |
Identity. | |
int | OrthoSys::__dummy_init_ortho_sys = __init_ortho_sys() |
typedef blitz::TinyVector<double,9> ATensor2 |
Assymmetric 2nd order tensor: for deformation gradient (F), velocity gradient (l), ...
typedef blitz::TinyVector<bool,3> bVec3_t |
typedef blitz::TinyVector<size_t,3> iVec3_t |
typedef blitz::TinyMatrix<double,3,3> Mat3_t |
3x3 Matrix.
typedef LinAlg::Matrix<double> Mat_t |
typedef blitz::TinyVector<double,3> Vec3_t |
3x1 Vector.
typedef LinAlg::Vector<double> Vec_t |
void AddSkewTimesOp1 | ( | ATensor2 const & | L, |
Vec_t const & | S, | ||
Vec_t & | R, | ||
double | Tol = 1.0e-14 |
||
) | [inline] |
Add R to operation involving skew and symm tensors: R += w*S - S*w, in which w = skew(L) = 0.5*(L-L^T).
double Calc_E | ( | double | K, |
double | G | ||
) | [inline] |
Calculate E given K and G.
double Calc_E_ | ( | double | K, |
double | nu | ||
) | [inline] |
Calculate E given K and nu.
double Calc_edoct | ( | Vec_t const & | Eps | ) | [inline] |
double Calc_evoct | ( | Vec_t const & | Eps | ) | [inline] |
double Calc_G | ( | double | E, |
double | nu | ||
) | [inline] |
Calculate G given E and nu.
double Calc_G_ | ( | double | K, |
double | nu | ||
) | [inline] |
Calculate G given K and nu.
void Calc_IIsym | ( | size_t | NCp, |
Mat_t & | IIsym | ||
) | [inline] |
Initialize fourth order identity tensor.
double Calc_K | ( | double | E, |
double | nu | ||
) | [inline] |
Calculate K given E and nu.
double Calc_lam | ( | double | E, |
double | nu | ||
) | [inline] |
Calculate lam given E and nu.
double Calc_nu | ( | double | K, |
double | G | ||
) | [inline] |
Calculate nu given K and G.
Derivatives of the eigenvectors of Sig w.r.t Sig (a third order tensor). NOTE: the eigevalues and eigenvectors must be given as input.
void Calc_pqoct | ( | Vec_t const & | Sig, |
double & | p, | ||
double & | q | ||
) | [inline] |
Initialize fourth order symmetric-deviatoric tensor.
void CalcLCauchyGreen | ( | ATensor2 const & | F, |
size_t | NCp, | ||
Vec_t & | b, | ||
double | Tol = 1.0e-14 |
||
) | [inline] |
Calculate left Cauchy-Green tensor: b = F*F^T.
Characteristic invariants of 2nd order symmetric tensor Ten.
void CharInvs | ( | Vec_t const & | Ten, |
double & | I1, | ||
double & | I2, | ||
double & | I3, | ||
Vec_t & | dI1dTen, | ||
Vec_t & | dI2dTen, | ||
Vec_t & | dI3dTen | ||
) | [inline] |
Characteristic invariants of 2nd order symmetric tensor Ten and their derivatives.
double CheckDiagonal | ( | Mat_t const & | M, |
bool | CheckUnitDiag = false |
||
) | [inline] |
Check if matrix is diagonal.
double CompareMatrices | ( | Mat_t const & | A, |
Mat_t const & | B | ||
) | [inline] |
Compare two matrices.
double CompareMatrices | ( | Mat3_t const & | A, |
Mat3_t const & | B | ||
) | [inline] |
Compare two matrices.
double CompareVectors | ( | Vec_t const & | A, |
Vec_t const & | B | ||
) | [inline] |
Compare two vectors.
double CompareVectors | ( | Vec3_t const & | A, |
Vec3_t const & | B | ||
) | [inline] |
Compare two vectors.
Derivative of the Inverse of A w.r.t A.
void dgesv_ | ( | int * | Np, |
int * | NRHSp, | ||
double * | A, | ||
int * | LDAp, | ||
int * | IPIVp, | ||
double * | B, | ||
int * | LDBp, | ||
int * | INFOp | ||
) |
void dgesvd_ | ( | const char * | jobu, |
const char * | jobvt, | ||
const int * | M, | ||
const int * | N, | ||
double * | A, | ||
const int * | lda, | ||
double * | S, | ||
double * | U, | ||
const int * | ldu, | ||
double * | VT, | ||
const int * | ldvt, | ||
double * | work, | ||
const int * | lwork, | ||
const int * | info | ||
) |
void dgetrf_ | ( | const int * | m, |
const int * | n, | ||
double * | a, | ||
const int * | lda, | ||
int * | ipiv, | ||
int * | info | ||
) |
void dgetri_ | ( | const int * | n, |
double * | a, | ||
const int * | lda, | ||
int * | ipiv, | ||
double * | work, | ||
const int * | lwork, | ||
int * | info | ||
) |
Dot product: C=A*B => C(i,j)=A(i,k)*B(k,j)
Dyadic product multiplied by s.
Eigenvalues of symmetric matrix. NOTE: This function changes the matrix M.
void Eig | ( | Mat3_t & | M, |
Vec3_t & | L, | ||
Vec3_t & | V0, | ||
Vec3_t & | V1, | ||
Vec3_t & | V2, | ||
bool | SortAsc = false , |
||
bool | SortDesc = false |
||
) | [inline] |
Eigenvalues and eigenvectors. NOTE: This function changes the matrix M.
void Eig | ( | Vec_t const & | Ten, |
Vec3_t & | L, | ||
Vec3_t & | V0, | ||
Vec3_t & | V1, | ||
Vec3_t & | V2, | ||
bool | SortAsc = false , |
||
bool | SortDesc = false |
||
) | [inline] |
Eigenvalues and eigenvectors of second order tensor in Mandel's basis.
void EigenProj | ( | Vec_t const & | Ten, |
Vec3_t & | L, | ||
Vec3_t & | v0, | ||
Vec3_t & | v1, | ||
Vec3_t & | v2, | ||
Vec_t & | P0, | ||
Vec_t & | P1, | ||
Vec_t & | P2, | ||
bool | SortAsc = false , |
||
bool | SortDesc = false |
||
) | [inline] |
Eigenprojectors of 2nd order symmetric tensor Ten.
void EigenProjAnalytic | ( | Vec_t const & | Ten, |
Vec3_t & | L, | ||
Vec_t & | P0, | ||
Vec_t & | P1, | ||
Vec_t & | P2 | ||
) | [inline] |
Eigenprojectors of 2nd order symmetric tensor Ten.
void EigenProjDerivs | ( | Vec_t const & | A, |
Vec3_t & | L, | ||
Vec3_t & | v0, | ||
Vec3_t & | v1, | ||
Vec3_t & | v2, | ||
Vec_t & | P0, | ||
Vec_t & | P1, | ||
Vec_t & | P2, | ||
Mat_t & | dP0dA, | ||
Mat_t & | dP1dA, | ||
Mat_t & | dP2dA, | ||
double | Pertubation = 1.0e-7 , |
||
double | Tol = 1.0e-14 , |
||
bool | SortAsc = false , |
||
bool | SortDesc = false |
||
) | [inline] |
Derivatives of the eigenprojectors w.r.t its defining tensor.
Inverse of 2nd order symmetric tensor T.
void InvOctDerivs | ( | Vec3_t const & | Lsorted, |
double & | p, | ||
double & | q, | ||
double & | t, | ||
Mat3_t & | dLdpqth, | ||
double | qTol = 1.0e-8 |
||
) | [inline] |
double M2Phi | ( | double | M, |
char const * | Type = "oct" |
||
) | [inline] |
Calculate phi (friction angle at compression (degrees)) given M (max q/p at compression).
void Mat2Ten | ( | Mat3_t const & | Mat, |
Vec_t & | Ten, | ||
size_t | NumComponents, | ||
bool | CheckSymmetry = true , |
||
double | Tol = 1.0e-10 |
||
) | [inline] |
Creates a 2nd order symmetric tensor Ten (using Mandel's representation) based on its matrix components.
Left multiplication. {B} = {A}*[M]. NOTE: this is not efficient for large matrices.
Left multiplication. {B} = {A}^T*[M].
Multiplication of tensor's matrix by a vector (similar to Cauchy's rule). {t} = [Sig]*{n}.
void OctDerivs | ( | Vec3_t const & | L, |
double & | p, | ||
double & | q, | ||
double & | t, | ||
Mat3_t & | dpqthdL, | ||
double | qTol = 1.0e-8 |
||
) | [inline] |
void OctInvs | ( | Vec_t const & | Sig, |
double & | p, | ||
double & | q, | ||
double & | t, | ||
double | qTol = 1.0e-8 |
||
) | [inline] |
Octahedral invariants of Sig.
void OctInvs | ( | Vec_t const & | Sig, |
double & | p, | ||
double & | q, | ||
Vec_t & | s, | ||
double | qTol = 1.0e-8 , |
||
bool | ApplyPertub = false |
||
) | [inline] |
Octahedral invariants of Sig (and deviator s).
void OctInvs | ( | Vec_t const & | Sig, |
double & | p, | ||
double & | q, | ||
double & | t, | ||
double & | th, | ||
Vec_t & | s, | ||
double | qTol = 1.0e-8 , |
||
Vec_t * | dthdSig = NULL , |
||
bool | ApplyPertub = false |
||
) | [inline] |
Octahedral invariants of Sig (and derivatives).
void OctInvs | ( | Vec3_t const & | L, |
double & | p, | ||
double & | q, | ||
double & | t, | ||
double | qTol = 1.0e-8 |
||
) | [inline] |
Octahedral invariants of Sig (L = principal values).
void OctInvs | ( | Vec3_t const & | L, |
double & | p, | ||
double & | q, | ||
double & | t, | ||
Vec3_t & | dpdL, | ||
Vec3_t & | dqdL, | ||
Vec3_t & | dtdL, | ||
double | qTol = 1.0e-8 |
||
) | [inline] |
Octahedral invariants of Sig (L = principal values). With derivatives
double Phi2M | ( | double | Phi, |
char const * | Type = "oct" |
||
) | [inline] |
Calculate M = max q/p at compression (phi: friction angle at compression (degrees)).
2nd order symmetric tensor Ten raised to the power of 2.
Calc principal values given octahedral invariants. (-pi <= th(rad) <= pi)
String PrintMatrix | ( | Mat_t const & | M, |
char const * | Fmt = "%13g" , |
||
Array< long > const * | SkipRC = NULL , |
||
double | Tol = 1.0e-13 , |
||
bool | NumPy = false |
||
) | [inline] |
Print matrix.
String PrintMatrix | ( | Mat3_t const & | M, |
char const * | Fmt = "%13g" , |
||
double | Tol = 1.0e-13 |
||
) | [inline] |
Print matrix.
String PrintVector | ( | Vec_t const & | V, |
char const * | Fmt = "%13g" , |
||
Array< long > const * | SkipR = NULL , |
||
double | Tol = 1.0e-13 |
||
) | [inline] |
Print vector.
String PrintVector | ( | Vec3_t const & | V, |
char const * | Fmt = "%13g" , |
||
double | Tol = 1.0e-13 |
||
) | [inline] |
Print vector.
void set_to_zero | ( | Vec_t & | V | ) | [inline] |
void set_to_zero | ( | Mat_t & | M | ) | [inline] |
void set_to_zero | ( | Vec3_t & | V | ) | [inline] |
Clear vector.
void set_to_zero | ( | Mat3_t & | M | ) | [inline] |
Clear matrix.
Linear Solver. {X} = [M]^{-1}{X} (M is lost) (X initially has the contents of the right-hand side)
Linear Solver. {X} = [M]^{-1}{B}
Singular value decomposition. M = U_mxm * D_mxn * Vt_nxn
Symmetric part of a tensor multiplied by a. S = a*sym(T) = a * 0.5*(T + trn(T)).
Creates the matrix representation of 2nd order symmetric tensor Ten (Mandel's representation).
(TinyMatrix) Creates the matrix representation of 2nd order symmetric tensor Ten (Mandel's representation).
void UnitVecDeriv | ( | Vec_t const & | n, |
Vec_t & | nu, | ||
Mat_t & | dnudn, | ||
double | Tol = 1.0e-8 |
||
) | [inline] |
Derivative of unit vector.
void UnitVecDeriv | ( | Vec3_t const & | n, |
Vec3_t & | nu, | ||
Mat3_t & | dnudn, | ||
double | Tol = 1.0e-8 |
||
) | [inline] |
Derivative of unit vector.
void Vec2ColMat | ( | Vec_t const & | V, |
Mat_t & | M | ||
) | [inline] |
Create column matrix from vector.