Skip to content

Commit

Permalink
Enhance function api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
adtzlr committed Sep 27, 2023
1 parent 629859d commit 79f01a9
Show file tree
Hide file tree
Showing 18 changed files with 54 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docs/api/functions/asabqarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: As Abaqus Array
layout: page
nav_order: 3
parent: Functions
grandparent: API Reference
grand_parent: API Reference
---

## As Abaqus Array
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/asarray.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## As Array

**Description:** Convert Tensor to Array. This is useful to export results back to the code which is not using the tensor toolbox. This function is very useful because Fortran does not allow access to Tensor components of a function result `s = (dev(S*C)*inv(C))%ab`. Instead this function can be used. If you use Abaqus please use `asabqarray` to export Tensor components.
Convert Tensor to Array. This is useful to export results back to the code which is not using the tensor toolbox. This function is very useful because Fortran does not allow access to Tensor components of a function result `s = (dev(S*C)*inv(C))%ab`. Instead this function can be used. If you use Abaqus please use `asabqarray` to export Tensor components.

`asarray` is called with one (rank 2) or two (rank 4) integers to slice dimensions. This is useful if an axisymmetric analysis is evaluated (3 direct and 1 shear components = 4x4 tangent matrix instead of full 6x6 storage).

Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/astensor.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## As Tensor

**Description:** Converts a `Tensor2s` or `Tensor4s` data type to a full tensor storage `Tensor2` or `Tensor4`.
Converts a `Tensor2s` or `Tensor4s` data type to a full tensor storage `Tensor2` or `Tensor4`.

Possible calls:
- `astensor(T)`
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/asvoigt.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## As Voigt

**Description:** Converts a `Tensor2` or `Tensor4` data type to a reduced Voigt-storage `Tensor2s` or `Tensor4s`.
Converts a `Tensor2` or `Tensor4` data type to a reduced Voigt-storage `Tensor2s` or `Tensor4s`.

Possible calls:
- asvoigt(T)
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/determinant.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Determinant

**Description:** Determinant of a rank 2 Tensor.
Determinant of a rank 2 Tensor.

| Property | Value |
| --- | --- |
Expand Down
8 changes: 6 additions & 2 deletions docs/api/functions/deviator.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ grand_parent: API Reference

## Deviator

**Description:** Deviator of a rank 2 Tensor.
Deviator of a rank 2 Tensor.

<a href="https://www.codecogs.com/eqnedit.php?latex=\text{dev}(\mathbf{C})&space;=&space;\mathbf{C}&space;-&space;\frac{\text{tr}(\mathbf{C})}{3}&space;\mathbf{1}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\text{dev}(\mathbf{C})&space;=&space;\mathbf{C}&space;-&space;\frac{\text{tr}(\mathbf{C})}{3}&space;\mathbf{1}" title="\text{dev}(\mathbf{C}) = \mathbf{C} - \frac{\text{tr}(\mathbf{C})}{3} \mathbf{1}" /></a>
$$
\begin{equation}
\text{dev}(\mathbf{C}) = \mathbf{C} - \frac{\text{tr}(\mathbf{C})}{3} \mathbf{1}
\end{equation}
$$

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Identity

**Description:** Calculate the identity tensor. Two functions for generating identities are implemented:
Calculate the identity tensor. Two functions for generating identities are implemented:

- `Eye = identity2(C)` calculate Eye with the same tensor data type as C. The components of C are ignored.
- `I4 = identity4(Eye)` calculate the symmetric fourth order identity tensor with the property `C = I4 : C`
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/inverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Inverse

**Description:** Inverse of a positive definite rank 2 Tensor (Determinant > 0). Optional Argument: Determinant
Inverse of a positive definite rank 2 Tensor (Determinant > 0). Optional Argument: Determinant

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/norm.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Norm

**Description:** Euclidean norm of a rank 1 Tensor (Vector). Square root of the sum of the squared components `sqrt( sum( T%a**2 ))`.
Euclidean norm of a rank 1 Tensor (Vector). Square root of the sum of the squared components `sqrt( sum( T%a**2 ))`.

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/permute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Permute

**Description:** Index permutation of a rank 2 or a rank 4 Tensor. For rank 2 Tensors this is equal to the transpose function.
Index permutation of a rank 2 or a rank 4 Tensor. For rank 2 Tensors this is equal to the transpose function.

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/piola.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Piola Transformation

