tsr

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Gosl. tsr. Tensors

go.dev reference

More information is available in the documentation of this package.

Package tsr implements structures and algorithms for Tensor Algebra and Calculus.

White papers

  1. Tensor Algebra, Calculus, and Definitions

TODO

  1. Add more tests for symmetric 4th order tensors
  2. Re-Implement computation of eigenvalues and eigenprojectors

Documentation

Overview

Package tsr implements Tensors using the smart approach by considering the Mandel's basis

Index

Constants

This section is empty.

Variables

View Source
var (

	// SecToManI converts i-j-indices of 3x3 2nd order (symmetric) tensor to I-index in Mandel's representation
	SecToManI = [][]int{
		{0, 3, 5},
		{3, 1, 4},
		{5, 4, 2},
	}

	// SecToVecI converts i-j-indices of 3x3 2nd order (symmetric) tensor to I-index in vector representation
	SecToVecI = [][]int{
		{0, 3, 5},
		{6, 1, 4},
		{8, 7, 2},
	}

	// FouToManI converts i-j-k-l-indices of 3x3x3x3 4th order (full-symmetric) tensor to I-index in Mandel's representation
	FouToManI = [][][][]int{
		{
			{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
			{{3, 3, 3}, {3, 3, 3}, {3, 3, 3}},
			{{5, 5, 5}, {5, 5, 5}, {5, 5, 5}},
		},
		{
			{{3, 3, 3}, {3, 3, 3}, {3, 3, 3}},
			{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}},
			{{4, 4, 4}, {4, 4, 4}, {4, 4, 4}},
		},
		{
			{{5, 5, 5}, {5, 5, 5}, {5, 5, 5}},
			{{4, 4, 4}, {4, 4, 4}, {4, 4, 4}},
			{{2, 2, 2}, {2, 2, 2}, {2, 2, 2}},
		},
	}

	// FouToManJ converts i-j-k-l-indices of 3x3x3x3 4th order (full-symmetric) tensor to J-index in Mandel's representation
	FouToManJ = [][][][]int{
		{
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
		},
		{
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
		},
		{
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
			{{0, 3, 5}, {3, 1, 4}, {5, 4, 2}},
		},
	}

	// FouToVecI converts i-j-k-l-indices of 3x3x3x3 4th order tensor to I-index in Vector representation
	FouToVecI = [][][][]int{
		{
			{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
			{{3, 3, 3}, {3, 3, 3}, {3, 3, 3}},
			{{5, 5, 5}, {5, 5, 5}, {5, 5, 5}},
		},
		{
			{{6, 6, 6}, {6, 6, 6}, {6, 6, 6}},
			{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}},
			{{4, 4, 4}, {4, 4, 4}, {4, 4, 4}},
		},
		{
			{{8, 8, 8}, {8, 8, 8}, {8, 8, 8}},
			{{7, 7, 7}, {7, 7, 7}, {7, 7, 7}},
			{{2, 2, 2}, {2, 2, 2}, {2, 2, 2}},
		},
	}

	// FouToVecJ converts i-j-k-l-indices of 3x3x3x3 4th order tensor to J-index in Vector representation
	FouToVecJ = [][][][]int{
		{
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
		},
		{
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
		},
		{
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
			{{0, 3, 5}, {6, 1, 4}, {8, 7, 2}},
		},
	}

	// ManToSecI converts I-index in Mandel's representation to i-index of 3x3 2nd order tensor
	ManToSecI = []int{0, 1, 2, 0, 1, 0}

	// ManToSecJ converts I-index in Mandel's representation to j-index of 3x3 2nd order tensor
	ManToSecJ = []int{0, 1, 2, 1, 2, 2}

	// SecIdenMan is the 3x3 2nd order identity tensor in Mandel's representation
	SecIdenMan = []float64{1, 1, 1, 0, 0, 0}

	// FouIdenMan is the 4th order identity tensor (symmetric) in Mandel's representation
	FouIdenMan = [][]float64{
		{1, 0, 0, 0, 0, 0},
		{0, 1, 0, 0, 0, 0},
		{0, 0, 1, 0, 0, 0},
		{0, 0, 0, 1, 0, 0},
		{0, 0, 0, 0, 1, 0},
		{0, 0, 0, 0, 0, 1},
	}

	// FouPsdMan is the 4th order symmetric-deviatoric projector (3D) in Mandel's representation
	FouPsdMan = [][]float64{
		{+ttrd, -otrd, -otrd, 0, 0, 0},
		{-otrd, +ttrd, -otrd, 0, 0, 0},
		{-otrd, -otrd, +ttrd, 0, 0, 0},
		{0, 0, 0, 1, 0, 0},
		{0, 0, 0, 0, 1, 0},
		{0, 0, 0, 0, 0, 1},
	}

	// FouPisoMan is the 4th order isotropic projector (3D) in Mandel's representation
	FouPisoMan = [][]float64{
		{otrd, otrd, otrd, 0, 0, 0},
		{otrd, otrd, otrd, 0, 0, 0},
		{otrd, otrd, otrd, 0, 0, 0},
		{0, 0, 0, 0, 0, 0},
		{0, 0, 0, 0, 0, 0},
		{0, 0, 0, 0, 0, 0},
	}

	// IdenMat9x9 is the identity matrix with rows up to 9
	IdenMat9x9 = [][]float64{
		{1, 0, 0, 0, 0, 0, 0, 0, 0},
		{0, 1, 0, 0, 0, 0, 0, 0, 0},
		{0, 0, 1, 0, 0, 0, 0, 0, 0},
		{0, 0, 0, 1, 0, 0, 0, 0, 0},
		{0, 0, 0, 0, 1, 0, 0, 0, 0},
		{0, 0, 0, 0, 0, 1, 0, 0, 0},
		{0, 0, 0, 0, 0, 0, 1, 0, 0},
		{0, 0, 0, 0, 0, 0, 0, 1, 0},
		{0, 0, 0, 0, 0, 0, 0, 0, 1},
	}
)

