From 7a2c05c69f8296e0e80352cc1c089ff76a0df97f Mon Sep 17 00:00:00 2001 From: Andreas D Date: Mon, 30 Aug 2021 20:59:25 +0200 Subject: [PATCH 01/16] update doi badge always link to latest version --- README.md | 10 +++++----- docs/index.md | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c0b11105..7e346859 100644 --- a/README.md +++ b/README.md @@ -8,18 +8,18 @@ The full documentation is available at [https://adtzlr.github.io/ttb](https://ad ## How to cite -[![DOI](https://zenodo.org/badge/112017005.svg)](https://zenodo.org/badge/latestdoi/112017005) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4077378.svg)](https://doi.org/10.5281/zenodo.4077378) -If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite this toolbox in your publications. Thanks! +If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite this toolbox in your publications. Thanks! **Hint**: The DOI-badge always resolves to the latest version of this toolbox - if you prefer a version-specific DOI, hit the DOI-badge and pick a version on Zenodo. -Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. Version 1.0.0 (2020). DOI: 10.5281/zenodo.4077379. +Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. Version 1.0.0 (2020). DOI: 10.5281/zenodo.4077378. ``` @software{dutzler2020, author = {Andreas Dutzler}, title = {Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran}, - doi = {10.5281/zenodo.4077379}, - url = {https://doi.org/10.5281/zenodo.4077379} + doi = {10.5281/zenodo.4077378}, + url = {https://doi.org/10.5281/zenodo.4077378} } ``` diff --git a/docs/index.md b/docs/index.md index 7fc5e196..99e0c542 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,18 +8,18 @@ Commercial FEM software packages offer interfaces (user subroutines written in F ## How to cite -[![DOI](https://zenodo.org/badge/112017005.svg)](https://zenodo.org/badge/latestdoi/112017005) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4077378.svg)](https://doi.org/10.5281/zenodo.4077378) -If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite this toolbox in your publications. Thanks! +If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite this toolbox in your publications. Thanks! **Hint**: The DOI-badge always resolves to the latest version of this toolbox - if you prefer a version-specific DOI, hit the DOI-badge and pick a version on Zenodo. -Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. Version 1.0.0 (2020). DOI: 10.5281/zenodo.4077379. +Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. DOI: 10.5281/zenodo.4077378. ``` -@software{dutzler2020, +@software{dutzler2021, author = {Andreas Dutzler}, title = {Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran}, - doi = {10.5281/zenodo.4077379}, - url = {https://doi.org/10.5281/zenodo.4077379} + doi = {10.5281/zenodo.4077378}, + url = {https://doi.org/10.5281/zenodo.4077378} } ``` From 87539e178616efff9c88a36e388eb93ef04caa17 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Mon, 30 Aug 2021 21:00:25 +0200 Subject: [PATCH 02/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e346859..be6471df 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The full documentation is available at [https://adtzlr.github.io/ttb](https://ad If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite this toolbox in your publications. Thanks! **Hint**: The DOI-badge always resolves to the latest version of this toolbox - if you prefer a version-specific DOI, hit the DOI-badge and pick a version on Zenodo. -Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. Version 1.0.0 (2020). DOI: 10.5281/zenodo.4077378. +Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. DOI: 10.5281/zenodo.4077378. ``` @software{dutzler2020, From 4b205d08cdac6e9ffc71302b3543d6ce7647ecb9 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Mon, 30 Aug 2021 21:00:48 +0200 Subject: [PATCH 03/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be6471df..dea2de70 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite t Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. DOI: 10.5281/zenodo.4077378. ``` -@software{dutzler2020, +@software{dutzler2021, author = {Andreas Dutzler}, title = {Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran}, doi = {10.5281/zenodo.4077378}, From cf0bad7d10fa874200dec0bb94b96bdbc5d3bb3e Mon Sep 17 00:00:00 2001 From: Andreas D Date: Mon, 30 Aug 2021 21:01:21 +0200 Subject: [PATCH 04/16] Update index.md --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 99e0c542..206e5ce4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -43,4 +43,4 @@ For questions I opened a [Thread at PolymerFEM.com](https://polymerfem.com/forum ## Credits Naumann, C.: [Chemisch-mechanisch gekoppelte Modellierung und Simulation oxidativer Alterungsvorgänge in Gummibauteilen (German)](http://nbn-resolving.de/urn:nbn:de:bsz:ch1-qucosa-222075). PhD thesis. Fakultät für Maschinenbau der Technischen Universität Chemnitz, 2016. -## Last updated: 2020/06/02 +## Last updated: 2021/08/30 From e3e41fdc0a3b47a45f762d8d89dafce3ace838f4 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Mon, 30 Aug 2021 21:05:50 +0200 Subject: [PATCH 05/16] update docs --- README.md | 13 +++++-------- docs/index.md | 3 --- docs/installation.md | 2 +- docs/quickstartguide.md | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index dea2de70..f2f0f3ae 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ It provides the following [basic operations for tensor calculus](docs/functions. The idea is to create derived data types for rank 1, rank 2 and rank 4 tensors (and it's symmetric variants). In a next step the operators are defined in a way that Fortran calls different functions based on the input types of the operator: performing a dot product between a vector and a rank 2 tensor or a rank 2 and a rank 2 tensor is a different function. Best of it: you don't have to take care of that. ## Basic Usage -The most basic example on how to use this module is to [download the module](https://github.com/adtzlr/ttb/archive/master.zip), put the 'ttb'-Folder in your working directory and add two lines of code: +The most basic example on how to use this module is to [download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the 'ttb'-Folder in your working directory and add two lines of code: ```fortran #include "ttb/ttb_library.F" @@ -66,7 +66,7 @@ The `#include "ttb/ttb_library.F"` statement replaces the line with the content ## Tensor or Voigt Notation -It depends on your preferences: either you store all tensors in full tensor `dimension(3,3)` or in [voigt](https://en.wikipedia.org/wiki/Voigt_notation) `dimension(6)` notation. The equations remain (nearly) the same. Dot Product, Double Dot Product - every function is implemented in both full tensor and voigt notation. Look for the voigt-comments in an [example](docs/examples/hypela2_nh_ttb.f) of a user subroutine for MSC.Marc. +It depends on your preferences: either you store all tensors in full tensor `dimension(3,3)` or in [voigt](https://en.wikipedia.org/wiki/Voigt_notation) `dimension(6)` notation. The equations remain (nearly) the same. Dot Product, Double Dot Product - every function is implemented in both full tensor and voigt notation. Look for the voigt-comments in an [example](docs/examples/hypela2_nh_ttb.F) of a user subroutine for MSC.Marc. ## Access Tensor components by Array @@ -101,9 +101,6 @@ To export a stress tensor to Abaqus Voigt notation use `asabqarray` which reorde The permutation function reorders indices in the given order for a fourth order tensor of data type `Tensor4`. Example: `(i,j,k,l) --> (i,k,j,l)` with `permute(C4,1,3,2,4)`. -## External Libraries -This library is not using any [LAPACK](http://www.netlib.org/lapack/) functions. Instead you can compile your subroutine with `-o3` flag where at least the Intel compiler translates nested for-loops to [Intel MPI](https://software.intel.com/en-us/intel-mpi-library) functions. However commercial FEM packages have pre-defined optimization flags which should not or only be changed with caution. I'm open for ideas how to use LAPACK and Intel MPI in the future - please let me know. - ## 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: @@ -113,7 +110,7 @@ With the help of the Tensor module the Second Piola-Kirchhoff stress tensor `S` S = mu*det(C)**(-1./3.)*dev(C)*inv(C)+p*det(C)**(1./2.)*inv(C) ``` -While this is of course not the fastest way of calculating the stress tensor it is extremely short and readable. Also the second order tensor variables `S, C` and scalar quantities `mu, p` have to be created at the beginning of the program. A minimal working example for a very simple umat user subroutine can be found in [script_umat.f](docs/examples/script_umat.f). The program is just an example where umat is called and an output information is printed. It is shown that the tensor toolbox is only used inside the material user subroutine umat. +While this is of course not the fastest way of calculating the stress tensor it is extremely short and readable. Also the second order tensor variables `S, C` and scalar quantities `mu, p` have to be created at the beginning of the program. A minimal working example for a very simple umat user subroutine can be found in [script_umat.F](docs/examples/script_umat.F). The program is just an example where umat is called and an output information is printed. It is shown that the tensor toolbox is only used inside the material user subroutine umat. ### Material Elasticity Tensor @@ -128,9 +125,9 @@ Isochoric part of the material elasticity tensor `C4_iso` of a nearly-incompress ### Example of MSC.Marc HYPELA2 -[Here](docs/examples/hypela2_nh_ttb.f) you can find an example of a nearly-incompressible version of a Neo-Hookean material for MSC.Marc. ~It works **only** in Total Lagrange (no push forward implemented)~. Updated Lagrange is implemented with a push forward of both stress tensor and tangent matrix. Herrmann Elements are automatically detected. As HYPELA2 is called twice per iteration the stiffness calculation is only active during stage `lovl == 4`. One of the best things is the super-simple switch from tensor to voigt notation: Change data types of all symmetric tensors and save the right Cauchy-Green deformation tensor in voigt notation. See commented lines for details. +[Here](docs/examples/hypela2_nh_ttb.F) you can find an example of a nearly-incompressible version of a Neo-Hookean material for MSC.Marc. ~It works **only** in Total Lagrange (no push forward implemented)~. Updated Lagrange is implemented with a push forward of both stress tensor and tangent matrix. Herrmann Elements are automatically detected. As HYPELA2 is called twice per iteration the stiffness calculation is only active during stage `lovl == 4`. One of the best things is the super-simple switch from tensor to voigt notation: Change data types of all symmetric tensors and save the right Cauchy-Green deformation tensor in voigt notation. See commented lines for details. -[Download HYPELA2](docs/examples/hypela2_nh_ttb.f): Neo-Hooke, MSC.Marc, Total Lagrange, Tensor Toolbox +[Download HYPELA2](docs/examples/hypela2_nh_ttb.F): Neo-Hooke, MSC.Marc, Total Lagrange, Tensor Toolbox ## Credits Naumann, C.: [Chemisch-mechanisch gekoppelte Modellierung und Simulation oxidativer Alterungsvorgänge in Gummibauteilen (German)](http://nbn-resolving.de/urn:nbn:de:bsz:ch1-qucosa-222075). PhD thesis. Fakultät für Maschinenbau der Technischen Universität Chemnitz, 2016. diff --git a/docs/index.md b/docs/index.md index 206e5ce4..cea1ce1a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,9 +37,6 @@ Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipula Andreas Dutzler, Graz, Austria. I'm a PhD student at the Insitute of Structural Durability and Railway Technology at Graz University of Technology. -## Discussion -For questions I opened a [Thread at PolymerFEM.com](https://polymerfem.com/forum/polymerfem-downloads/user-material-subroutines/25668-discussion-tensor-toolbox-for-modern-fortran-ttb) for discussions regarding this module. - ## Credits Naumann, C.: [Chemisch-mechanisch gekoppelte Modellierung und Simulation oxidativer Alterungsvorgänge in Gummibauteilen (German)](http://nbn-resolving.de/urn:nbn:de:bsz:ch1-qucosa-222075). PhD thesis. Fakultät für Maschinenbau der Technischen Universität Chemnitz, 2016. diff --git a/docs/installation.md b/docs/installation.md index 28ab3e72..df2a61b2 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -4,7 +4,7 @@ This Toolbox is a fortran module which can be used inside modern Fortran compile This Toolbox is tested on Windows with both Intel Fortran >2015 (in combination with MSC.Marc) and GFortran >6.3. If you are using Linux it **should** work (but it is untested). ## Download -[Download the module](https://github.com/adtzlr/ttb/archive/master.zip), put the `ttb`-Folder in your working directory and you are ready to dive into comfortable tensor manipulations in Fortran. +[Download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the `ttb`-Folder in your working directory and you are ready to dive into comfortable tensor manipulations in Fortran. ## A note on LS-DYNA Users If you have problems as reported [here] (https://github.com/adtzlr/ttb/issues/10), please add the following line **before** the Tensor-Toolbox include statement. This deactivates tensor with single-precision scalar multiplications and divisions. **Warning**: Now take care to only use double-precision constants in your code! diff --git a/docs/quickstartguide.md b/docs/quickstartguide.md index a6dd920a..11b374f7 100644 --- a/docs/quickstartguide.md +++ b/docs/quickstartguide.md @@ -1,5 +1,5 @@ ## Quick Start Guide -The most basic example on how to use this module is to [download the module](https://github.com/adtzlr/ttb/archive/master.zip), put the 'ttb'-Folder in your working directory and add two lines of code: +The most basic example on how to use this module is to [download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the 'ttb'-Folder in your working directory and add two lines of code: ```fortran #include 'ttb/ttb_library.F' From cbf8917d5cff464fea8bf18fe1b2d8379853818f Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:02:13 +0200 Subject: [PATCH 06/16] Update LICENSE change year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 4f7ecde6..18bc8c28 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Andreas D. +Copyright (c) 2022 Andreas Dutzler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 56bb375346237762ebdb95ce65acf96ecb78a8e1 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:03:01 +0200 Subject: [PATCH 07/16] Update README.md change to lowercase `.f` file links; change some descriptions --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f2f0f3ae..f485238a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you use *Tensor Toolbox for Modern Fortran (ttb)* in your work, please cite t Andreas Dutzler. *Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran*. DOI: 10.5281/zenodo.4077378. ``` -@software{dutzler2021, +@software{dutzler2022, author = {Andreas Dutzler}, title = {Tensor Toolbox for Modern Fortran - High-Level Tensor Manipulation in Fortran}, doi = {10.5281/zenodo.4077378}, @@ -52,7 +52,7 @@ The idea is to create derived data types for rank 1, rank 2 and rank 4 tensors ( The most basic example on how to use this module is to [download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the 'ttb'-Folder in your working directory and add two lines of code: ```fortran -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' program script101_ttb use Tensor @@ -62,15 +62,15 @@ The most basic example on how to use this module is to [download the module](htt 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. As this module uses preprocessor definitions it is necessary to save your files with **UPPERCASE** file extensions (e.g. `filename.F`). +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. ## Tensor or Voigt Notation -It depends on your preferences: either you store all tensors in full tensor `dimension(3,3)` or in [voigt](https://en.wikipedia.org/wiki/Voigt_notation) `dimension(6)` notation. The equations remain (nearly) the same. Dot Product, Double Dot Product - every function is implemented in both full tensor and voigt notation. Look for the voigt-comments in an [example](docs/examples/hypela2_nh_ttb.F) of a user subroutine for MSC.Marc. +It depends on your preferences: either you store all tensors in full tensor `dimension(3,3)` or in [voigt](https://en.wikipedia.org/wiki/Voigt_notation) `dimension(6)` notation. The equations remain (nearly) the same. Dot Product, Double Dot Product - every function is implemented in both full tensor and voigt notation. Look for the voigt-comments in an [example](docs/examples/hypela2_nh_ttb.f) of a user subroutine for MSC.Marc. ## Access Tensor components by Array -Tensor components may be accessed by a conventional array with the name of the tensor variable `T` followed by a percent operator `%` and a keyword as follows: +Tensor components may be accessed by a conventional array with the name of the tensor variable `T` followed by a percent operator `%` and a type-specific keyword as follows: - Tensor of rank 1 components as array: `T%a`. i-th component of T: `T%a(i)` - Tensor of rank 2 components as array: `T%ab`. i,j component of T: `T%ab(i,j)` @@ -110,11 +110,11 @@ With the help of the Tensor module the Second Piola-Kirchhoff stress tensor `S` S = mu*det(C)**(-1./3.)*dev(C)*inv(C)+p*det(C)**(1./2.)*inv(C) ``` -While this is of course not the fastest way of calculating the stress tensor it is extremely short and readable. Also the second order tensor variables `S, C` and scalar quantities `mu, p` have to be created at the beginning of the program. A minimal working example for a very simple umat user subroutine can be found in [script_umat.F](docs/examples/script_umat.F). The program is just an example where umat is called and an output information is printed. It is shown that the tensor toolbox is only used inside the material user subroutine umat. +While this is of course not the fastest way of calculating the stress tensor it is extremely short and readable. Also the second order tensor variables `S, C` and scalar quantities `mu, p` have to be created at the beginning of the program. A minimal working example for a very simple umat user subroutine can be found in [script_umat.f](docs/examples/script_umat.f). The program is just an example where a subroutine `umat` is called and an output information is printed. It is shown that the tensor toolbox is only used inside the material user subroutine `umat`. ### Material Elasticity Tensor -Isochoric part of the material elasticity tensor `C4_iso` of a nearly-incompressible Neo-Hookean material model: +The isochoric part of the material elasticity tensor `C4_iso` of a nearly-incompressible Neo-Hookean material model is defined and coded as: ```fortran C4_iso = det(F)**(-2./3.) * 2./3.* ( @@ -125,9 +125,9 @@ Isochoric part of the material elasticity tensor `C4_iso` of a nearly-incompress ### Example of MSC.Marc HYPELA2 -[Here](docs/examples/hypela2_nh_ttb.F) you can find an example of a nearly-incompressible version of a Neo-Hookean material for MSC.Marc. ~It works **only** in Total Lagrange (no push forward implemented)~. Updated Lagrange is implemented with a push forward of both stress tensor and tangent matrix. Herrmann Elements are automatically detected. As HYPELA2 is called twice per iteration the stiffness calculation is only active during stage `lovl == 4`. One of the best things is the super-simple switch from tensor to voigt notation: Change data types of all symmetric tensors and save the right Cauchy-Green deformation tensor in voigt notation. See commented lines for details. +[Here](docs/examples/hypela2_nh_ttb.f) you can find an example of a nearly-incompressible version of a Neo-Hookean material for MSC.Marc. Updated Lagrange is implemented by a push forward operator of both the stress and the fourth-order elasticity tensor. Herrmann Elements are automatically detected. As HYPELA2 is called twice per iteration the stiffness calculation is only active during stage `lovl == 4`. One of the best things is the super-simple switch from tensor to voigt notation: Change data types of all symmetric tensors and save the right Cauchy-Green deformation tensor in voigt notation. See commented lines for details. -[Download HYPELA2](docs/examples/hypela2_nh_ttb.F): Neo-Hooke, MSC.Marc, Total Lagrange, Tensor Toolbox +[Download HYPELA2](docs/examples/hypela2_nh_ttb.f): Neo-Hooke, MSC.Marc, Total Lagrange, Tensor Toolbox ## Credits Naumann, C.: [Chemisch-mechanisch gekoppelte Modellierung und Simulation oxidativer Alterungsvorgänge in Gummibauteilen (German)](http://nbn-resolving.de/urn:nbn:de:bsz:ch1-qucosa-222075). PhD thesis. Fakultät für Maschinenbau der Technischen Universität Chemnitz, 2016. From e040f510e62a782abde716ee76e5568b50aef7e7 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:03:05 +0200 Subject: [PATCH 08/16] Delete ttb_library.F --- ttb/ttb_library.F | 503 ---------------------------------------------- 1 file changed, 503 deletions(-) delete mode 100644 ttb/ttb_library.F diff --git a/ttb/ttb_library.F b/ttb/ttb_library.F deleted file mode 100644 index 77485c49..00000000 --- a/ttb/ttb_library.F +++ /dev/null @@ -1,503 +0,0 @@ -! -----------MODULE TENSOR--------------------------------------- - module Tensor - ! --------------------------------------- - ! Tensor Toolbox Module for Fortran - ! Andreas Dutzler - ! Graz University of Technology - ! Institute of Structural Durability - ! and Railway Technology - ! 2020-06-01 - ! --------------------------------------- - ! tested on: Windows 10 (64bit) - ! - Intel Fortran >2015 - ! - MinGW gfortran >6.3 - ! --------------------------------------- - ! use this module in the following form: - ! --------------------------------------- - ! #include "ttb/ttb_library.F" - ! program sample - ! use Tensor - ! ... - ! end program sample - ! --------------------------------------- - - type Tensor1 - ! tensor of rank 1 - real(kind=8), dimension(3) :: a - end type Tensor1 - - type Tensor2 - ! tensor of rank 2 - real(kind=8), dimension(3,3) :: ab - end type Tensor2 - - type Tensor2S - ! symmetric tensor of rank 2 stored as vector - real(kind=8), dimension(6) :: a6 - end type Tensor2S - - type Tensor4 - ! tensor of rank 4 - real(kind=8), dimension(3,3,3,3) :: abcd - end type Tensor4 - - type Tensor4S - ! symmetric tensor of rank 4 stored as 6x6 matrix - real(kind=8), dimension(6, 6) :: a6b6 - end type Tensor4S - -! ------BEGIN INTERFACE------------------------------------- - interface operator (/) - module procedure div_10 - module procedure div_20 - module procedure div_20s - module procedure div_40 - module procedure div_40s -#ifndef NOR4 - module procedure div_10_r4 - module procedure div_20_r4 - module procedure div_20s_r4 - module procedure div_40_r4 - module procedure div_40s_r4 -#endif - end interface - interface operator (.div.) - module procedure div_10 - module procedure div_20 - module procedure div_20s - module procedure div_40 - module procedure div_40s -#ifndef NOR4 - module procedure div_10_r4 - module procedure div_20_r4 - module procedure div_20s_r4 - module procedure div_40_r4 - module procedure div_40s_r4 -#endif - end interface - - interface operator (*) - ! simple dot-product of rank 1 and rank 2 tensor combinations - module procedure dot_01 - module procedure dot_10 - module procedure dot_02 - module procedure dot_02s - module procedure dot_20 - module procedure dot_20s - module procedure dot_04 - module procedure dot_04s - module procedure dot_40 - module procedure dot_40s - module procedure dot_11 - module procedure dot_12 - module procedure dot_21 - module procedure dot_2s1 - module procedure dot_12s - module procedure dot_22 - module procedure dot_2s2s -#ifndef NOR4 - module procedure dot_01_r4 - module procedure dot_10_r4 - module procedure dot_02_r4 - module procedure dot_02s_r4 - module procedure dot_20_r4 - module procedure dot_20s_r4 - module procedure dot_04_r4 - module procedure dot_04s_r4 - module procedure dot_40_r4 - module procedure dot_40s_r4 -#endif - end interface - interface operator (.dot.) - ! simple dot-product of rank 1 and rank 2 tensor combinations - module procedure dot_01 - module procedure dot_10 - module procedure dot_02 - module procedure dot_02s - module procedure dot_20 - module procedure dot_20s - module procedure dot_04 - module procedure dot_04s - module procedure dot_40 - module procedure dot_40s - module procedure dot_11 - module procedure dot_12 - module procedure dot_21 - module procedure dot_2s1 - module procedure dot_12s - module procedure dot_22 - module procedure dot_2s2s -#ifndef NOR4 - module procedure dot_01_r4 - module procedure dot_10_r4 - module procedure dot_02_r4 - module procedure dot_02s_r4 - module procedure dot_20_r4 - module procedure dot_20s_r4 - module procedure dot_04_r4 - module procedure dot_04s_r4 - module procedure dot_40_r4 - module procedure dot_40s_r4 -#endif - end interface - - interface operator (**) - ! double dot-product of rank 1 and rank 2 tensor combinations - module procedure ddot_22 - module procedure ddot_2s2s - module procedure ddot_24 - module procedure ddot_2s4s - module procedure ddot_42 - module procedure ddot_4s2s - module procedure ddot_44 - module procedure ddot_4s4s - module procedure pow_2 - module procedure pow_2s - end interface - - interface operator (.ddot.) - ! double dot-product of rank 1 and rank 2 tensor combinations - module procedure ddot_22 - module procedure ddot_2s2s - module procedure ddot_24 - module procedure ddot_2s4s - module procedure ddot_42 - module procedure ddot_4s2s - module procedure ddot_44 - module procedure ddot_4s4s - end interface - - interface operator (.pow.) - module procedure pow_2 - module procedure pow_2s - end interface - - interface operator (+) - ! addition of rank 1 and rank 2 tensors - module procedure add_11 - module procedure add_22 - module procedure add_44 - module procedure add_2s2s - module procedure add_22s - module procedure add_2s2 - module procedure add_4s4s - module procedure add_44s - module procedure add_4s4 - end interface - interface operator (.add.) - ! addition of rank 1 and rank 2 tensors - module procedure add_11 - module procedure add_22 - module procedure add_44 - module procedure add_2s2s - module procedure add_22s - module procedure add_2s2 - module procedure add_4s4s - module procedure add_44s - module procedure add_4s4 - end interface - - interface operator (-) - ! subtraction of rank 1 and rank 2 tensors - module procedure sub_11 - module procedure sub_22 - module procedure sub_44 - module procedure sub_2s2s - module procedure sub_22s - module procedure sub_2s2 - module procedure sub_4s4s - module procedure sub_44s - module procedure sub_4s4 - end interface - interface operator (.sub.) - ! subtraction of rank 1 and rank 2 tensors - module procedure sub_11 - module procedure sub_22 - module procedure sub_44 - module procedure sub_2s2s - module procedure sub_22s - module procedure sub_2s2 - module procedure sub_4s4s - module procedure sub_44s - module procedure sub_4s4 - end interface - - interface operator (.dya.) - ! dyadic product of rank 2 and rank 4 tensor combinations - module procedure dyadic_11 - module procedure dyadic_22 - module procedure dyadic_2s2s - end interface - - interface operator (.cdya.) - ! symmetric crossed dyadic product of rank 2 tensor combinations - ! (i,j,k,l) = 1/2 * (i,k,j,l)*(i,l,j,k) - module procedure crossdyadic_22 - module procedure crossdyadic_2s2s - end interface - - interface operator (.icdya.) - ! inner crossed dyadic product of rank 2 tensor combinations - ! (i,j,k,l) = (i,k,j,l) - module procedure icrossdyadic_22 - module procedure icrossdyadic_2s2s - end interface - - interface fact - module procedure fact_i - end interface - - interface tr - module procedure tr_2 - module procedure tr_2s - end interface - - interface det - module procedure det_2 - module procedure det_2s - end interface - - interface dev - module procedure dev_2 - module procedure dev_2s - end interface - - interface unimodular - module procedure unimod_2 - module procedure unimod_2s - module procedure unimod_2d - module procedure unimod_2sd - end interface - - interface inv - module procedure inv_2 - module procedure inv_2s - module procedure inv2d - module procedure inv2sd - end interface - - interface norm - module procedure norm_1 - module procedure norm_2 - module procedure norm_2s - end interface - - interface exp - module procedure exp_2 - module procedure exp_2s - end interface - - interface derivative_exp - module procedure dexp_2 - module procedure dexp_2s - end interface - - interface ln - module procedure ln_2 - module procedure ln_2s - end interface - - - interface sqrt - module procedure sqrt_1 - module procedure stretch_2 - module procedure stretch_2s - end interface - - interface dsqrt - module procedure sqrt_1 - module procedure stretch_2 - module procedure stretch_2s - end interface - - interface rotation_matrix - module procedure rotation_2 - end interface - - interface identity2 - module procedure ident_2 - module procedure ident_2s - end interface - - interface identity4 - module procedure ident_4 - module procedure ident_4s - end interface - - interface tensorstore - module procedure tenstore_2 - module procedure tenstore_2a - module procedure tenstore_2s - module procedure tenstore_4 - module procedure tenstore_4a - module procedure tenstore_4s - end interface - - interface astensor - module procedure tenstore_2 - module procedure tenstore_2a - module procedure tenstore_2s - module procedure tenstore_4 - module procedure tenstore_4a - module procedure tenstore_4s - end interface - - interface symstore - module procedure symstore_2 - module procedure symstore_4 - module procedure symstore_2s - module procedure symstore_4s - module procedure symstore_2sa - module procedure symstore_4sa - end interface - - interface strain - ! module procedure str2ten_2 - module procedure str2ten_2s - end interface - - interface asvoigt - module procedure symstore_2 - module procedure symstore_4 - module procedure symstore_2s - module procedure symstore_4s - module procedure symstore_2sa - module procedure symstore_4sa - end interface - - interface voigt - module procedure symstore_2 - module procedure symstore_4 - module procedure symstore_2s - module procedure symstore_4s - module procedure symstore_2sa - module procedure symstore_4sa - end interface - - interface reduce_dim - module procedure reduce_dim_2s - module procedure reduce_dim_4s - end interface - - interface permute - ! double dot-product of rank 1 and rank 2 tensor combinations - module procedure permute_2 - module procedure permute_2s - module procedure permute_4 - module procedure permute_4s - end interface - - interface transpose - module procedure transp2 - module procedure transp2s - module procedure transp4 - module procedure transp4s - end interface - - interface piola - module procedure piola2 - module procedure piola2s - module procedure piola4 - module procedure piola4s - end interface - - interface asarray - module procedure asarray_1 - module procedure asarray_2 - module procedure asarray_4 - module procedure asarray_2s - module procedure asarray_4s - end interface - - interface asabqarray - module procedure asabqarray_2s - module procedure asabqarray_4s - end interface - - interface assignment (=) - module procedure assignscalar_1 - module procedure assignscalar_2 - module procedure assignscalar_2s - module procedure assignscalar_4 - module procedure assignscalar_4s - module procedure assignarr_1 - module procedure assignarr_2 - module procedure assignarr_2s - module procedure assignarr_4 - module procedure assignarr_4s - module procedure assignten2sym_2 - module procedure assignten2sym_4 - module procedure assignsym2ten_2 - module procedure assignsym2ten_4 -#ifndef NOR4 - module procedure assignscalar_1r4 - module procedure assignscalar_2r4 - module procedure assignscalar_2sr4 - module procedure assignscalar_4r4 - module procedure assignscalar_4sr4 - module procedure assignarr_2r4 - module procedure assignarr_2sr4 - module procedure assignarr_4r4 - module procedure assignarr_4sr4 -#endif - end interface -! ------END INTERFACE--------------------------------------- - - contains - -! ------BEGIN FUNCTIONS------------------------------------- -! ------MATH TOOLS SECTION---------------------------------- - include 'ttb/libtools.f' -! ------+/- SECTION----------------------------------------- - include 'ttb/libadd.f' - include 'ttb/libsub.f' -! ------DIVISION SECTION------------------------------------ - include 'ttb/libdiv.f' -! ------DOT SECTION----------------------------------------- - include 'ttb/libdot.f' -! ------DOUBLE DOT SECTION---------------------------------- - include 'ttb/libddot.f' -! ------POWER SECTION--------------------------------------- - include 'ttb/libpower.f' -! ------DYADIC SECTION-------------------------------------- - include 'ttb/libdyadic.f' -! ------CROSS-DYADIC SECTION-------------------------------- - include 'ttb/libcrossdyadic.f' - include 'ttb/libinnercrossdyadic.f' -! ------PERMUTE SECTION------------------------------------- - include 'ttb/libpermute.f' -! ------TENSOR FUNCTION SECTION----------------------------- - include 'ttb/libtransp.f' - include 'ttb/libtrace.f' - include 'ttb/libdet.f' - include 'ttb/libdev.f' - include 'ttb/libunimodular.f' - include 'ttb/libinv.f' - include 'ttb/libexp.f' - include 'ttb/libderivativeexp.f' - include 'ttb/libln.f' - include 'ttb/libnorm.f' - include 'ttb/libsqrt.f' - include 'ttb/librotation.f' -! ------TENSOR INITIALIZATION SECTION----------------------- - include 'ttb/libidentity.f' -! ------SYMSTORE SECTION------------------------------------ - include 'ttb/libsymstore.f' -! ------USYMSTORE SECTION----------------------------------- - include 'ttb/libtenstore.f' -! ------STRAINSTORE SECTION--------------------------------- - include 'ttb/libstrainstore.f' -! ------REDUCE DIM. SECTION--------------------------------- - include 'ttb/libreducedim.f' -! ------AS ARRAY SECTION------------------------------------ - include 'ttb/libasarray.f' - include 'ttb/libasabqarray.f' -! ------PIOLA SECTION--------------------------------------- - include 'ttb/libpiola.f' -! ------END FUNCTIONS--------------------------------------- -! ------BEGIN SUBROUTINES----------------------------------- - include 'ttb/libassignscalar.f' - include 'ttb/libassignarray.f' - include 'ttb/libassignten2sym.f' - - end module Tensor From 39b1881d4287f8b7bf73844fe9352d74cb287d20 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:03:09 +0200 Subject: [PATCH 09/16] Create ttb_library.f --- ttb/ttb_library.f | 493 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 493 insertions(+) create mode 100644 ttb/ttb_library.f diff --git a/ttb/ttb_library.f b/ttb/ttb_library.f new file mode 100644 index 00000000..c14c24ff --- /dev/null +++ b/ttb/ttb_library.f @@ -0,0 +1,493 @@ +! -----------MODULE TENSOR--------------------------------------- + module Tensor + ! --------------------------------------- + ! Tensor Toolbox Module for Fortran + ! Andreas Dutzler + ! Graz University of Technology + ! Institute of Structural Durability + ! and Railway Technology + ! 2022-04-10 + ! --------------------------------------- + ! tested on: Windows 10 (64bit) + ! - Intel Fortran >2015 + ! - MinGW gfortran >6.3 + ! --------------------------------------- + ! use this module in the following form: + ! --------------------------------------- + ! include 'ttb' + ! program sample + ! use Tensor + ! ... + ! end program sample + ! --------------------------------------- + + type Tensor1 + ! tensor of rank 1 + real(kind=8), dimension(3) :: a + end type Tensor1 + + type Tensor2 + ! tensor of rank 2 + real(kind=8), dimension(3,3) :: ab + end type Tensor2 + + type Tensor2S + ! symmetric tensor of rank 2 stored as vector + real(kind=8), dimension(6) :: a6 + end type Tensor2S + + type Tensor4 + ! tensor of rank 4 + real(kind=8), dimension(3,3,3,3) :: abcd + end type Tensor4 + + type Tensor4S + ! symmetric tensor of rank 4 stored as 6x6 matrix + real(kind=8), dimension(6, 6) :: a6b6 + end type Tensor4S + +! ------BEGIN INTERFACE------------------------------------- + interface operator (/) + module procedure div_10 + module procedure div_20 + module procedure div_20s + module procedure div_40 + module procedure div_40s + module procedure div_10_r4 + module procedure div_20_r4 + module procedure div_20s_r4 + module procedure div_40_r4 + module procedure div_40s_r4 + end interface + interface operator (.div.) + module procedure div_10 + module procedure div_20 + module procedure div_20s + module procedure div_40 + module procedure div_40s + module procedure div_10_r4 + module procedure div_20_r4 + module procedure div_20s_r4 + module procedure div_40_r4 + module procedure div_40s_r4 + end interface + + interface operator (*) + ! simple dot-product of rank 1 and rank 2 tensor combinations + module procedure dot_01 + module procedure dot_10 + module procedure dot_02 + module procedure dot_02s + module procedure dot_20 + module procedure dot_20s + module procedure dot_04 + module procedure dot_04s + module procedure dot_40 + module procedure dot_40s + module procedure dot_11 + module procedure dot_12 + module procedure dot_21 + module procedure dot_2s1 + module procedure dot_12s + module procedure dot_22 + module procedure dot_2s2s + module procedure dot_01_r4 + module procedure dot_10_r4 + module procedure dot_02_r4 + module procedure dot_02s_r4 + module procedure dot_20_r4 + module procedure dot_20s_r4 + module procedure dot_04_r4 + module procedure dot_04s_r4 + module procedure dot_40_r4 + module procedure dot_40s_r4 + end interface + interface operator (.dot.) + ! simple dot-product of rank 1 and rank 2 tensor combinations + module procedure dot_01 + module procedure dot_10 + module procedure dot_02 + module procedure dot_02s + module procedure dot_20 + module procedure dot_20s + module procedure dot_04 + module procedure dot_04s + module procedure dot_40 + module procedure dot_40s + module procedure dot_11 + module procedure dot_12 + module procedure dot_21 + module procedure dot_2s1 + module procedure dot_12s + module procedure dot_22 + module procedure dot_2s2s + module procedure dot_01_r4 + module procedure dot_10_r4 + module procedure dot_02_r4 + module procedure dot_02s_r4 + module procedure dot_20_r4 + module procedure dot_20s_r4 + module procedure dot_04_r4 + module procedure dot_04s_r4 + module procedure dot_40_r4 + module procedure dot_40s_r4 + end interface + + interface operator (**) + ! double dot-product of rank 1 and rank 2 tensor combinations + module procedure ddot_22 + module procedure ddot_2s2s + module procedure ddot_24 + module procedure ddot_2s4s + module procedure ddot_42 + module procedure ddot_4s2s + module procedure ddot_44 + module procedure ddot_4s4s + module procedure pow_2 + module procedure pow_2s + end interface + + interface operator (.ddot.) + ! double dot-product of rank 1 and rank 2 tensor combinations + module procedure ddot_22 + module procedure ddot_2s2s + module procedure ddot_24 + module procedure ddot_2s4s + module procedure ddot_42 + module procedure ddot_4s2s + module procedure ddot_44 + module procedure ddot_4s4s + end interface + + interface operator (.pow.) + module procedure pow_2 + module procedure pow_2s + end interface + + interface operator (+) + ! addition of rank 1 and rank 2 tensors + module procedure add_11 + module procedure add_22 + module procedure add_44 + module procedure add_2s2s + module procedure add_22s + module procedure add_2s2 + module procedure add_4s4s + module procedure add_44s + module procedure add_4s4 + end interface + interface operator (.add.) + ! addition of rank 1 and rank 2 tensors + module procedure add_11 + module procedure add_22 + module procedure add_44 + module procedure add_2s2s + module procedure add_22s + module procedure add_2s2 + module procedure add_4s4s + module procedure add_44s + module procedure add_4s4 + end interface + + interface operator (-) + ! subtraction of rank 1 and rank 2 tensors + module procedure sub_11 + module procedure sub_22 + module procedure sub_44 + module procedure sub_2s2s + module procedure sub_22s + module procedure sub_2s2 + module procedure sub_4s4s + module procedure sub_44s + module procedure sub_4s4 + end interface + interface operator (.sub.) + ! subtraction of rank 1 and rank 2 tensors + module procedure sub_11 + module procedure sub_22 + module procedure sub_44 + module procedure sub_2s2s + module procedure sub_22s + module procedure sub_2s2 + module procedure sub_4s4s + module procedure sub_44s + module procedure sub_4s4 + end interface + + interface operator (.dya.) + ! dyadic product of rank 2 and rank 4 tensor combinations + module procedure dyadic_11 + module procedure dyadic_22 + module procedure dyadic_2s2s + end interface + + interface operator (.cdya.) + ! symmetric crossed dyadic product of rank 2 tensor combinations + ! (i,j,k,l) = 1/2 * (i,k,j,l)*(i,l,j,k) + module procedure crossdyadic_22 + module procedure crossdyadic_2s2s + end interface + + interface operator (.icdya.) + ! inner crossed dyadic product of rank 2 tensor combinations + ! (i,j,k,l) = (i,k,j,l) + module procedure icrossdyadic_22 + module procedure icrossdyadic_2s2s + end interface + + interface fact + module procedure fact_i + end interface + + interface tr + module procedure tr_2 + module procedure tr_2s + end interface + + interface det + module procedure det_2 + module procedure det_2s + end interface + + interface dev + module procedure dev_2 + module procedure dev_2s + end interface + + interface unimodular + module procedure unimod_2 + module procedure unimod_2s + module procedure unimod_2d + module procedure unimod_2sd + end interface + + interface inv + module procedure inv_2 + module procedure inv_2s + module procedure inv2d + module procedure inv2sd + end interface + + interface norm + module procedure norm_1 + module procedure norm_2 + module procedure norm_2s + end interface + + interface exp + module procedure exp_2 + module procedure exp_2s + end interface + + interface derivative_exp + module procedure dexp_2 + module procedure dexp_2s + end interface + + interface ln + module procedure ln_2 + module procedure ln_2s + end interface + + + interface sqrt + module procedure sqrt_1 + module procedure stretch_2 + module procedure stretch_2s + end interface + + interface dsqrt + module procedure sqrt_1 + module procedure stretch_2 + module procedure stretch_2s + end interface + + interface rotation_matrix + module procedure rotation_2 + end interface + + interface identity2 + module procedure ident_2 + module procedure ident_2s + end interface + + interface identity4 + module procedure ident_4 + module procedure ident_4s + end interface + + interface tensorstore + module procedure tenstore_2 + module procedure tenstore_2a + module procedure tenstore_2s + module procedure tenstore_4 + module procedure tenstore_4a + module procedure tenstore_4s + end interface + + interface astensor + module procedure tenstore_2 + module procedure tenstore_2a + module procedure tenstore_2s + module procedure tenstore_4 + module procedure tenstore_4a + module procedure tenstore_4s + end interface + + interface symstore + module procedure symstore_2 + module procedure symstore_4 + module procedure symstore_2s + module procedure symstore_4s + module procedure symstore_2sa + module procedure symstore_4sa + end interface + + interface strain + ! module procedure str2ten_2 + module procedure str2ten_2s + end interface + + interface asvoigt + module procedure symstore_2 + module procedure symstore_4 + module procedure symstore_2s + module procedure symstore_4s + module procedure symstore_2sa + module procedure symstore_4sa + end interface + + interface voigt + module procedure symstore_2 + module procedure symstore_4 + module procedure symstore_2s + module procedure symstore_4s + module procedure symstore_2sa + module procedure symstore_4sa + end interface + + interface reduce_dim + module procedure reduce_dim_2s + module procedure reduce_dim_4s + end interface + + interface permute + ! double dot-product of rank 1 and rank 2 tensor combinations + module procedure permute_2 + module procedure permute_2s + module procedure permute_4 + module procedure permute_4s + end interface + + interface transpose + module procedure transp2 + module procedure transp2s + module procedure transp4 + module procedure transp4s + end interface + + interface piola + module procedure piola2 + module procedure piola2s + module procedure piola4 + module procedure piola4s + end interface + + interface asarray + module procedure asarray_1 + module procedure asarray_2 + module procedure asarray_4 + module procedure asarray_2s + module procedure asarray_4s + end interface + + interface asabqarray + module procedure asabqarray_2s + module procedure asabqarray_4s + end interface + + interface assignment (=) + module procedure assignscalar_1 + module procedure assignscalar_2 + module procedure assignscalar_2s + module procedure assignscalar_4 + module procedure assignscalar_4s + module procedure assignarr_1 + module procedure assignarr_2 + module procedure assignarr_2s + module procedure assignarr_4 + module procedure assignarr_4s + module procedure assignten2sym_2 + module procedure assignten2sym_4 + module procedure assignsym2ten_2 + module procedure assignsym2ten_4 + module procedure assignscalar_1r4 + module procedure assignscalar_2r4 + module procedure assignscalar_2sr4 + module procedure assignscalar_4r4 + module procedure assignscalar_4sr4 + module procedure assignarr_2r4 + module procedure assignarr_2sr4 + module procedure assignarr_4r4 + module procedure assignarr_4sr4 + end interface +! ------END INTERFACE--------------------------------------- + + contains + +! ------BEGIN FUNCTIONS------------------------------------- +! ------MATH TOOLS SECTION---------------------------------- + include 'ttb/libtools.f' +! ------+/- SECTION----------------------------------------- + include 'ttb/libadd.f' + include 'ttb/libsub.f' +! ------DIVISION SECTION------------------------------------ + include 'ttb/libdiv.f' +! ------DOT SECTION----------------------------------------- + include 'ttb/libdot.f' +! ------DOUBLE DOT SECTION---------------------------------- + include 'ttb/libddot.f' +! ------POWER SECTION--------------------------------------- + include 'ttb/libpower.f' +! ------DYADIC SECTION-------------------------------------- + include 'ttb/libdyadic.f' +! ------CROSS-DYADIC SECTION-------------------------------- + include 'ttb/libcrossdyadic.f' + include 'ttb/libinnercrossdyadic.f' +! ------PERMUTE SECTION------------------------------------- + include 'ttb/libpermute.f' +! ------TENSOR FUNCTION SECTION----------------------------- + include 'ttb/libtransp.f' + include 'ttb/libtrace.f' + include 'ttb/libdet.f' + include 'ttb/libdev.f' + include 'ttb/libunimodular.f' + include 'ttb/libinv.f' + include 'ttb/libexp.f' + include 'ttb/libderivativeexp.f' + include 'ttb/libln.f' + include 'ttb/libnorm.f' + include 'ttb/libsqrt.f' + include 'ttb/librotation.f' +! ------TENSOR INITIALIZATION SECTION----------------------- + include 'ttb/libidentity.f' +! ------SYMSTORE SECTION------------------------------------ + include 'ttb/libsymstore.f' +! ------USYMSTORE SECTION----------------------------------- + include 'ttb/libtenstore.f' +! ------STRAINSTORE SECTION--------------------------------- + include 'ttb/libstrainstore.f' +! ------REDUCE DIM. SECTION--------------------------------- + include 'ttb/libreducedim.f' +! ------AS ARRAY SECTION------------------------------------ + include 'ttb/libasarray.f' + include 'ttb/libasabqarray.f' +! ------PIOLA SECTION--------------------------------------- + include 'ttb/libpiola.f' +! ------END FUNCTIONS--------------------------------------- +! ------BEGIN SUBROUTINES----------------------------------- + include 'ttb/libassignscalar.f' + include 'ttb/libassignarray.f' + include 'ttb/libassignten2sym.f' + + end module Tensor From 7fd784ac7142ec55b01792ca70c86e66338248be Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:03:28 +0200 Subject: [PATCH 10/16] Update version.txt raise to v1.1.0 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index e6d5cb83..1cc5f657 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.2 \ No newline at end of file +1.1.0 \ No newline at end of file From a181d5a950953f90b3e9eb788030f9b681658a88 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:11:39 +0200 Subject: [PATCH 11/16] change `real` to `real(kind=4)` fixes #24 --- ttb/libassignarray.f | 10 +++++----- ttb/libassignscalar.f | 10 +++++----- ttb/libdiv.f | 10 +++++----- ttb/libdot.f | 20 ++++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ttb/libassignarray.f b/ttb/libassignarray.f index d6c4ff10..91588153 100644 --- a/ttb/libassignarray.f +++ b/ttb/libassignarray.f @@ -12,7 +12,7 @@ subroutine assignarr_2sr4(T,A) implicit none type(Tensor2s), intent(inout) :: T - real, dimension(6), intent(in) :: A + real(kind=4), dimension(6), intent(in) :: A T%a6 = dble(A) @@ -32,7 +32,7 @@ subroutine assignarr_4sr4(T,A) implicit none type(Tensor4s), intent(inout) :: T - real, dimension(6,6), intent(in) :: A + real(kind=4), dimension(6,6), intent(in) :: A T%a6b6 = dble(A) @@ -52,7 +52,7 @@ subroutine assignarr_1r4(T,A) implicit none type(Tensor1), intent(inout) :: T - real, dimension(3), intent(in) :: A + real(kind=4), dimension(3), intent(in) :: A T%a = dble(A) @@ -72,7 +72,7 @@ subroutine assignarr_2r4(T,A) implicit none type(Tensor2), intent(inout) :: T - real, dimension(3,3), intent(in) :: A + real(kind=4), dimension(3,3), intent(in) :: A T%ab = dble(A) @@ -92,7 +92,7 @@ subroutine assignarr_4r4(T,A) implicit none type(Tensor4), intent(inout) :: T - real, dimension(3,3,3,3), intent(in) :: A + real(kind=4), dimension(3,3,3,3), intent(in) :: A T%abcd = dble(A) diff --git a/ttb/libassignscalar.f b/ttb/libassignscalar.f index 3f1626eb..99b72108 100644 --- a/ttb/libassignscalar.f +++ b/ttb/libassignscalar.f @@ -12,7 +12,7 @@ subroutine assignscalar_2sr4(T,w) implicit none type(Tensor2s), intent(inout) :: T - real, intent(in) :: w + real(kind=4), intent(in) :: w T%a6 = T%a6*dble(w) @@ -32,7 +32,7 @@ subroutine assignscalar_4sr4(T,w) implicit none type(Tensor4s), intent(inout) :: T - real, intent(in) :: w + real(kind=4), intent(in) :: w T%a6b6 = T%a6b6*dble(w) @@ -52,7 +52,7 @@ subroutine assignscalar_1r4(T,w) implicit none type(Tensor1), intent(inout) :: T - real, intent(in) :: w + real(kind=4), intent(in) :: w T%a = T%a*dble(w) @@ -72,7 +72,7 @@ subroutine assignscalar_2r4(T,w) implicit none type(Tensor2), intent(inout) :: T - real, intent(in) :: w + real(kind=4), intent(in) :: w T%ab = T%ab*dble(w) @@ -92,7 +92,7 @@ subroutine assignscalar_4r4(T,w) implicit none type(Tensor4), intent(inout) :: T - real, intent(in) :: w + real(kind=4), intent(in) :: w T%abcd = T%abcd*dble(w) diff --git a/ttb/libdiv.f b/ttb/libdiv.f index ebcf1b12..91f4ab50 100644 --- a/ttb/libdiv.f +++ b/ttb/libdiv.f @@ -57,7 +57,7 @@ end function div_40s function div_10_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor1), intent(in) :: T type(Tensor1) :: div_10_r4 @@ -68,7 +68,7 @@ end function div_10_r4 function div_20_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor2), intent(in) :: T type(Tensor2) :: div_20_r4 @@ -79,7 +79,7 @@ end function div_20_r4 function div_20s_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor2s), intent(in) :: T type(Tensor2s) :: div_20s_r4 @@ -90,7 +90,7 @@ end function div_20s_r4 function div_40_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor4), intent(in) :: T type(Tensor4) :: div_40_r4 @@ -101,7 +101,7 @@ end function div_40_r4 function div_40s_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor4s), intent(in) :: T type(Tensor4s) :: div_40s_r4 diff --git a/ttb/libdot.f b/ttb/libdot.f index 841a6eff..c1c47a30 100644 --- a/ttb/libdot.f +++ b/ttb/libdot.f @@ -114,7 +114,7 @@ end function dot_40s function dot_01_r4(w, T) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor1), intent(in) :: T type(Tensor1) :: dot_01_r4 @@ -125,7 +125,7 @@ end function dot_01_r4 function dot_10_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor1), intent(in) :: T type(Tensor1) :: dot_10_r4 @@ -136,7 +136,7 @@ end function dot_10_r4 function dot_02_r4(w, T) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor2), intent(in) :: T type(Tensor2) :: dot_02_r4 @@ -147,7 +147,7 @@ end function dot_02_r4 function dot_02s_r4(w, T) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor2s), intent(in) :: T type(Tensor2s) :: dot_02s_r4 @@ -158,7 +158,7 @@ end function dot_02s_r4 function dot_20_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor2), intent(in) :: T type(Tensor2) :: dot_20_r4 @@ -169,7 +169,7 @@ end function dot_20_r4 function dot_20s_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor2s), intent(in) :: T type(Tensor2s) :: dot_20s_r4 @@ -180,7 +180,7 @@ end function dot_20s_r4 function dot_04_r4(w, T) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor4), intent(in) :: T type(Tensor4) :: dot_04_r4 @@ -191,7 +191,7 @@ end function dot_04_r4 function dot_04s_r4(w, T) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor4s), intent(in) :: T type(Tensor4s) :: dot_04s_r4 @@ -202,7 +202,7 @@ end function dot_04s_r4 function dot_40_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor4), intent(in) :: T type(Tensor4) :: dot_40_r4 @@ -213,7 +213,7 @@ end function dot_40_r4 function dot_40s_r4(T, w) implicit none - real, intent(in) :: w + real(kind=4), intent(in) :: w type(Tensor4s), intent(in) :: T type(Tensor4s) :: dot_40s_r4 From 59fa91bad14c9c63ef7540f1b72c16a9f109a69e Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:25:58 +0200 Subject: [PATCH 12/16] remove google analytics --- docs/_config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/_config.yml b/docs/_config.yml index 5dcd0ded..41a2f5ba 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -3,5 +3,4 @@ theme: jekyll-theme-cayman title: Tensor Toolbox for Modern Fortran description: High-Level Tensor Manipulation in Fortran -show_downloads: true -google_analytics: UA-111667836-1 \ No newline at end of file +show_downloads: true \ No newline at end of file From de669acca0adeded5b1547aaa6b4412cc5d6f907 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:26:18 +0200 Subject: [PATCH 13/16] Update quickstartguide.md change imports, see #24 --- docs/quickstartguide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/quickstartguide.md b/docs/quickstartguide.md index 11b374f7..1d28a4a4 100644 --- a/docs/quickstartguide.md +++ b/docs/quickstartguide.md @@ -2,7 +2,7 @@ The most basic example on how to use this module is to [download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the 'ttb'-Folder in your working directory and add two lines of code: ```fortran -#include 'ttb/ttb_library.F' + include 'ttb/ttb_library.f' program script101_ttb use Tensor @@ -12,6 +12,6 @@ The most basic example on how to use this module is to [download the module](htt 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. Be sure to save your files with **UPPERCASE** file endings, e.g. `file.F` instead of `file.f`. This tells the Fortran compiler to use a preprocessor. +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. Continue to [Example](example.md) section. For a list and detailed information of available functions go [here](functions.md). \ No newline at end of file From 736a6544b6958c6a68e8cc907eecd750d22feae3 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:31:07 +0200 Subject: [PATCH 14/16] Update example_stvenantkirchhoff.md fix imports, see #24 --- docs/example_stvenantkirchhoff.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/example_stvenantkirchhoff.md b/docs/example_stvenantkirchhoff.md index 011a7bbd..6c633442 100644 --- a/docs/example_stvenantkirchhoff.md +++ b/docs/example_stvenantkirchhoff.md @@ -15,7 +15,7 @@ and Before we are able to add our own user code, we have to start with an empty fortran subroutine header for MSC.Marc's HYPELA2. Similar headers are provided for Abaqus, ANSYS, etc in the corresponding manuals. ```fortran -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, @@ -138,7 +138,7 @@ If we would like to use the Updated Lagrange framework too, we'll have to check endif ``` -In this code `iupdat` is an integer with `0` for total lagrange and `1` for updated lagrange. You may download the whole example as a [HYPELA2 user subroutine](examples/hypela2_stvenantkirchhoff.F) for MSC.Marc. +In this code `iupdat` is an integer with `0` for total lagrange and `1` for updated lagrange. You may download the whole example as a [HYPELA2 user subroutine](examples/hypela2_stvenantkirchhoff.f) for MSC.Marc. ## Sources [1] Bonet, J., Gil, A. J., & Wood, R. D. (2016). Nonlinear Solid Mechanics for Finite Element Analysis: Statics. Cambridge University Press. [![DOI:10.1017/cbo9781316336144](https://zenodo.org/badge/DOI/10.1017/cbo9781316336144.svg)](https://doi.org/10.1017/cbo9781316336144) From b8a5d9b2efa7c4e9bdad198ec2f2627d4b24344e Mon Sep 17 00:00:00 2001 From: Andreas D Date: Sun, 10 Apr 2022 22:38:32 +0200 Subject: [PATCH 15/16] change imports in code-blocks of docs see #24 --- docs/example.md | 4 ++-- docs/example_neohooke.md | 4 ++-- docs/examples/{hypela2_nh_ttb.F => hypela2_nh_ttb.f} | 2 +- ...hypela2_nh_ttb_simple.F => hypela2_nh_ttb_simple.f} | 2 +- ...lasticity.F => hypela2_nonlinear_viscoelasticity.f} | 2 +- ...stvenantkirchhoff.F => hypela2_stvenantkirchhoff.f} | 2 +- docs/examples/{script_umat.F => script_umat.f} | 2 +- .../{umat_nh_ttb_simple.F => umat_nh_ttb_simple.f} | 2 +- docs/installation.md | 10 +--------- 9 files changed, 11 insertions(+), 19 deletions(-) rename docs/examples/{hypela2_nh_ttb.F => hypela2_nh_ttb.f} (99%) rename docs/examples/{hypela2_nh_ttb_simple.F => hypela2_nh_ttb_simple.f} (98%) rename docs/examples/{hypela2_nonlinear_viscoelasticity.F => hypela2_nonlinear_viscoelasticity.f} (99%) rename docs/examples/{hypela2_stvenantkirchhoff.F => hypela2_stvenantkirchhoff.f} (98%) rename docs/examples/{script_umat.F => script_umat.f} (98%) rename docs/examples/{umat_nh_ttb_simple.F => umat_nh_ttb_simple.f} (98%) diff --git a/docs/example.md b/docs/example.md index 209270a5..08ed3160 100644 --- a/docs/example.md +++ b/docs/example.md @@ -29,7 +29,7 @@ with the fourth order identity tensor The two equations are now implemented in a Total Lagrange user subroutine with the help of this Tensor module as follows: ```fortran -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, @@ -95,4 +95,4 @@ The two equations are now implemented in a Total Lagrange user subroutine with end ``` -There are also examples for a [basic understandig of the tensor toolbox](examples/script_umat.F), the implementation of the [St.Venant Kirchhoff material](example_stvenantkirchhoff.md) and a [full featured MSC.Marc Neo-Hookean material HYPELA2 user subroutine](examples/hypela2_nh_ttb.F). +There are also examples for a [basic understandig of the tensor toolbox](examples/script_umat.f), the implementation of the [St.Venant Kirchhoff material](example_stvenantkirchhoff.md) and a [full featured MSC.Marc Neo-Hookean material HYPELA2 user subroutine](examples/hypela2_nh_ttb.f). diff --git a/docs/example_neohooke.md b/docs/example_neohooke.md index 387fa010..2c88e4a2 100644 --- a/docs/example_neohooke.md +++ b/docs/example_neohooke.md @@ -29,7 +29,7 @@ with the fourth order identity tensor The two equations are now implemented in a Total Lagrange user subroutine with the help of this Tensor module as follows: ```fortran -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, @@ -95,4 +95,4 @@ The two equations are now implemented in a Total Lagrange user subroutine with end ``` -There are also examples for a [basic understandig of the tensor toolbox](examples/script_umat.F), the implementation of the [St.Venant Kirchhoff material](example_stvenantkirchhoff.md) and a [full featured MSC.Marc Neo-Hookean material HYPELA2 user subroutine](examples/hypela2_nh_ttb.F). +There are also examples for a [basic understandig of the tensor toolbox](examples/script_umat.f), the implementation of the [St.Venant Kirchhoff material](example_stvenantkirchhoff.md) and a [full featured MSC.Marc Neo-Hookean material HYPELA2 user subroutine](examples/hypela2_nh_ttb.f). diff --git a/docs/examples/hypela2_nh_ttb.F b/docs/examples/hypela2_nh_ttb.f similarity index 99% rename from docs/examples/hypela2_nh_ttb.F rename to docs/examples/hypela2_nh_ttb.f index 7dd95f62..670f6224 100644 --- a/docs/examples/hypela2_nh_ttb.F +++ b/docs/examples/hypela2_nh_ttb.f @@ -1,4 +1,4 @@ -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, diff --git a/docs/examples/hypela2_nh_ttb_simple.F b/docs/examples/hypela2_nh_ttb_simple.f similarity index 98% rename from docs/examples/hypela2_nh_ttb_simple.F rename to docs/examples/hypela2_nh_ttb_simple.f index 42b6e6b7..0cdfe6f7 100644 --- a/docs/examples/hypela2_nh_ttb_simple.F +++ b/docs/examples/hypela2_nh_ttb_simple.f @@ -1,4 +1,4 @@ -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, diff --git a/docs/examples/hypela2_nonlinear_viscoelasticity.F b/docs/examples/hypela2_nonlinear_viscoelasticity.f similarity index 99% rename from docs/examples/hypela2_nonlinear_viscoelasticity.F rename to docs/examples/hypela2_nonlinear_viscoelasticity.f index a6f6cdd8..74299598 100644 --- a/docs/examples/hypela2_nonlinear_viscoelasticity.F +++ b/docs/examples/hypela2_nonlinear_viscoelasticity.f @@ -1,4 +1,4 @@ -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, diff --git a/docs/examples/hypela2_stvenantkirchhoff.F b/docs/examples/hypela2_stvenantkirchhoff.f similarity index 98% rename from docs/examples/hypela2_stvenantkirchhoff.F rename to docs/examples/hypela2_stvenantkirchhoff.f index b4f72e87..a2ec4725 100644 --- a/docs/examples/hypela2_stvenantkirchhoff.F +++ b/docs/examples/hypela2_stvenantkirchhoff.f @@ -1,4 +1,4 @@ -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi, 2 nshear,disp,dispt,coord,ffn,frotn,strechn,eigvn,ffn1, diff --git a/docs/examples/script_umat.F b/docs/examples/script_umat.f similarity index 98% rename from docs/examples/script_umat.F rename to docs/examples/script_umat.f index 1ae859b9..8e8345f2 100644 --- a/docs/examples/script_umat.F +++ b/docs/examples/script_umat.f @@ -1,4 +1,4 @@ -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' program script_tensortoolbox diff --git a/docs/examples/umat_nh_ttb_simple.F b/docs/examples/umat_nh_ttb_simple.f similarity index 98% rename from docs/examples/umat_nh_ttb_simple.F rename to docs/examples/umat_nh_ttb_simple.f index 7eb2f9af..93f7ac28 100644 --- a/docs/examples/umat_nh_ttb_simple.F +++ b/docs/examples/umat_nh_ttb_simple.f @@ -1,4 +1,4 @@ -#include "ttb/ttb_library.F" + include 'ttb/ttb_library.f' SUBROUTINE UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD, 1 RPL,DDSDDT,DRPLDE,DRPLDT, diff --git a/docs/installation.md b/docs/installation.md index df2a61b2..81b03319 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -4,12 +4,4 @@ This Toolbox is a fortran module which can be used inside modern Fortran compile This Toolbox is tested on Windows with both Intel Fortran >2015 (in combination with MSC.Marc) and GFortran >6.3. If you are using Linux it **should** work (but it is untested). ## Download -[Download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the `ttb`-Folder in your working directory and you are ready to dive into comfortable tensor manipulations in Fortran. - -## A note on LS-DYNA Users -If you have problems as reported [here] (https://github.com/adtzlr/ttb/issues/10), please add the following line **before** the Tensor-Toolbox include statement. This deactivates tensor with single-precision scalar multiplications and divisions. **Warning**: Now take care to only use double-precision constants in your code! - -```fortran -#define NOR4 -#include "ttb/ttb_library.F" -``` \ No newline at end of file +[Download the module](https://github.com/adtzlr/ttb/archive/main.zip), put the `ttb`-Folder in your working directory and you are ready to dive into comfortable tensor manipulations in Fortran. \ No newline at end of file From a3e01c646e1a74dc975364ab18df488552eb62d6 Mon Sep 17 00:00:00 2001 From: Andreas D Date: Tue, 12 Apr 2022 18:20:32 +0200 Subject: [PATCH 16/16] fix how-to include in `ttb_library.f` change to `! include 'ttb/ttb_library.f'` --- ttb/ttb_library.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttb/ttb_library.f b/ttb/ttb_library.f index c14c24ff..0cace249 100644 --- a/ttb/ttb_library.f +++ b/ttb/ttb_library.f @@ -14,7 +14,7 @@ module Tensor ! --------------------------------------- ! use this module in the following form: ! --------------------------------------- - ! include 'ttb' + ! include 'ttb/ttb_library.f' ! program sample ! use Tensor ! ...