**Description:** Perform a Piola transformation. It is assumed that the tensor's components are all either co- or contravariant as this toolbox has no information about co- and contravariant tensor components. All indices are transformed with the same mixed-variant argument tensor. This means it is not possible to perform a push forward of a mixed variant fourth order tensor. To perform a push forward of the contra-variant indices of the tangent matrix from material components in the reference configuration to spatial components in the current configuration write `piola(F,C4)`. When using symmetric variants of tensor data types (Voigt-notation) a faster contraction with less calculations due to symmetric properties is performed.
Perform a Piola transformation. It is assumed that the tensor's components are all either co- or contravariant as this toolbox has no information about co- and contravariant tensor components. All indices are transformed with the same mixed-variant argument tensor. This means it is not possible to perform a push forward of a mixed variant fourth order tensor. To perform a push forward of the contra-variant indices of the tangent matrix from material components in the reference configuration to spatial components in the current configuration write `piola(F,C4)`. When using symmetric variants of tensor data types (Voigt-notation) a faster contraction with less calculations due to symmetric properties is performed.

- `piola(F,S)` where `S` is a stress tensor is equal to `F*S*transpose(F)`
- `piola(F,C4)` where `C4` is a fourth order elasticity tensor means `c4(i,j,k,l) = F(i,I) F(j,J) F(k,K) F(l,L) C4(I,J,K,L)`
Expand Down
35 changes: 24 additions & 11 deletions docs/api/functions/rotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,36 @@ grand_parent: API Reference

## Rotation Matrix

**Description:** Rotation Matrix with inputs angle in rad and rotation axis.

There are 3 possible cases:
- `rotation_matrix(phi,3)`
<a href="https://www.codecogs.com/eqnedit.php?latex=\mathbf{R}&space;=&space;\begin{bmatrix}&space;\cos&space;\varphi&space;&&space;\sin&space;\varphi&space;&&space;0&space;\\&space;-\sin&space;\varphi&space;&&space;\cos&space;\varphi&space;&&space;0&space;\\&space;0&space;&&space;0&space;&&space;1&space;\end{bmatrix}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\mathbf{R}&space;=&space;\begin{bmatrix}&space;\cos&space;\varphi&space;&&space;\sin&space;\varphi&space;&&space;0&space;\\&space;-\sin&space;\varphi&space;&&space;\cos&space;\varphi&space;&&space;0&space;\\&space;0&space;&&space;0&space;&&space;1&space;\end{bmatrix}" title="\mathbf{R} = \begin{bmatrix} \cos \varphi & \sin \varphi & 0 \\ -\sin \varphi & \cos \varphi & 0 \\ 0 & 0 & 1 \end{bmatrix}" /></a>

- `rotation_matrix(phi,2)`
<a href="https://www.codecogs.com/eqnedit.php?latex=\mathbf{R}&space;=&space;\begin{bmatrix}&space;\cos&space;\varphi&space;&&space;0&space;&&space;\sin&space;\varphi\\&space;0&space;&&space;1&space;&&space;0&space;\\&space;-\sin&space;\varphi&space;&&space;0&space;&&space;\cos&space;\varphi\\&space;\end{bmatrix}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\mathbf{R}&space;=&space;\begin{bmatrix}&space;\cos&space;\varphi&space;&&space;0&space;&&space;\sin&space;\varphi\\&space;0&space;&&space;1&space;&&space;0&space;\\&space;-\sin&space;\varphi&space;&&space;0&space;&&space;\cos&space;\varphi\\&space;\end{bmatrix}" title="\mathbf{R} = \begin{bmatrix} \cos \varphi & 0 & \sin \varphi\\ 0 & 1 & 0 \\ -\sin \varphi & 0 & \cos \varphi\\ \end{bmatrix}" /></a>

- `rotation_matrix(phi,1)`
<a href="https://www.codecogs.com/eqnedit.php?latex=\mathbf{R}&space;=&space;\begin{bmatrix}&space;1&space;&&space;0&space;&&space;0&space;\\&space;0&space;&\cos&space;\varphi&space;&&space;\sin&space;\varphi\\&space;0&space;&&space;-\sin&space;\varphi&space;&&space;\cos&space;\varphi\\&space;\end{bmatrix}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\mathbf{R}&space;=&space;\begin{bmatrix}&space;1&space;&&space;0&space;&&space;0&space;\\&space;0&space;&\cos&space;\varphi&space;&&space;\sin&space;\varphi\\&space;0&space;&&space;-\sin&space;\varphi&space;&&space;\cos&space;\varphi\\&space;\end{bmatrix}" title="\mathbf{R} = \begin{bmatrix} 1 & 0 & 0 \\ 0 &\cos \varphi & \sin \varphi\\ 0 & -\sin \varphi & \cos \varphi\\ \end{bmatrix}" /></a>
Rotation Matrix with inputs angle in rad and rotation axis.

| Property | Value |
| --- | --- |
| Result | Tensor-valued function |
| Data Types | `Tensor2` |

There are 3 possible cases:

### `rotation_matrix(phi,3)`
$$
\begin{equation}
\mathbf{R} = \begin{bmatrix} \cos \varphi & \sin \varphi & 0 \\ -\sin \varphi & \cos \varphi & 0 \\ 0 & 0 & 1 \end{bmatrix}
\end{equation}
$$