Functions

This section is empty.

Types

type Tensor2 added in v1.1.0

type Tensor2 struct {
	// contains filtered or unexported fields
}

Tensor2 holds the (Orthonormal/Cartesian) components of a 2nd order tensor, symmetric or not

func NewTensor2 added in v1.1.0

func NewTensor2(symmetric, twoD bool) (o *Tensor2)

NewTensor2 returns a new Tensor2 object NOTE: if !symmetric all components are used and twoD flag is ignored

func (*Tensor2) Get added in v1.1.0

func (o *Tensor2) Get(i, j int) (value float64)

Get returns the Orthonormal/Cartesian component [i,j]

func (*Tensor2) Set added in v1.1.0

func (o *Tensor2) Set(i, j int, value float64)

Set sets component [i,j] with it's Orthonormal/Cartesian value

type Tensor4 added in v1.1.0

type Tensor4 struct {
	// contains filtered or unexported fields
}

Tensor4 holds the (Orthonormal/Cartesian) components of a 4th order tensor, full-symmetric or not. NOTE: "full-symmetric" hear means major and minor symmetry, where:

A[i][j][k][l] = A[j][i][k][l] = A[i][j][l][k]
i.e. [i][j] and [k][l] can be swapped

func NewTensor4 added in v1.1.0

func NewTensor4(symmetric, twoD bool) (o *Tensor4)

NewTensor4 returns a new Tensor4 object NOTE: if !symmetric all components are used and twoD flag is ignored

func (*Tensor4) Get added in v1.1.0

func (o *Tensor4) Get(i, j, k, l int) (value float64)

Get returns the Orthonormal/Cartesian component [i,j]

func (*Tensor4) Set added in v1.1.0

func (o *Tensor4) Set(i, j, k, l int, value float64)

Set sets component [i,j] with it's Orthonormal/Cartesian value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL