Announcement

Collapse
No announcement yet.

Discussion: Tensor Toolbox for Modern Fortran (ttb)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Discussion: Tensor Toolbox for Modern Fortran (ttb)

    Hello,

    I created a simple but effective Tensor Toolbox for Fortran (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
    • ...
    See the full documentation: https://adtzlr.github.io/ttb/.

    You can find more information and a sample user subroutine or another example for MSC.Marc in my Github repository. Feel free to contribute bugs and your ideas - I'm open for everything I can handle. If you successfully use my module please tell me as I'm interested what is possible.

    Basic Usage
    The most basic example on how to use this module is to download the module, put the 'ttb'-Folder 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
    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. That's it - now you're ready to go.

    Example: Neo-Hookean Material
    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:

    Second Piola Kirchhoff Stress Tensor
    Code:
          S = mu*det(C)**(-1./3.)*dev(C)*inv(C)+p*det(C)**(1./2.)*inv(C)
    Material Elasticity Tensor
    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)) )
    Dear Abaqus users: Please use
    Code:
    asabqarray
    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

  • #2
    Update for Abaqus users

    Added function `asabqarray` to export into Abaqus Voigt notation with tensor components `11,22,33,12,13,23`. See the updated documentation for more Details. As I don't have an Abaqus license I need your help to test and verify the Tensor module in Abaqus.

    Comment


    • #3
      Update: 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 Neo-Hookean material see my documentation it is quite easy to understand compared to basic fortran code. In the next weeks I'll investigate some of my (well, spare) free-time 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.
      Last edited by duan; 2017-12-27, 14:09.

      Comment


      • #4
        Jorgen , wouldn't this Toolbox be great for your Book to simplify the code for your Neo-Hookean UMAT Subroutine? You can have a look for an example with my Tensor Toolbox here: https://adtzlr.github.io/ttb/example.html . 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

        Comment

        Working...
        X