### `rotation_matrix(phi,2)`
$$
\begin{equation}
\mathbf{R} = \begin{bmatrix} \cos \varphi & 0 & \sin \varphi\\ 0 & 1 & 0 \\ -\sin \varphi & 0 & \cos \varphi\\ \end{bmatrix}
\end{equation}
$$

### `rotation_matrix(phi,1)`
$$
\begin{equation}
\mathbf{R} = \begin{bmatrix} 1 & 0 & 0 \\ 0 &\cos \varphi & \sin \varphi\\ 0 & -\sin \varphi & \cos \varphi\\ \end{bmatrix}
\end{equation}
$$

### Example

```fortran
Expand Down
13 changes: 8 additions & 5 deletions docs/api/functions/squareroot.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ grand_parent: API Reference

## Square Root

**Description:** Tensorial square root of a positive definite rank 2 Tensor. For algorithmic details see [Franka, L.P. (1988)](https://inis.iaea.org/search/search.aspx?orig_q=RN:20064555). This function can be used to obtain the stretch tensor.

<a href="https://www.codecogs.com/eqnedit.php?latex=\mathbf{C}&space;=&space;\mathbf{U}^2" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\mathbf{C}&space;=&space;\mathbf{U}^2" title="\mathbf{C} = \mathbf{U}^2" /></a>

<a href="https://www.codecogs.com/eqnedit.php?latex=\mathbf{U}&space;=&space;\sqrt{\mathbf{C}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\mathbf{U}&space;=&space;\sqrt{\mathbf{C}}" title="\mathbf{U} = \sqrt{\mathbf{C}}" /></a>
Tensorial square root of a positive definite rank 2 Tensor. For algorithmic details see [Franka, L.P. (1988)](https://inis.iaea.org/search/search.aspx?orig_q=RN:20064555). This function can be used to obtain the stretch tensor.

$$
\begin{align}
\mathbf{C} &= \mathbf{U}^2 \\
\mathbf{U} &= \sqrt{\mathbf{C}}
\end{align}
$$

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Trace

**Description:** Sum of diagonal terms of a rank 2 Tensor.
Sum of diagonal terms of a rank 2 Tensor.

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/transpose.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Transpose

**Description:** Transpose of a rank 2 Tensor or major transpose of a rank 4 Tensor.
Transpose of a rank 2 Tensor or major transpose of a rank 4 Tensor.

| Property | Value |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/unimodular.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Unimodular Part of Tensor

**Description:** Unimodular Part of a rank 2 Tensor.
Unimodular Part of a rank 2 Tensor.

<a href="https://www.codecogs.com/eqnedit.php?latex=\hat{\textbf{C}}&space;=&space;\det({\textbf{C}})^{-1/3}&space;\&space;\textbf{C}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\hat{\textbf{C}}&space;=&space;\det({\textbf{C}})^{-1/3}&space;\&space;\textbf{C}" title="\hat{\textbf{C}} = \det({\textbf{C}})^{-1/3} \ \textbf{C}" /></a>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/functions/voigtstrain.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ grand_parent: API Reference

## Voigtstrain

**Description:** Import a strain array in voigt storage. As this Module does not use doubled shear items for the symmetric voigt-like storage a strain-like array has to be imported rather than assigned to a Tensor.
Import a strain array in voigt storage. As this Module does not use doubled shear items for the symmetric voigt-like storage a strain-like array has to be imported rather than assigned to a Tensor.
- `ndi` number of direct compononets
- `nshear` number of shear components
- `ngens` dimension of strain array
Expand Down
3 changes: 2 additions & 1 deletion docs/api/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ This module uses derived data types where the default operators are overloaded w
- Dyadic Product `A.dya.B`
- Symmetric Crossed-dyadic Product `A.cdya.B` to perform `C(i,j,k,l) = (A(i,k)*B(j,l) + A(i,l)*B(j,k) + B(i,k)*A(j,l) + B(i,l)*A(j,k)) / 4.`

**Warning**: Be sure to use brackets around functions which should be evaluated first because the double contraction has the highest priority as it is replaced by the conventional power function. This leads to wrong results in combination with crossed-dyadic products as they must be evaluated first. Always use brackets like `A**(B.cdya.B)`. Unfortunately this is a limitation of Fortran.
{: .warning }
> Be sure to use brackets around functions which should be evaluated first because the double contraction has the highest priority as it is replaced by the conventional power function. This leads to wrong results in combination with crossed-dyadic products as they must be evaluated first. Always use brackets like `A**(B.cdya.B)`. Unfortunately this is a limitation of Fortran.

0 comments on commit 79f01a9

Please sign in to comment.