Discussion: Tensor Toolbox for Modern Fortran (ttb)
Hello,
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:
[LIST]
[*]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 = AB 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 realvalued Scalar to all components of a Tensor A = 0.0 or A = 0.d0
[*]Assigment of a realvalued 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.
[B]Basic Usage[/B]
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 ttbFolder in your working directory and add two lines of code:
[CODE] include ttb/ttb_library.f
program script101_ttb
use Tensor
implicit none
! user code
end program script101_ttb[/CODE]
The include ttb/ttb_library.f statement replaces the line with the content of the ttbmodule. The first line in a program or subroutine is now a use Tensor statement. Thats it  now youre ready to go.
[B]Example: NeoHookean Material[/B]
With the help of the Tensor module the Second PiolaKirchhoff stress tensor S of a nearlyincompressible NeoHookean material model is basically a oneliner:
[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 nearlyincompressible NeoHookean 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).
Best Regards,
Andreas
Update for Abaqus users
Added function `asabqarray` to export into Abaqus Voigt notation with tensor components `11,22,33,12,13,23`. See the [URL= https://github.com/adtzlr/ttb ]updated documentation[/URL] for more Details. As I dont have an Abaqus license I need your help to test and verify the Tensor module in Abaqus.
Please do not use Voigt notation as its implementation is currently wrong. Ill report back when I have fixed it.
EDIT: Fixed! Modified double dot product (double contraction) function to include doubled covariant (strainlike) shear components.
[B]Update:[/B] The Toolbox is more or less finished now 🙂  every feature is tested and I encountered no errors so far. If someone is interested how to write a FEM fortran subroutine for a NeoHookean material see my [URL= https://adtzlr.github.io/ttb/ ]documentation [/URL]it is quite easy to understand compared to basic fortran code. In the next weeks Ill investigate some of my (well, spare) freetime for updating the docs as there are quite a lot of (nice) features undocumentated. One of the nicest features is the seamless switch between voigt and tensor notation.
[USER=2]Jorgen[/USER] , wouldnt this Toolbox be great for your Book to simplify the code for your NeoHookean UMAT Subroutine? You can have a look for an example with my Tensor Toolbox here: [URL] https://adtzlr.github.io/ttb/example.html [/URL] . Of course there are some drawbacks: The reader does not get that deep insight in the tensor component loops and you would have to trust me that the Toolbox is out of mistakes. On the other hand the produced code is very readable, especially for the elasticity tensor (tangent matrix). It took my a while to understand your column based code for the tangent matrix. If you need information how to provide an abaqus consistent tangent with my toolbox please let me know as my example is only suitable for a total lagrange formulation.
BR, Andreas

VUMAT for Hyperelastic Materials  Update to Bergstrom's Example
6 months ago

UMAT: Tangent stiffness for linear perturbation steps / steady state dynamics / vibration analysis
10 months ago

UMAT subroutine for 3d solid
3 years ago

subroutine error
4 years ago

friction subroutine
4 years ago
Latest Post: Calibration of Three Network Viscoplastic model Our newest member: jamintototerbaik Recent Posts Unread Posts Tags
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed