I created a simple but effective [URL= https://adtzlr.github.io/ttb/]Tensor Toolbox for Fortran[/URL] (ttb). It simplifies things a lot - think of having some matlab functionality available in Fortran:
[*]Dot Product C(i,j) = A(i,k) B(k,j) written as C = A*B or C = A.dot.B
[*]Double Dot Product C = A(i,j) B(i,j) written as C = A**B or C = A.ddot.B
[*]Dyadic Product C(i,j,k,l) = A(i,j) B(k,l) written as C = A.dya.B
[*]Addition / Subtraction C(i,j) = A(i,j) + B(i,j) written as C = A+B or C = A.add.B
[*]Multiplication and Division by a Scalar C(i,j) = A(i,j) - B(i,j) written as C = A-B or C = A.sub.B
[*]Deviatoric Part of Tensor dev(C) = C - tr(C)/3 * Eye written as dev(C)
[*]Transpose and Permutation of indices B(i,j,k,l) = A(i,k,j,l) written as B = permute(A,1,3,2,4)
[*]Assigment of a real-valued Scalar to all components of a Tensor A = 0.0 or A = 0.d0
[*]Assigment of a real-valued Array to a Tensor with matching dimensions A = B where B is an Array and A a Tensor
[*]Rank 2 Identity tensor of input type Eye = identity2(Eye) with C = Eye*C
[*]Rank 4 Identity tensor (symmetric variant) of input type I4 = identity4(Eye) with C = I4(Eye)**C or inv(C) = identitiy4(inv(C))**C
[/LIST] See the full documentation: [URL] https://adtzlr.github.io/ttb/[/URL].
You can find more information and a [URL= https://adtzlr.github.io/ttb/example.html]sample user subroutine[/URL] or [URL= https://adtzlr.github.io/ttb/example_stvenantkirchhoff.html]another example[/URL] for MSC.Marc in my Github repository. Feel free to contribute bugs and your ideas - Im open for everything I can handle. If you successfully use my module please tell me as Im interested what is possible.
The most basic example on how to use this module is to [URL= https://github.com/adtzlr/ttb/archive/master.zip]download the module[/URL], put the ttb-Folder in your working directory and add two lines of code:
[CODE] include ttb/ttb_library.f
! user code
end program script101_ttb[/CODE]
The include ttb/ttb_library.f statement replaces the line with the content of the ttb-module. The first line in a program or subroutine is now a use Tensor statement. Thats it - now youre ready to go.
[B]Example: Neo-Hookean Material[/B]
With the help of the Tensor module the Second Piola-Kirchhoff stress tensor S of a nearly-incompressible Neo-Hookean material model is basically a one-liner:
[B]Second Piola Kirchhoff Stress Tensor[/B]
[CODE] S = mu*det(C)**(-1./3.)*dev(C)*inv(C)+p*det(C)**(1./2.)*inv(C) [/CODE]
[B]Material Elasticity Tensor[/B]
Isochoric part of the material elasticity tensor C4_iso of a nearly-incompressible Neo-Hookean material model:
[CODE] C4_iso = det(F)**(-2./3.) * 2./3.* (
* tr(C) * (inv(C).cdya.inv(C))
* - (Eye.dya.inv(C)) - (inv(C).dya.Eye)
* + tr(C)/3. * (inv(C).dya.inv(C)) )[/CODE]
Dear Abaqus users: Please use [CODE]asabqarray[/CODE] to export stress and tangent matrix to change Marc ordering (11,22,33,12,23,31) to the one used in Abaqus (11,22,33,12,13,23).