├── .gitignore ├── AbaqusSetup.md ├── LICENSE ├── README.md ├── models ├── CrystalPlasticity │ ├── AceGen │ │ ├── CrystalPlasticity.nb │ │ ├── ElasticLaw.nb │ │ ├── ElasticSetup.nb │ │ ├── GetFunctions.nb │ │ ├── IsotropicHardening.nb │ │ ├── KinematicHardening.nb │ │ ├── MainFile.nb │ │ ├── OverstressFunction.nb │ │ ├── ResidualSetup.nb │ │ ├── SubroutineGeneration.nb │ │ └── combine_files.py │ ├── doc │ │ └── CrystalPlasticity.md │ ├── python │ │ ├── .idea │ │ │ ├── CrystalPlasticity.iml │ │ │ ├── codeStyles │ │ │ │ └── codeStyleConfig.xml │ │ │ ├── misc.xml │ │ │ ├── modules.xml │ │ │ ├── vcs.xml │ │ │ └── workspace.xml │ │ ├── OrientationResults.pdf │ │ ├── OrientationResults.xlsx │ │ ├── SimpleShearTest.pdf │ │ ├── SlipSystems.py │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ └── orientation.cpython-36.pyc │ │ ├── csys_rotation.py │ │ ├── optimize_rotations.py │ │ └── orientation.py │ ├── ref.bib │ └── src │ │ ├── CMakeLists.txt │ │ ├── Hutchinson1976exp_Lindfeldt_AF_bcc.f90 │ │ ├── Hutchinson1976exp_Lindfeldt_AF_iso_bcc.f90 │ │ ├── abaqus_compile_files.txt │ │ ├── cmake_compile_models.txt │ │ ├── crystal_orientations_mod.f90 │ │ ├── rand16384mod.f90 │ │ ├── rand512mod.f90 │ │ ├── random_mod.f90 │ │ ├── taylor_model.f90 │ │ ├── umat.f90 │ │ ├── umat_module.f90 │ │ └── uniform_mod.f90 ├── GenFiniteStrain │ ├── AceGen │ │ ├── AGfiles │ │ │ ├── EF1_FE1_SC1.f90 │ │ │ ├── EF1_FE1_SC2.f90 │ │ │ ├── EF1_FE2_SC1.f90 │ │ │ ├── EF1_FE2_SC2.f90 │ │ │ ├── EF1_FE3_SC1.f90 │ │ │ ├── EF1_FE3_SC2.f90 │ │ │ ├── EF2_FE1_SC1.f90 │ │ │ ├── EF3_FE1_SC1.f90 │ │ │ ├── EF4_FE1_SC1.f90 │ │ │ ├── EoutF_FE1.f90 │ │ │ ├── EoutF_FE2.f90 │ │ │ ├── EoutF_FE3.f90 │ │ │ ├── RF1_FE1_EV1_SC1.f90 │ │ │ ├── RF1_FE1_EV1_SC2.f90 │ │ │ ├── RF1_FE1_EV2_SC1.f90 │ │ │ ├── RF1_FE2_EV1_SC1.f90 │ │ │ ├── RF1_FE2_EV1_SC2.f90 │ │ │ ├── RF1_FE3_EV1_SC1.f90 │ │ │ ├── RF1_FE3_EV1_SC2.f90 │ │ │ ├── RF2_FE1_EV1_SC1.f90 │ │ │ ├── RF2_FE1_EV2_SC1.f90 │ │ │ ├── RF3_FE1_EV1_SC1.f90 │ │ │ ├── RF3_FE1_EV2_SC1.f90 │ │ │ ├── RF4_FE1_EV1_SC1.f90 │ │ │ ├── RF4_FE1_EV2_SC1.f90 │ │ │ ├── dRdF1_FE1_EV1_SC1.f90 │ │ │ ├── dRdF1_FE1_EV1_SC2.f90 │ │ │ ├── dRdF1_FE1_EV2_SC1.f90 │ │ │ ├── dRdF1_FE2_EV1_SC1.f90 │ │ │ ├── dRdF1_FE2_EV1_SC2.f90 │ │ │ ├── dRdF1_FE3_EV1_SC1.f90 │ │ │ ├── dRdF1_FE3_EV1_SC2.f90 │ │ │ ├── dRdF2_FE1_EV1_SC1.f90 │ │ │ ├── dRdF2_FE1_EV2_SC1.f90 │ │ │ ├── dRdF3_FE1_EV1_SC1.f90 │ │ │ ├── dRdF3_FE1_EV2_SC1.f90 │ │ │ ├── dRdF4_FE1_EV1_SC1.f90 │ │ │ ├── dRdF4_FE1_EV2_SC1.f90 │ │ │ ├── dRdX1_FE1_EV1_SC1.f90 │ │ │ ├── dRdX1_FE1_EV1_SC2.f90 │ │ │ ├── dRdX1_FE1_EV2_SC1.f90 │ │ │ ├── dRdX1_FE2_EV1_SC1.f90 │ │ │ ├── dRdX1_FE2_EV1_SC2.f90 │ │ │ ├── dRdX1_FE3_EV1_SC1.f90 │ │ │ ├── dRdX1_FE3_EV1_SC2.f90 │ │ │ ├── dRdX2_FE1_EV1_SC1.f90 │ │ │ ├── dRdX2_FE1_EV2_SC1.f90 │ │ │ ├── dRdX3_FE1_EV1_SC1.f90 │ │ │ ├── dRdX3_FE1_EV2_SC1.f90 │ │ │ ├── dRdX4_FE1_EV1_SC1.f90 │ │ │ └── dRdX4_FE1_EV2_SC1.f90 │ │ ├── EF1_FE1_SC1.m │ │ ├── ElasticFunction.nb │ │ ├── ElasticOutFunction.nb │ │ ├── GFS_AG_FE1_EV1_SC1.f90 │ │ ├── GFS_AG_FE1_EV1_SC2.f90 │ │ ├── GFS_AG_FE1_EV2_SC1.f90 │ │ ├── GFS_AG_FE2_EV1_SC1.f90 │ │ ├── GFS_AG_FE2_EV1_SC2.f90 │ │ ├── GFS_AG_FE3_EV1_SC1.f90 │ │ ├── GFS_AG_FE3_EV1_SC2.f90 │ │ ├── JacobianFunction.nb │ │ ├── RF1_FE1_EV1_SC1.f90 │ │ ├── RF1_FE1_EV1_SC1.m │ │ ├── RF1_FE1_EV1_SC2.m │ │ ├── ResidualFunction.nb │ │ ├── ResidualSetup │ │ ├── ResidualSetup.nb │ │ ├── SpecialFunctions │ │ ├── SpecialFunctions.nb │ │ ├── create_AGfiles.m │ │ ├── dRdFFunction.nb │ │ └── findprefix.m │ ├── doc │ │ ├── gfs_bc.md │ │ └── gfs_ob.md │ ├── ref.bib │ └── src │ │ ├── CMakeLists.txt │ │ ├── GFS_module.f90 │ │ ├── GeneralFiniteStrain.for │ │ ├── abaqus_compile_files.txt │ │ ├── gfs_bc.f90 │ │ ├── gfs_ob.f90 │ │ └── smsutility.f90 ├── GenSmallStrain │ ├── AceGen │ │ ├── JacobianFunction.nb │ │ ├── ResidualFunction.nb │ │ ├── ResidualSetup │ │ ├── SpecialFunctions │ │ ├── TensorsToolboxMathematica │ │ └── make_acegen_mods.py │ ├── doc │ │ ├── chaboche.md │ │ ├── chaboche_cowsym.md │ │ ├── chaboche_delobelle.md │ │ ├── chaboche_norton.md │ │ ├── delobelle.md │ │ ├── delobelle_cowsym.md │ │ ├── delobelle_delobelle.md │ │ ├── delobelle_norton.md │ │ ├── description.pdf │ │ ├── latex │ │ │ ├── MyCustomCommands.sty │ │ │ ├── Settings.tex │ │ │ └── description.tex │ │ ├── ohnowang.md │ │ ├── ohnowang_cowsym.md │ │ ├── ohnowang_delobelle.md │ │ └── ohnowang_norton.md │ ├── ref.bib │ └── src │ │ ├── CMakeLists.txt │ │ ├── GeneralSmallStrain.f90 │ │ ├── abaqus_compile_files.txt │ │ ├── chaboche.f90 │ │ ├── chaboche_acegen_mod.f90 │ │ ├── chaboche_cowsym_acegen_mod.f90 │ │ ├── chaboche_delobelle_acegen_mod.f90 │ │ ├── chaboche_norton_acegen_mod.f90 │ │ ├── chaboche_rdep.f90 │ │ ├── cmake_compile_models.txt │ │ ├── delobelle.f90 │ │ ├── delobelle_acegen_mod.f90 │ │ ├── delobelle_cowsym_acegen_mod.f90 │ │ ├── delobelle_delobelle_acegen_mod.f90 │ │ ├── delobelle_norton_acegen_mod.f90 │ │ ├── delobelle_rdep.f90 │ │ ├── gss_module.f90 │ │ ├── ohnowang.f90 │ │ ├── ohnowang_acegen_mod.f90 │ │ ├── ohnowang_cowsym_acegen_mod.f90 │ │ ├── ohnowang_delobelle_acegen_mod.f90 │ │ ├── ohnowang_norton_acegen_mod.f90 │ │ └── ohnowang_rdep.f90 ├── MM2021 │ ├── acegen_rmodel │ │ ├── DistortionalHardening.nb │ │ ├── ElasticLaw.nb │ │ ├── ElasticSetup.nb │ │ ├── GetFunctions.nb │ │ ├── IsotropicHardening.nb │ │ ├── KinematicHardening.nb │ │ ├── MainFile.nb │ │ ├── ResidualSetup.nb │ │ ├── SubroutineGeneration.nb │ │ ├── combine_files.py │ │ ├── elastic.f90 │ │ ├── jacobian.f90 │ │ ├── model_size.f90 │ │ ├── plastic_output.f90 │ │ ├── residual.f90 │ │ ├── rmodel.f90 │ │ ├── rmodel_ISO2_BC2.f90 │ │ └── tmpinfo.txt │ ├── acegen_symyld │ │ ├── DistortionalHardening.nb │ │ ├── ElasticLaw.nb │ │ ├── ElasticSetup.nb │ │ ├── GetFunctions.nb │ │ ├── IsotropicHardening.nb │ │ ├── KinematicHardening.nb │ │ ├── MainFile.nb │ │ ├── ResidualSetup.nb │ │ ├── SubroutineGeneration.nb │ │ ├── combine_files.py │ │ ├── disthard_ISO2_BC2.f90 │ │ ├── elastic.f90 │ │ ├── jacobian.f90 │ │ ├── model_size.f90 │ │ ├── plastic_output.f90 │ │ ├── residual.f90 │ │ └── tmpinfo.txt │ ├── doc │ │ ├── readme.md │ │ ├── rmodel.md │ │ └── symyld.md │ ├── ref.bib │ └── src │ │ ├── CMakeLists.txt │ │ ├── abaqus_compile_files.txt │ │ ├── disthard_ISO2_BC2.f90 │ │ ├── rmodel.f90 │ │ ├── rmodel_ISO2_BC2.f90 │ │ ├── umat.f90 │ │ └── umat_module.f90 ├── Qin2018 │ ├── acegen │ │ ├── ElasticLaw.nb │ │ ├── ElasticSetup.nb │ │ ├── GetFunctions.nb │ │ ├── Hardening.nb │ │ ├── KinematicHardening.nb │ │ ├── MainFile.nb │ │ ├── Qin2018_AF2.f90 │ │ ├── Qin2018_BC2.f90 │ │ ├── ResidualSetup.nb │ │ ├── SubroutineGeneration.nb │ │ ├── combine_files.py │ │ ├── elastic.f90 │ │ ├── jacobian.f90 │ │ ├── model_size.f90 │ │ ├── plastic_output.f90 │ │ ├── residual.f90 │ │ └── tmpinfo.txt │ ├── doc │ │ └── Qin2018.md │ ├── ref.bib │ └── src │ │ ├── CMakeLists.txt │ │ ├── Qin2018_AF2.f90 │ │ ├── Qin2018_BC2.f90 │ │ ├── abaqus_compile_files.txt │ │ ├── umat.f90 │ │ └── umat_module.f90 ├── Shi2014 │ ├── acegen │ │ ├── DistortionalHardening.nb │ │ ├── ElasticLaw.nb │ │ ├── ElasticSetup.nb │ │ ├── GetFunctions.nb │ │ ├── IsotropicHardening.nb │ │ ├── KinematicHardening.nb │ │ ├── MainFile.nb │ │ ├── ResidualSetup.nb │ │ ├── Shi2014exp_AF2.f90 │ │ ├── Shi2014exp_BC2.f90 │ │ ├── SpecialFunctions.nb │ │ ├── SubroutineGeneration.nb │ │ ├── TestExp.nb │ │ ├── combine_files.py │ │ ├── elastic.f90 │ │ ├── jacobian.f90 │ │ ├── model_size.f90 │ │ ├── plastic_output.f90 │ │ ├── residual.f90 │ │ └── tmpinfo.txt │ ├── doc │ │ ├── Shi2014exp_AF.md │ │ └── Shi2014exp_BC.md │ ├── ref.bib │ └── src │ │ ├── CMakeLists.txt │ │ ├── Shi2014exp_AF2.f90 │ │ ├── Shi2014exp_BC2.f90 │ │ ├── abaqus_compile_files.txt │ │ ├── umat.f90 │ │ └── umat_module.f90 └── umat_utils │ ├── AceGenUtils │ └── MathematicaTensorsToolbox.nb │ ├── SolveMatrixEquation.f90 │ ├── Tensors_module │ ├── Abaqus_conversions.f90 │ ├── Contractions.f90 │ ├── Conversions.f90 │ ├── Miscellaneous.f90 │ ├── Open_products.f90 │ ├── Operations.f90 │ ├── Standard_tensors.f90 │ └── Stiffness_conversions.f90 │ ├── smsutility.f90 │ ├── tensors_module.f90 │ └── umat_utils_instructions.md └── scripts ├── compile_abaqus.py └── compile_general.py /.gitignore: -------------------------------------------------------------------------------- 1 | #Neglect all build folders 2 | *build* 3 | #Neglect the top level compiled folders 4 | compiled* -------------------------------------------------------------------------------- /AbaqusSetup.md: -------------------------------------------------------------------------------- 1 | # Setting up Abaqus to work with user subroutines 2 | There are various challenges associated with setting up Abaqus to work with user subroutines. To make matters worse, the procedures vary between Abaqus releases. Instructions in this document should therefore not be considered final. They have not been throuroghly verified. But if you find an error in the instructions, please add that as an issue and I will try to update the instructions accordingly. 3 | 4 | The setup will consist of two parts. The first is related to the compilation and linking on a system level and the second is related to settings in Abaqus' environment files (`abaqus_v6.env`) files 5 | 6 | ## System setup 7 | ### Windows 10, Abaqus 2019 8 | Instructions probably work for other versions as well 9 | 10 | 1) Install [Visual Studio Community Edition 2022](https://visualstudio.microsoft.com/vs/community/) 11 | Include “Desktop development with C++” under “Desktop&Mobile” under “Workloads” 12 | 13 | 2) Install [Intel® oneAPI Base Toolkit](https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html) 14 | Choose to connect with installed “visual studio 2022” and “Build Tools 2017” when asked 15 | 16 | 3) Install [Intel® oneAPI HPC Toolkit](https://software.intel.com/content/www/us/en/develop/tools/oneapi/hpc-toolkit.html) 17 | Choose to connect with installed “visual studio 2022” and “Build Tools 2017” when asked 18 | 4) Install Abaqus 2019 (including support for subroutines, i.e. CAA) 19 | 5) Edit `C:\SIMULIA\Commands\abq2019.bat` (Change “2019” to your release. If you modify only abaqus.bat, then it might not work from inside CAE. At least for 2019, `abq2019.bat` is called when opening CAE, but not abaqus.bat) by adding the following on the line after `@echo off` 20 | ```bat 21 | if not defined oneapi_setvars_has_been_called ( 22 | @call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" 23 | set oneapi_setvars_has_been_called=1 24 | ) 25 | ``` 26 | The path to `oneAPI\setvars.bat` should be right, but be necessary to check this 27 | 6) Open `cmd`, and run `abaqus verify –user_std` to check that everything is working. 28 | If `abaqus` is not found, add `C:\SIMULIA\Commands` to your `path` system variable (“Start – Edit Environment Variables for your account”) 29 | 30 | 31 | ### Linux 32 | To be completed, contributions are welcome! 33 | 34 | ## Abaqus environment files 35 | To check that the correct options are set in Abaqus do the following: 36 | - Create a folder with a file named `abaqus_v6.env` containing only `print compile_fortran` 37 | - Run `abaqus -information version` (you can run other abaqus commands also, this just gives reasonably little output) from the terminal/command prompt in that folder 38 | 39 | The first line being returned should look something like `['ifort', '/fpp', '/heap-arrays:1', '/Qmkl:sequential', '/include:%I']` on Windows and similar on Linux (but with slash `/` replaced by hyphen `-`). Note that in this list there will likely be many more options as well, that is ok (and probably beneficial for performance etc.) 40 | 41 | If the output does not contain the item `'/Qmkl:sequential'`, add (or append to) a file `abaqus_v6.env` in your home directory (`%HOME%` on Windows and `~/` on Linux). Add the line `compile_fortran.append('/Qmkl:sequential')` (replace `/` by hyphen `-` on Linux) 42 | 43 | If your ifort version > 16, you will also need to add `compile_fortran.append('/nostandard-realloc-lhs')` to the `abaqus_v6.env` in your home directory. 44 | 45 | If the command returns the error `NameError: name 'compile_fortran' is not defined` then you should create the file `abaqus_v6.env` in your home directory (`%HOME%` on Windows and `~/` on Linux). This file should contain `compile_fortran = ['ifort', '/fpp', '/heap-arrays:1', '/Qmkl:sequential', '/include:%I']`. If the file already exists, just append this line. However, if this is the case, you will probably need more variables to be defined as well and I would guess something is wrong with your installation. Hints for possible variables to be defined are `link_sl`, `link_exe` but the contents of these lists are system dependent and it is therefore not, to my knowledge, possible to give more specific advice. 46 | 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Knut Andreas Meyer 4 | Note that special conditions apply to codes containing acegen generated code. For these 5 | "you may not include the codes generated by AceGen into other code if other code is later use for resale, rent or lease" [http://symech.fgg.uni-lj.si/Download.htm] 6 | In other cases, the terms outlined below apply. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![DOI](https://zenodo.org/badge/191778601.svg)](https://zenodo.org/badge/latestdoi/191778601) 2 | 3 | *For instructions on how to setup Abaqus with subroutines, see [here](/AbaqusSetup.md)* 4 | 5 | # MaterialModels 6 | This repository contains user material models for Abaqus (UMAT) written by Knut Andreas Meyer. 7 | It has different model categories, located in the `models` folder. Each category contains (at least) three items: 8 | 9 | - `src`: A folder containing the source code necessary to build the model 10 | - `doc`: A folder containing documentation for the models 11 | - `ref.bib`: Latex bibliography file with reference(s) to the appropriate paper(s) 12 | 13 | If you publish results based on any of these models, please cite the relevant paper. If you are presenting results obtained with any of these models, please also mention this repository. 14 | 15 | Additionally, the `models` folder contains a `umat_utils` folder, with general-purpose codes used by several models. 16 | 17 | ## Compiling the models 18 | (Please see `AbaqusSetup.md` for some hints on how to setup your environment for Abaqus using user subroutines) 19 | The scripts folder contains two scripts, one for building models for Abaqus (UMAT) and one for building a general shared library with the umat interface. These scripts take the following input: 20 | * Input 1: Which model category to build (see folder names in the `models` folder) 21 | * Input 2-: Which model number(s) to build within the given category (see `cmake_compile_models.txt` or `abaqus_compile_files.txt`) in the corresponding `src` folder 22 | 23 | The built models for Abaqus and the general case are put in folders `compiled_abaqus` and `compiled` respectively. 24 | Note: To use the compiled routines (`.so`/`.dll`) for Abaqus, they must be renamed into `standardU.dll` or `libstandardU.so`. In the `abaqus_v6.env` file the variable `usub_lib_dir` must be set to the folder containing the shared library. Alternatively, the `.o` or `.obj` files can be used. Additionally, a folder containing all sources required for the particular model is created in the `compiled_abaqus` folder, where the file `umat.for`/`umat.f` file is the main file. This setup can be used if more user subroutines should be linked with abaqus, and the line `include umat.for`/`include umat.f` can be used to also compile the user material model. 25 | 26 | ## Overview of models 27 | First, the models related to specific publications are listed. Further descriptions are given later for the specific model. 28 | * Meyer et al. (2018): GenFiniteStrain 29 | * Meyer (2020): Shi2014, Qin2018, CrystalPlasticity 30 | * Meyer and Menzel (2021): MM2021 (distortional hardening model) 31 | 32 | ### GenSmallStrain 33 | This category includes the Chaboche plasticity model for small strains. It includes different multiaxial extensions of the Armstrong-Frederick kinematic hardening rule: The Ohno-Wang model and the multiaxial modification based on Burlet and Cailletaud (1986) 34 | The models are available in rate-independent as well as rate-dependent forms, the latter with three different overstress functions. 35 | 36 | ### GenFiniteStrain 37 | This category includes extensions of the rate-independent small strain models to finite strains, using a hyperelasto-plastic framework. The implementation is from Meyer et al. (2018) 38 | 39 | ### Shi2014 40 | Rate independent distortional hardening model, inspired by Shi et al. (2014), published in Meyer (2020) 41 | 42 | ### Qin2018 43 | Rate independent distortional hardening model, inspired by Qin et al. (2018), published in Meyer (2020) 44 | 45 | ### CrystalPlasticity 46 | Taylor homogenized crystal plasticity model. Several different hardening laws, overstress functions etc. can be obtained by modifying the AceGen code. Published in Meyer (2020) 47 | 48 | ### MM2021 49 | 50 | An improved distortional hardening model that guarantees a convex yield surface and avoids the issues with excessive softening reported in Meyer (2020). The two versions of the model presented in Meyer and Menzel (2021) are available as ``disthard_ISO2_BC2`` (``H_r=0``) and ``rmodel_ISO2_BC2`` (``H_r \neq 0``). 51 | 52 | ## AceGen 53 | Some of the included code is generated using AceGen, and this should be referenced according to the instructions on their homepage (http://symech.fgg.uni-lj.si/). See also Korelc (2002) 54 | 55 | ## References 56 | * H. Burlet and G. Cailletaud (1986) "Numerical techniques for cyclic plasticity at variable temperature," Eng. Comput., vol. 3, no. 2, pp. 143–153 57 | * K. A. Meyer, M. Ekh, and J. Ahlström (2018) "Modeling of kinematic hardening at large biaxial deformations in pearlitic rail steel," Int. J. Solids Struct., vol. 130–131, pp. 122–132. https://doi.org/10.1016/j.ijsolstr.2017.10.007 58 | * K. A. Meyer (2020) "Evaluation of Material Models Describing the Evolution of Plastic Anisotropy in Pearlitic Steel." Int. J. Solids Struct. https://doi.org/10.1016/j.ijsolstr.2020.04.037. 59 | * K. A. Meyer and A. Menzel (2021) "A distortional hardening model for finite plasticity" Int. J. Solids Struct. 60 | * Korelc J. (2002) "Multi-language and Multi-environment Generation of Nonlinear Finite Element Codes", Engineering with Computers, vol. 18, n. 4, str. 312-327 61 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/AceGen/ElasticSetup.nb: -------------------------------------------------------------------------------- 1 | (* Content-type: application/vnd.wolfram.mathematica *) 2 | 3 | (*** Wolfram Notebook File ***) 4 | (* http://www.wolfram.com/nb *) 5 | 6 | (* CreatedBy='Mathematica 11.3' *) 7 | 8 | (*CacheID: 234*) 9 | (* Internal cache information: 10 | NotebookFileLineBreakTest 11 | NotebookFileLineBreakTest 12 | NotebookDataPosition[ 158, 7] 13 | NotebookDataLength[ 5826, 165] 14 | NotebookOptionsPosition[ 5247, 149] 15 | NotebookOutlinePosition[ 5592, 164] 16 | CellTagsIndexPosition[ 5549, 161] 17 | WindowFrame->Normal*) 18 | 19 | (* Beginning of Notebook Content *) 20 | Notebook[{ 21 | Cell[BoxData[ 22 | RowBox[{ 23 | RowBox[{"(*", 24 | RowBox[{"Elastic", " ", "setup"}], "*)"}], "\[IndentingNewLine]", 25 | RowBox[{"(*", 26 | RowBox[{"Load", " ", "in", " ", "the", " ", "input", " ", "variables"}], 27 | "*)"}], "\[IndentingNewLine]", 28 | RowBox[{ 29 | RowBox[{"RunSubModules", "[", 30 | RowBox[{"{", "\"\\"", "}"}], "]"}], ";"}]}]], "Input", 31 | CellChangeTimes->{{3.758598435457329*^9, 3.7585984387313724`*^9}, 32 | 3.758598475646621*^9}, 33 | CellLabel->"In[1]:=",ExpressionUUID->"5cb0f991-c18d-43a0-85af-2c1cdff26bec"], 34 | 35 | Cell[BoxData[ 36 | RowBox[{ 37 | RowBox[{"(*", 38 | RowBox[{"Calculate", " ", "the", " ", "trial", " ", "stress"}], "*)"}], 39 | "\[IndentingNewLine]", 40 | RowBox[{ 41 | RowBox[{ 42 | RowBox[{"FeTr", "\[DoubleRightTee]", 43 | RowBox[{"v9dv9", "[", 44 | RowBox[{"F9", ",", 45 | RowBox[{"inv9", "[", "FpOld", "]"}]}], "]"}]}], ";"}], 46 | "\[IndentingNewLine]", 47 | RowBox[{ 48 | RowBox[{"CeTr", "\[DoubleRightTee]", 49 | RowBox[{"v9dv9", "[", 50 | RowBox[{ 51 | RowBox[{"trans9", "[", "FeTr", "]"}], ",", "FeTr"}], "]"}]}], ";"}], 52 | "\[IndentingNewLine]", 53 | RowBox[{ 54 | RowBox[{"SeTr", "\[DoubleRightTee]", 55 | RowBox[{"elastic", "[", 56 | RowBox[{"CeTr", ",", "ElasticParams"}], "]"}]}], ";"}], 57 | "\[IndentingNewLine]", 58 | RowBox[{ 59 | RowBox[{"MeTr", "\[DoubleRightTee]", 60 | RowBox[{"v9dv9", "[", 61 | RowBox[{"CeTr", ",", "SeTr"}], "]"}]}], ";"}], "\[IndentingNewLine]", 62 | RowBox[{ 63 | RowBox[{"TauTr", "\[DoubleRightTee]", 64 | RowBox[{"v9dv9", "[", 65 | RowBox[{"FeTr", ",", 66 | RowBox[{"v9dv9", "[", 67 | RowBox[{"SeTr", ",", 68 | RowBox[{"trans9", "[", "FeTr", "]"}]}], "]"}]}], "]"}]}], ";"}], 69 | "\[IndentingNewLine]", 70 | RowBox[{ 71 | RowBox[{"sigma", "\[DoubleRightTee]", 72 | RowBox[{"v92v6ABAS", "[", 73 | RowBox[{"TauTr", "/", 74 | RowBox[{"det9", "[", "F9", "]"}]}], "]"}]}], ";"}], 75 | "\[IndentingNewLine]", 76 | RowBox[{ 77 | RowBox[{"TauAlphaTr", "\[DoubleRightTee]", 78 | RowBox[{"Table", "[", 79 | RowBox[{ 80 | RowBox[{"dco", "[", 81 | RowBox[{"MeTr", ",", 82 | RowBox[{"m2v", "[", 83 | RowBox[{"op", "[", 84 | RowBox[{ 85 | RowBox[{"s", "[", 86 | RowBox[{"[", "i", "]"}], "]"}], ",", 87 | RowBox[{"m", "[", 88 | RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "]"}]}], "]"}], ",", 89 | RowBox[{"{", 90 | RowBox[{"i", ",", 91 | RowBox[{"Length", "[", "m", "]"}]}], "}"}]}], "]"}]}], 92 | ";"}]}]}]], "Input", 93 | CellChangeTimes->{{3.7585984811405945`*^9, 3.758598486526595*^9}, { 94 | 3.7585988351884375`*^9, 3.758598926237442*^9}, {3.758599003087102*^9, 95 | 3.758599009613539*^9}, {3.7586116457010703`*^9, 3.7586116714611883`*^9}, 96 | 3.758612049853958*^9}, 97 | CellLabel->"In[2]:=",ExpressionUUID->"3767c3a3-45f1-47b2-a4b3-47df45bae028"], 98 | 99 | Cell[BoxData[ 100 | RowBox[{ 101 | RowBox[{"(*", 102 | RowBox[{ 103 | "Calculate", " ", "the", " ", "reduced", " ", "stresses", " ", "and", " ", 104 | "yield"}], "*)"}], "\[IndentingNewLine]", 105 | RowBox[{ 106 | RowBox[{ 107 | RowBox[{"TauRedTr", "\[DoubleRightTee]", 108 | RowBox[{"TauAlphaTr", "-", "BetaOld"}]}], ";"}], "\[IndentingNewLine]", 109 | RowBox[{ 110 | RowBox[{"yielding", "\[DoubleRightTee]", 111 | RowBox[{"Table", "[", 112 | RowBox[{ 113 | RowBox[{"yield", "[", 114 | RowBox[{ 115 | RowBox[{"SMSAbs", "[", 116 | RowBox[{"TauRedTr", "[", 117 | RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", 118 | RowBox[{ 119 | RowBox[{"KappaOld", "[", 120 | RowBox[{"[", "i", "]"}], "]"}], "+", 121 | RowBox[{"IsoHardParams", "[", 122 | RowBox[{"[", "1", "]"}], "]"}]}]}], "]"}], ",", 123 | RowBox[{"{", 124 | RowBox[{"i", ",", "NumSlipSystems"}], "}"}]}], "]"}]}], 125 | ";"}]}]}]], "Input", 126 | CellChangeTimes->{{3.7585990326297607`*^9, 3.7585992072445354`*^9}, { 127 | 3.758603875437003*^9, 3.758603936580619*^9}, {3.758604422491947*^9, 128 | 3.7586044594620733`*^9}, {3.75860453133449*^9, 3.7586045332775345`*^9}, 129 | 3.7587212968493514`*^9},ExpressionUUID->"041d0ef9-9f43-4d4b-9a13-\ 130 | 30bbc4ce14d7"], 131 | 132 | Cell[BoxData[ 133 | RowBox[{ 134 | RowBox[{"(*", 135 | RowBox[{"Calculate", " ", "the", " ", "stiffness", " ", "ddsdde"}], "*)"}], 136 | "\[IndentingNewLine]", 137 | RowBox[{ 138 | RowBox[{ 139 | RowBox[{"dtaudF", "\[DoubleRightTee]", 140 | RowBox[{"SMSD", "[", 141 | RowBox[{"TauTr", ",", "F9"}], "]"}]}], ";"}], "\[IndentingNewLine]", 142 | RowBox[{ 143 | RowBox[{"ddsdde", "\[DoubleRightTee]", 144 | RowBox[{"dtaudFtoddsdde", "[", 145 | RowBox[{"dtaudF", ",", "F9"}], "]"}]}], ";"}]}]}]], "Input", 146 | CellChangeTimes->{{3.7585992189135494`*^9, 3.7585992937502327`*^9}, { 147 | 3.7586038072053385`*^9, 3.758603827077174*^9}}, 148 | CellLabel->"In[11]:=",ExpressionUUID->"da9d34d5-5c0f-4082-854c-a3e07793107b"] 149 | }, 150 | WindowSize->{775, 872}, 151 | WindowMargins->{{-1749, Automatic}, {15, Automatic}}, 152 | FrontEndVersion->"11.3 for Microsoft Windows (64-bit) (March 6, 2018)", 153 | StyleDefinitions->"Default.nb" 154 | ] 155 | (* End of Notebook Content *) 156 | 157 | (* Internal cache information *) 158 | (*CellTagsOutline 159 | CellTagsIndex->{} 160 | *) 161 | (*CellTagsIndex 162 | CellTagsIndex->{} 163 | *) 164 | (*NotebookFileOutline 165 | Notebook[{ 166 | Cell[558, 20, 530, 12, 67, "Input",ExpressionUUID->"5cb0f991-c18d-43a0-85af-2c1cdff26bec"], 167 | Cell[1091, 34, 2253, 62, 162, "Input",ExpressionUUID->"3767c3a3-45f1-47b2-a4b3-47df45bae028"], 168 | Cell[3347, 98, 1217, 31, 86, "Input",ExpressionUUID->"041d0ef9-9f43-4d4b-9a13-30bbc4ce14d7"], 169 | Cell[4567, 131, 676, 16, 67, "Input",ExpressionUUID->"da9d34d5-5c0f-4082-854c-a3e07793107b"] 170 | } 171 | ] 172 | *) 173 | 174 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/AceGen/combine_files.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | from pathlib import Path 4 | import os 5 | 6 | 7 | 8 | def main(argv): 9 | print(os.getcwd()) 10 | module_name = "acegen_crystal_plasticity_mod" 11 | subroutine_names = ("model_size", "elastic", "residual", "jacobian", "plastic_output") 12 | if len(argv) > 1: 13 | name = argv[1] 14 | else: 15 | name = "tmp" 16 | 17 | with open(name + ".f90", "w") as fid: 18 | write_header(fid, module_name) 19 | for name in subroutine_names: 20 | sub = fix_subroutine(name) 21 | fid.write(sub) 22 | fid.write("\n" + "end module " + module_name) 23 | 24 | 25 | def fix_subroutine(name): 26 | subroutine = Path(name+'.f90').read_text() 27 | subroutine = re.sub("SUBROUTINE " + name + "\(v,", "SUBROUTINE " + name + "(", subroutine) 28 | subroutine = re.sub("END$", "END SUBROUTINE", subroutine) 29 | 30 | return subroutine 31 | 32 | 33 | def write_header(fid, module_name): 34 | with open('tmpinfo.txt') as inp_fid: 35 | for line in inp_fid: 36 | fid.write('!' + line) 37 | 38 | fid.write("\n" + "module " + module_name + "\n") 39 | fid.write("implicit none" + "\n") 40 | fid.write("contains" + "\n") 41 | 42 | 43 | if __name__ == '__main__': 44 | main(sys.argv) 45 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/doc/CrystalPlasticity.md: -------------------------------------------------------------------------------- 1 | The crystal plasticity model is made up by several modules that can be combined to form the complete model. 2 | Please see ../ref.bib for which reference if you either directly use this model, or base your work upon it. 3 | 4 | # Single crystal model 5 | AceGen is used to generate the different variations of the single crystal models. In the folder ../AceGen all files to generate the variations of the local model are located. The settings are found in MainFile.nb and are described in the subsections below. By running this file, a fortran subroutine is generated. This can be put in the ../src folder in order to create a model for that particular type. Several pre-generated codes are already available, and these are described at the end of this document. 6 | 7 | ## Model Name 8 | This parameter only controls the output name of the .f90 file that should be copied to the ../src folder 9 | 10 | ## Crystal type 11 | Controls the number and orientations of the slip systems. Currently, BCC, FCC, and BCC12 are available. The latter indicate the BCC crystal with only the 12 slip systems {110}<111>, while the regular BCC crystal contain all 48 slip systems. The FCC crystal only has 12 slip systems. This is defined in "CrystalPlasticity.nb" 12 | ## Elastic law 13 | Either St Venant Isotropic law using the Green Lagrange strain on the intermediate configuration, or the same law but using a crystal elasticity tensor with cubic symmetry (3 parameters). This is defined in "ElasticLaw.nb". 14 | 15 | ## Isotropic hardening 16 | Isotropic hardening law (can also include cross-hardening) for the slip systems. Several different hardening laws are available, and more can be added if desired. These are implemented in "IsotropicHardening.nb" 17 | 18 | ## Kinematic hardening 19 | Kinematic hardening on each slip system. Two different numerical implementations of the Armstrong-Frederick type is included, using either a backward Euler time integration or an exact solution. They are defined in "KinematicHardening.nb" 20 | 21 | ## Overstress function 22 | Again several different viscoplastic overstress functions are implemented. These are defined in "OverstressFunction.nb". 23 | 24 | # Homogenized response 25 | This particular implementation homogenize multiple crystal orientations using the Taylor (or Voigt) assumption of a homogeneous strain field. When compiling the model, one can choose between different modules for orientations, which are located in the src folder. One example is the ../src/uniform_mod.f90 which contains 2, 4, 8, 16, 32, 64, 128 and 256 uniformly oriented crystals. For all cases, the number of orientations is set as a material parameter. To avoid excessive large binary files, it was avoided to put all orientations in one module, and different models should be compiled depending on use. 26 | 27 | # Compiling a model 28 | 29 | ## Abaqus 30 | The file ../src/abaqus_compile_files.txt contain the compilation information used to compile for Abaqus. Each line describes one model to be compiled (please see the overall readme for this repository for how to compile for Abaqus). To add a model, the following must be specified: 31 | - *CompiledModelName*: The name of the resulting library 32 | - *SingleCrystalModel*.f90: The file generated from AceGen for the single crystal model 33 | - *crystal_orientation_mod*.f90: The module file for the particular desired orientations 34 | 35 | Hence, replace these in the following line: 36 | *CompiledModelName*,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","../../umat_utils/Tensors_module.f90",*SingleCrystalModel*.f90,"umat_module.f90","umat.f90",*crystal_orientation_mod*.f90,"taylor_model.f90" 37 | 38 | ## Stand-alone shared/dynamic library (for e.g. matmodfit) 39 | The file ../src/cmake_compile_models.txt contain the compilation information used to compile as a standalone .dll or .so for use by other softwares, such as matmodfit. Each line should be of the following format: 40 | *CompiledModelName*:-D model=*SingleCrystalModel* -D orientation=*crystal_orientation_mod* 41 | where the parts indicated by the *parameter* notation is described in the above subsection. -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/.idea/CrystalPlasticity.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/OrientationResults.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/CrystalPlasticity/python/OrientationResults.pdf -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/OrientationResults.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/CrystalPlasticity/python/OrientationResults.xlsx -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/SimpleShearTest.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/CrystalPlasticity/python/SimpleShearTest.pdf -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/SlipSystems.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import sys 4 | 5 | 6 | def main(argv): 7 | 8 | miller_planes, miller_directions = get_crystal_info('bcc') 9 | planes, directions = get_combined_systems(miller_planes, miller_directions) 10 | 11 | plot_yield_functions(planes, directions) 12 | 13 | # print_system_to_mathematica(planes, directions) 14 | # print_system_to_matlab(planes, directions) 15 | 16 | 17 | def plot_yield_functions(planes, directions): 18 | num_dir = 100 19 | angle = np.linspace(0, 2 * np.pi, num_dir) 20 | sigma = np.cos(angle) 21 | tau = np.sin(angle) / np.sqrt(3) 22 | plt.figure() 23 | 24 | 25 | tau_alpha_max = np.zeros(num_dir) 26 | for p, d in zip(planes, directions): 27 | tau_alpha = get_resolved_stress(sigma, tau, p, d) 28 | plt.plot(angle, tau_alpha, 29 | label='p=[' + str(p[0]) + str(p[1]) + str(p[2]) + '], d=[' + str(d[0]) + str(d[1]) + str(d[2]) + ']') 30 | tau_alpha_max = np.maximum(tau_alpha_max, np.abs(tau_alpha)) 31 | 32 | plt.plot(angle, tau_alpha_max, color='black', linestyle='--') 33 | plt.legend(loc='upper right') 34 | plt.show() 35 | 36 | 37 | 38 | def get_resolved_stress(sigma, tau, plane, direction): 39 | tau_alpha = [] 40 | for s, t in zip(sigma, tau): 41 | smat = np.array([[s, 0, 0], [0, 0, t], [0, t, 0]]) 42 | tau_alpha.append(np.dot(np.matmul(plane, smat), direction) / ( 43 | np.linalg.norm(plane) * np.linalg.norm(direction))) 44 | 45 | return tau_alpha 46 | 47 | 48 | def print_system_to_matlab(planes, directions): 49 | print('Slip planes') 50 | print_mathematica_vectors(planes) 51 | print('Slip directions') 52 | print_mathematica_vectors(directions) 53 | print('End') 54 | 55 | 56 | def print_matlab_vectors(vectors): 57 | print('[', end='') 58 | print_mathematica_vector_norm(vectors[0]) 59 | for v in vectors[1:]: 60 | print(', ', end='') 61 | print_mathematica_vector_norm(v) 62 | print(']') 63 | 64 | 65 | def print_matlab_vector(vector): 66 | print('[', end='') 67 | print(str(vector[0]), end='') 68 | for v in vector[1:]: 69 | print('; ', str(v), end='') 70 | print(']', end='') 71 | 72 | 73 | def print_matlab_vector_norm(vector): 74 | print('[', end='') 75 | print(str(vector[0]), end='') 76 | for v in vector[1:]: 77 | print('; ', str(v), end='') 78 | print(']/sqrt(', end='') 79 | print(sum(np.power(vector, 2)), end='') 80 | print(')', end='') 81 | 82 | 83 | 84 | def print_system_to_mathematica(planes, directions): 85 | print('{') 86 | print_mathematica_vectors(planes) 87 | print(',') 88 | print_mathematica_vectors(directions) 89 | print('}') 90 | 91 | 92 | def print_mathematica_vectors(vectors): 93 | print('{', end='') 94 | print_mathematica_vector_norm(vectors[0]) 95 | for v in vectors[1:]: 96 | print(', ', end='') 97 | print_mathematica_vector_norm(v) 98 | print('}') 99 | 100 | 101 | def print_mathematica_vector(vector): 102 | print('{', end='') 103 | print(str(vector[0]), end='') 104 | for v in vector[1:]: 105 | print(', ', str(v), end='') 106 | print('}', end='') 107 | 108 | 109 | def print_mathematica_vector_norm(vector): 110 | print('{', end='') 111 | print(str(vector[0]), end='') 112 | for v in vector[1:]: 113 | print(', ', str(v), end='') 114 | print('}/Sqrt[', end='') 115 | print(sum(np.power(vector, 2)), end='') 116 | print(']', end='') 117 | 118 | 119 | def get_crystal_info(crystal): 120 | if crystal == 'fcc': 121 | miller_planes = [[1, 1, 1]] 122 | miller_directions = [[1, 1, 0]] 123 | elif crystal == 'bcc': 124 | miller_planes = [[1, 1, 0], [1, 1, 2], [1, 2, 3]] 125 | miller_directions = [[1, 1, 1], [1, 1, 1], [1, 1, 1]] 126 | elif crystal == 'bcc12': 127 | miller_planes = [[1, 1, 0]] 128 | miller_directions = [[1, 1, 1]] 129 | else: 130 | print('Crystal ' + crystal + ' is not supported') 131 | miller_planes = None 132 | miller_directions = None 133 | 134 | return miller_planes, miller_directions 135 | 136 | 137 | def normalize_vectors(vectors): 138 | vnew = [] 139 | for v in vectors: 140 | vnew.append(v/np.linalg.norm(v)) 141 | 142 | return vnew 143 | 144 | 145 | def get_combined_systems(miller_planes, miller_directions): 146 | planes = [] 147 | directions = [] 148 | for mp, md in zip(miller_planes, miller_directions): 149 | p = get_permutations(mp) 150 | p, d = get_systems(p, md) 151 | for ip, id in zip(p, d): 152 | planes.append(ip) 153 | directions.append(id) 154 | 155 | return planes, directions 156 | 157 | 158 | def get_systems(planes, miller): 159 | all_directions = get_permutations(miller) 160 | planes_new = [] 161 | directions_new = [] 162 | for p in planes: 163 | dirs = get_slip_directions(p, all_directions) 164 | for d in dirs: 165 | planes_new.append(p) 166 | directions_new.append(d) 167 | 168 | return planes_new, directions_new 169 | 170 | 171 | def get_slip_directions(plane, directions): 172 | dirs = [] 173 | for d in directions: 174 | if np.dot(d, plane) == 0: 175 | dirs.append(d) 176 | return dirs 177 | 178 | 179 | def get_permutations(miller): 180 | # Given a set of miller indicies, flip these to return the set of unique indicies 181 | perm = [] 182 | ind_perm = ([0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]) 183 | sgn_perm = np.array(([1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1])) 184 | 185 | for inds in ind_perm: 186 | mperm = np.array([miller[ind] for ind in inds]) 187 | for sgn in sgn_perm: 188 | perm.append(mperm*sgn) 189 | 190 | perm = remove_duplicates(perm) 191 | 192 | return perm 193 | 194 | 195 | def remove_duplicates(perm): 196 | pnew = [] 197 | pnew.append(perm[0]) 198 | for p in perm[1:]: 199 | if len(pnew) == 1: 200 | if not ((pnew == p).all() or (pnew == (-p)).all()): 201 | pnew.append(p) 202 | else: 203 | if not (any((pnew[:] == p).all(1)) or any((pnew[:] == -p).all(1))): 204 | pnew.append(p) 205 | 206 | return np.array(pnew) 207 | 208 | 209 | if __name__=='__main__': 210 | main(sys.argv) 211 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/CrystalPlasticity/python/__init__.py -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/__pycache__/orientation.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/CrystalPlasticity/python/__pycache__/orientation.cpython-36.pyc -------------------------------------------------------------------------------- /models/CrystalPlasticity/python/csys_rotation.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | import quaternion as quat 5 | import vpython as vp 6 | import time 7 | 8 | param = {'kangle': np.pi*1, 'kred': 1.01, 9 | 'energy_exponent': 20} 10 | 11 | 12 | def main(argv): 13 | num_points = 10 14 | num_steps = 500 15 | draw_steps = 10 16 | coords = get_initial_directions(num_points) 17 | 18 | vp.canvas(title='Coordinate system rotations', width=1800, height=1200) 19 | 20 | csys = draw_initial(coords) 21 | 22 | energy_hist = [] 23 | energy_hist.append(get_total_energy(coords)) 24 | print('{:4.0f}: {:f} ({:f})'.format(0, energy_hist[-1], param['kangle'])) 25 | for step in range(num_steps): 26 | coords = update_positions(coords) 27 | energy_hist.append(get_total_energy(coords)) 28 | 29 | print('{:4.0f}: {:f} ({:f})'.format(step, energy_hist[-1], param['kangle'])) 30 | param['kangle'] = param['kangle']/param['kred'] 31 | if (step + 1) % draw_steps == 0: 32 | # time.sleep(1/(1+step/10)) 33 | time.sleep(0.001) 34 | update_drawing(csys, coords) 35 | 36 | plt.semilogy(energy_hist) 37 | print(np.min(energy_hist)) 38 | plt.show() 39 | 40 | 41 | def get_total_energy(coords): 42 | energy = 0 43 | for c0 in coords: 44 | for c in coords: 45 | energy = energy + get_coupling_energy(c0, c) 46 | energy = energy - get_coupling_energy(c0, c0) 47 | return (energy/(len(coords)**2))**(1.0/param['energy_exponent']) 48 | 49 | 50 | def get_coupling_energy(coords0, coords1): 51 | energy = 0 52 | for v0 in coords0: 53 | for v1 in coords1: 54 | energy = energy + 0.5*(np.dot(v0, v1))**param['energy_exponent'] 55 | 56 | return energy 57 | 58 | 59 | # Plotting routines 60 | def draw_initial(coords): 61 | color = [1,0,0] 62 | csys = [] 63 | for cor in coords: 64 | csys.append(plot_csys(cor[0], cor[1], cor[2], color)) 65 | color = [color[i] for i in [1, 2, 0]] 66 | 67 | return csys 68 | 69 | 70 | def plot_csys(ex, ey, ez, color): 71 | csys = [] 72 | csys.append(plot_arrow(ex, ey, color)) 73 | csys.append(plot_arrow(ey, ez, color)) 74 | csys.append(plot_arrow(ez, ex, color)) 75 | return csys 76 | 77 | 78 | def plot_arrow(vec, up, color): 79 | arrow = vp.arrow(axis=vp.vec(vec[0], vec[1], vec[2]), up=vp.vec(up[0], up[1], up[2]), 80 | color=vp.vec(color[0], color[1], color[2]), make_trail=True) 81 | 82 | return arrow 83 | 84 | 85 | def update_drawing(csys, coords): 86 | for cs, coord in zip(csys, coords): 87 | ctmp = [coord[1], coord[2], coord[0]] 88 | for a, v, u in zip(cs, coord, ctmp): 89 | update_arrow(a, v, u) 90 | 91 | 92 | def update_arrow(a, vec, up): 93 | a.axis = vp.vec(vec[0], vec[1], vec[2]) 94 | a.up = vp.vec(up[0], up[1], up[2]) 95 | 96 | 97 | # Initial setup 98 | def get_initial_directions(num_points): 99 | alpha = 2*np.pi*np.random.rand(num_points) 100 | beta = np.arcsin(2*np.random.rand(num_points)-1) 101 | gamma = np.pi*np.random.rand(num_points) 102 | 103 | alpha[0] = 0 104 | beta[0] = 0 105 | gamma[0] = 0 106 | coords = [] 107 | for a, b, g in zip(alpha, beta, gamma): 108 | u0 = np.array([+np.cos(a), np.sin(a), 0]) 109 | v0 = np.array([-np.sin(a), np.cos(a), 0]) 110 | ex = rotate_vector(u0, v0, b) 111 | ey = rotate_vector(v0, ex, g) 112 | ez = np.cross(ex, ey) 113 | if len(coords) == 1: 114 | x1 = 1 115 | x2 = (np.sqrt(1/x1**2 + 2)-1/x1)/2 116 | x3 = -(1/x1 + x2) 117 | ex = np.array([x1, x1, 1]) 118 | ey = np.array([x2, x3, 1]) 119 | ez = np.array([x3, x2, 1]) 120 | ex = ex / np.linalg.norm(ex) 121 | ey = ey/np.linalg.norm(ey) 122 | ez = ez/np.linalg.norm(ez) 123 | 124 | coords.append([ex, ey, ez]) 125 | 126 | return coords 127 | 128 | 129 | # Modification of state 130 | def rotate_vector(vector, axis, angle): 131 | return quat.rotate_vectors(quat.from_rotation_vector(axis * angle), vector) 132 | 133 | 134 | def update_positions(coords): 135 | 136 | E0 = get_total_energy(coords) 137 | sfac = 1 138 | eincrease = True 139 | cnt = 0 140 | while eincrease and cnt<1: 141 | # Calculate torque vectors for each coordinate set 142 | coords_new = [] 143 | coords_new.append(coords[0]) 144 | for c0 in coords[1:]: 145 | t0 = np.zeros(3) 146 | for c1 in coords: 147 | t0 = t0 + get_torque(c0, c1) 148 | 149 | coords_new.append(rotate_coords(c0, sfac*t0/len(coords))) 150 | sfac = sfac/2 151 | Enew = get_total_energy(coords_new) 152 | eincrease = Enew > E0 153 | cnt = cnt + 1 154 | 155 | return coords_new 156 | 157 | 158 | def get_torque(c0, c1): 159 | torque = np.zeros(3) 160 | for v0 in c0: 161 | for v1 in c1: 162 | torque = torque - get_normal_direction(v0, v1) * np.dot(v0, v1) 163 | 164 | return torque 165 | 166 | def get_normal_direction(vec1, vec2): 167 | direction = np.cross(vec1, vec2) 168 | norm = np.linalg.norm(direction) 169 | 170 | if norm < 1e-12: 171 | direction = np.cross(np.random.rand(3), vec1) 172 | norm = np.linalg.norm(direction) 173 | 174 | return direction/(norm+1e-12) 175 | 176 | 177 | def rotate_coords(coords, torque): 178 | angle = np.linalg.norm(torque)*param['kangle'] 179 | axis = torque/np.linalg.norm(torque) 180 | new_coords = [] 181 | for v in coords: 182 | new_coords.append(rotate_vector(v, axis, angle)) 183 | 184 | return new_coords 185 | 186 | 187 | 188 | 189 | if __name__=='__main__': 190 | main(sys.argv) -------------------------------------------------------------------------------- /models/CrystalPlasticity/ref.bib: -------------------------------------------------------------------------------- 1 | @article{Meyer2020, 2 | author = {Meyer, Knut Andreas}, 3 | doi = {10.1016/j.ijsolstr.2020.04.037}, 4 | journal = {International Journal of Solids and Structures (in press)}, 5 | title = {{Evaluation of material models describing the evolution of plastic anisotropy in pearlitic steel}}, 6 | year = {2020} 7 | } 8 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Setup with Windows (example): 2 | # Or if need of another generator e.g.: 3 | # Build from command line: 4 | cmake_minimum_required (VERSION 3.0) 5 | message("${CMAKE_FORTRAN_COMPILER_ID}") 6 | set(ENV{FC} "ifort") 7 | if (NOT CMAKE_BUILD_TYPE) 8 | set(CMAKE_BUILD_TYPE Release CACHE STRING 9 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) 10 | endif() 11 | 12 | set(model Cruzado2015 CACHE STRING "Which base model to build") 13 | set_property(CACHE model PROPERTY STRINGS 14 | Cruzado2015 15 | CP_FCC_Nort_Liniso 16 | Hutchinson1976_nlkin_bcc 17 | Lindfeldt2012_nlkin_bcc 18 | Hutchinson1976_Cowsym_AF_bcc 19 | Hutchinson1976_Norton_AF_bcc 20 | Hutchinson1976exp_Norton_AF0_bcc 21 | Hutchinson1976exp_Norton_AF_bcc 22 | Hutchinson1976exp_Lindfeldt_AF_bcc 23 | Hutchinson1976exp_Lindfeldt_AF_iso_bcc) 24 | 25 | set(orientation uniform_mod CACHE STRING "Which orientation to use") 26 | set_property(CACHE orientation PROPERTY STRINGS 27 | uniform_mod 28 | random_mod 29 | rand512mod 30 | rand16384mod) 31 | 32 | if (NOT umat_utils_path) 33 | set(umat_utils_path "${CMAKE_CURRENT_SOURCE_DIR}/../../umat_utils" CACHE STRING "Folder containing umat utility routines") 34 | endif() 35 | 36 | enable_language (Fortran) 37 | 38 | project(CrystalPlasticity) 39 | 40 | 41 | # Get system information 42 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 43 | set(A64 TRUE) # 64 bit compilation system - needs to be same as for mpsim 44 | else() 45 | set(A64 FALSE) # 32 bit compilation system - needs to be same as for mpsim 46 | endif() 47 | get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) 48 | if (Fortran_COMPILER_NAME MATCHES "gfortran.*") 49 | set(GFORT TRUE) 50 | set(IFORT FALSE) 51 | if (A64) 52 | add_compile_options(-m64 -ffree-line-length-none -ffree-form) 53 | else () 54 | add_compile_options(-ffree-line-length-none -ffree-form) 55 | endif() 56 | elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") 57 | set(GFORT FALSE) 58 | set(IFORT TRUE) 59 | if (MSVC) 60 | add_compile_options("/fpe:0") 61 | add_compile_options("$<$:/warn>") 62 | add_compile_options("$<$:/check>") 63 | endif() 64 | endif() 65 | 66 | 67 | # Add files 68 | add_library(CrystalPlasticity SHARED "taylor_model.f90") 69 | target_sources(CrystalPlasticity PRIVATE 70 | "crystal_orientations_mod.f90" 71 | "${orientation}.f90" 72 | "umat.f90" 73 | "${umat_utils_path}/tensors_module.f90" 74 | "${umat_utils_path}/smsutility.f90" 75 | "${umat_utils_path}/SolveMatrixEquation.f90" 76 | "umat_module.f90" 77 | "${model}.f90" 78 | ) 79 | 80 | set_target_properties(CrystalPlasticity PROPERTIES PREFIX "") 81 | set_target_properties(CrystalPlasticity PROPERTIES OUTPUT_NAME "${model}_${orientation}") 82 | # Link to MKL library 83 | if (MSVC) #If Microsoft Visual compiler 84 | if (A64) 85 | target_link_libraries(CrystalPlasticity PRIVATE "mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib") 86 | else() 87 | target_link_libraries(CrystalPlasticity PRIVATE "mkl_intel_c.lib mkl_sequential.lib mkl_core.lib") 88 | endif() 89 | elseif (A64) 90 | if (UNIX AND NOT APPLE) # I.e. linux 91 | set (MKLROOT $ENV{MKLROOT} CACHE STRING "Please specify your MKLROOT path") 92 | target_include_directories(CrystalPlasticity PRIVATE "${MKLROOT}/include") 93 | if (GFORT) 94 | target_link_libraries(CrystalPlasticity PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 95 | elseif (IFORT) 96 | target_link_libraries(CrystalPlasticity PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 97 | endif () 98 | endif() 99 | else() 100 | message("System configuration not supported") 101 | endif() 102 | -------------------------------------------------------------------------------- /models/CrystalPlasticity/src/abaqus_compile_files.txt: -------------------------------------------------------------------------------- 1 | Hutchinson1976exp_Lindfeldt_AF_bcc,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","../../umat_utils/tensors_module.f90","Hutchinson1976exp_Lindfeldt_AF_bcc.f90","umat_module.f90","umat.f90","crystal_orientations_mod.f90","uniform_mod.f90","taylor_model.f90" -------------------------------------------------------------------------------- /models/CrystalPlasticity/src/cmake_compile_models.txt: -------------------------------------------------------------------------------- 1 | Hutchinson1976exp_Lindfeldt_AF_bcc_uniform_mod:-D model=Hutchinson1976exp_Lindfeldt_AF_bcc -D orientation=uniform_mod 2 | Hutchinson1976exp_Lindfeldt_AF_bcc_random_mod:-D model=Hutchinson1976exp_Lindfeldt_AF_bcc -D orientation=random_mod 3 | Hutchinson1976exp_Lindfeldt_AF_iso_bcc_uniform_mod:-D model=Hutchinson1976exp_Lindfeldt_AF_iso_bcc -D orientation=uniform_mod -------------------------------------------------------------------------------- /models/CrystalPlasticity/src/crystal_orientations_mod.f90: -------------------------------------------------------------------------------- 1 | 2 | module crystal_orientations_mod 3 | use Tensors_module 4 | use orientation_mod 5 | implicit none 6 | private 7 | public :: rotate_input 8 | public :: rotate_output 9 | public :: get_rotation_matrices 10 | 11 | integer, parameter, dimension(9) :: aba6_2_v9_pos = (/1, 2, 3, 4, 6, 5, 5, 4, 6/) ! Index conversion 12 | integer, parameter, dimension(6) :: v9_2_aba6_pos = (/1, 2, 3, 4, 6, 5/) ! Index conversion 13 | 14 | contains 15 | 16 | subroutine rotate_input(dfgrad, dfgrad_rot, qvec) 17 | implicit none 18 | double precision :: dfgrad(3,3), dfgrad_rot(3,3), qvec(9), qmat(3,3) 19 | 20 | qmat = v9_2_m(qvec) 21 | 22 | dfgrad_rot = matmul(transpose(qmat), matmul(dfgrad, qmat)) 23 | 24 | end subroutine 25 | 26 | subroutine rotate_output(stress, ddsdde, qvec) 27 | implicit none 28 | double precision :: stress(6), ddsdde(6,6), qvec(9) 29 | double precision :: stressmat(3,3), ddsdde9(9,9), qmat(3,3), rot9x9(9,9) 30 | 31 | ! Rotate stress 32 | qmat = v9_2_m(qvec) 33 | stressmat = v9_2_m(sigma_abaqus_2_sigma_v9(stress)) ! Convert stress abaqus voigt to matrix 34 | stressmat = matmul(qmat, matmul(stressmat, transpose(qmat))) ! Rotate stress matrix 35 | stress = sigma_v9_2_sigma_abaqus(m_2_v9(stressmat)) ! Convert stress matrix to abaqus voigt 36 | 37 | 38 | rot9x9 = op_a_V9(qvec, qvec) ! Create rotation matrix in voigt for 4th order tensor 39 | ddsdde9 = ddsdde(aba6_2_v9_pos, aba6_2_v9_pos) ! Convert ddsdde in abaqus indicies to 9-voigt indicies from tensor module 40 | ddsdde9 = matmul(rot9x9, matmul(ddsdde9, transpose(rot9x9))) ! Rotate ddsdde9 41 | ddsdde = ddsdde9(v9_2_aba6_pos,v9_2_aba6_pos) ! Convert ddsdde9 in 9-voigt indicies to abaqus indices (6-voigt) 42 | 43 | end subroutine 44 | 45 | end module -------------------------------------------------------------------------------- /models/CrystalPlasticity/src/umat_module.f90: -------------------------------------------------------------------------------- 1 | module umat_module 2 | use acegen_crystal_plasticity_mod 3 | implicit none 4 | 5 | integer :: nvar ! Number of variables in local problem 6 | integer :: nslip ! Number of slip systems 7 | integer :: nstatv_model ! Number of state variables in model 8 | 9 | contains 10 | 11 | !Check that the input to the UMAT is correct 12 | subroutine checkinput(nprops, nstatv) 13 | implicit none 14 | integer, intent(in) :: nprops, nstatv 15 | integer :: nprops_model 16 | logical :: error 17 | 18 | call model_size(nprops_model,nstatv_model,nvar,nslip) 19 | 20 | error = .false. 21 | if (nprops.ne.nprops_model) then 22 | error = .true. 23 | elseif (nstatv.ne.nstatv_model) then 24 | error = .true. 25 | endif 26 | 27 | ! Quit analysis if invalid input 28 | if (error) then 29 | write(*,*) 'Invalid input to umat subroutine' 30 | write(*,*) 'You specified ', nprops, ' material parameters: ', nprops_model, ' should be given' 31 | write(*,*) 'You specified ', nstatv, ' state variables: ', nstatv_model, ' should be given' 32 | call quit_analysis() 33 | endif 34 | 35 | 36 | end subroutine checkinput 37 | 38 | !Setup for solving the local problem in the case of plasticity 39 | subroutine setup(x0, param, Fnew, TauRedTr, dtime, statev) 40 | implicit none 41 | double precision, allocatable :: param(:) 42 | double precision, allocatable :: x0(:) 43 | double precision, intent(in) :: TauRedTr(:), statev(:), Fnew(9), dtime 44 | allocate(param(9+nslip+1)) 45 | allocate(x0(nvar)) 46 | param(1:9) = Fnew 47 | param(10:(9+nslip)) = TauRedTr 48 | param(9+nslip+1) = dtime 49 | x0 = statev((nstatv_model-nvar+1):nstatv_model) 50 | 51 | end subroutine setup 52 | 53 | !Residual function (wrapper for AceGen code) 54 | subroutine residualfun(r, x, props, statev, param) 55 | implicit none 56 | double precision, intent(in) :: x(:) 57 | double precision, intent(in), optional :: props(:), statev(:), param(:) !Residual function parameters 58 | double precision, allocatable, intent(out) :: r(:) 59 | double precision :: Fnew(9), TauRedTr(nslip), dtime 60 | 61 | allocate(r(nvar)) 62 | 63 | Fnew = param(1:9) 64 | TauRedTr = param(10:(9+nslip)) 65 | dtime = param(9+nslip+1) 66 | 67 | call residual(x,props,statev,Fnew,TauRedTr,dtime,r) 68 | 69 | end subroutine residualfun 70 | 71 | !Jacobian function (wrapper for AceGen code) 72 | subroutine anajac(ajacobian, x, props, statev, param) 73 | implicit none 74 | double precision, intent(in) :: x(:) 75 | double precision, intent(in), optional :: props(:), statev(:), param(:) !parameters 76 | double precision, allocatable, intent(out) :: ajacobian(:,:) 77 | double precision :: Fnew(9), TauRedTr(nslip), dtime 78 | 79 | allocate(ajacobian(nvar,nvar)) 80 | 81 | Fnew = param(1:9) 82 | TauRedTr = param(10:(9+nslip)) 83 | dtime = param(9+nslip+1) 84 | 85 | call jacobian(x,props,statev,Fnew,TauRedTr,dtime,ajacobian) 86 | 87 | end subroutine anajac 88 | 89 | 90 | ! Check if problem converged 91 | subroutine check_analysis(lconv, pnewdt) 92 | implicit none 93 | logical, intent(in) :: lconv 94 | double precision :: pnewdt 95 | if (.not.lconv) then 96 | write(*,*) 'Local problem did not converge' 97 | pnewdt = 5.d-1 98 | return 99 | endif 100 | 101 | end subroutine check_analysis 102 | 103 | function m3x3_2_v9(mat) result(v9) 104 | implicit none 105 | double precision :: mat(3,3), v9(9) 106 | 107 | v9 = (/mat(1,1), mat(2,2), mat(3,3), mat(1,2), mat(2,3), mat(3,1), mat(1,3), mat(2,1), mat(3,2)/) 108 | 109 | end function 110 | 111 | !Safely quit analysis in a correct way 112 | subroutine quit_analysis() 113 | implicit none 114 | !call xit() !Quit abaqus analysis in a correct way (Comment out if running outside abaqus) 115 | stop !Use if running outside abaqus 116 | end subroutine quit_analysis 117 | 118 | end MODULE -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/AGfiles/RF1_FE1_EV1_SC1.f90: -------------------------------------------------------------------------------- 1 | !************************************************************** 2 | !* AceGen 6.702 Windows (4 May 16) * 3 | !* Co. J. Korelc 2013 19 Mar 17 15:22:45 * 4 | !************************************************************** 5 | ! User : Full professional version 6 | ! Notebook : ResidualFunction 7 | ! Evaluation time : 5 s Mode : Optimal 8 | ! Number of formulae : 112 Method: Automatic 9 | ! Subroutine : RF1 size: 2578 10 | ! Total size of Mathematica code : 2578 subexpressions 11 | ! Total size of Fortran code : 5553 bytes 12 | 13 | !******************* S U B R O U T I N E ********************** 14 | SUBROUTINE RF1(v,x,props,statev,Fnew,R) 15 | USE SMSUtility 16 | IMPLICIT NONE 17 | LOGICAL b126 18 | DOUBLE PRECISION v(225),x(19),props(9),statev(19),Fnew(9),R(19) 19 | v(208)=props(4)*x(1) 20 | v(203)=x(12)*x(13)-x(15)*x(19) 21 | v(202)=-(x(13)*x(14))+x(17)*x(19) 22 | v(201)=x(14)*x(16)-x(11)*x(19) 23 | v(200)=-(x(12)*x(16))+x(18)*x(19) 24 | v(199)=x(15)*x(16)-x(13)*x(18) 25 | v(198)=-(x(11)*x(15))+x(17)*x(18) 26 | v(197)=x(11)*x(12)-x(14)*x(18) 27 | v(196)=x(11)*x(13)-x(16)*x(17) 28 | v(195)=x(14)*x(15)-x(12)*x(17) 29 | v(194)=x(3)*x(4)-x(10)*x(6) 30 | v(193)=-(x(3)*x(7))+x(10)*x(9) 31 | v(192)=-(x(10)*x(2))+x(5)*x(7) 32 | v(191)=-(x(4)*x(5))+x(10)*x(8) 33 | v(190)=x(6)*x(7)-x(4)*x(9) 34 | v(189)=x(2)*x(3)-x(5)*x(9) 35 | v(188)=-(x(2)*x(6))+x(8)*x(9) 36 | v(187)=x(2)*x(4)-x(7)*x(8) 37 | v(186)=x(5)*x(6)-x(3)*x(8) 38 | v(185)=-statev(1)+x(1) 39 | v(184)=0.15d1*props(6)*props(8) 40 | v(58)=1d0/(v(188)*x(10)+v(189)*x(4)+v(186)*x(7)) 41 | v(165)=v(197)*x(13)+v(195)*x(16)+v(198)*x(19) 42 | v(220)=-(v(198)/v(165)) 43 | v(219)=-(v(197)/v(165)) 44 | v(218)=-(v(195)/v(165)) 45 | v(217)=-(v(202)/v(165)) 46 | v(216)=-(v(201)/v(165)) 47 | v(215)=-(v(196)/v(165)) 48 | v(214)=-(v(203)/v(165)) 49 | v(213)=-(v(200)/v(165)) 50 | v(212)=-(v(199)/v(165)) 51 | v(57)=v(194)*v(58) 52 | v(59)=v(187)*v(58) 53 | v(60)=v(189)*v(58) 54 | v(61)=v(191)*v(58) 55 | v(62)=v(188)*v(58) 56 | v(63)=v(193)*v(58) 57 | v(64)=v(186)*v(58) 58 | v(65)=v(190)*v(58) 59 | v(66)=v(192)*v(58) 60 | v(67)=Fnew(1)*v(57)+Fnew(7)*v(63)+Fnew(4)*v(65) 61 | v(68)=Fnew(2)*v(59)+Fnew(8)*v(61)+Fnew(5)*v(66) 62 | v(69)=Fnew(3)*v(60)+Fnew(9)*v(62)+Fnew(6)*v(64) 63 | v(70)=Fnew(4)*v(59)+Fnew(1)*v(61)+Fnew(7)*v(66) 64 | v(71)=Fnew(5)*v(60)+Fnew(2)*v(62)+Fnew(8)*v(64) 65 | v(72)=Fnew(6)*v(57)+Fnew(3)*v(63)+Fnew(9)*v(65) 66 | v(73)=Fnew(7)*v(60)+Fnew(4)*v(62)+Fnew(1)*v(64) 67 | v(74)=Fnew(8)*v(57)+Fnew(5)*v(63)+Fnew(2)*v(65) 68 | v(75)=Fnew(9)*v(59)+Fnew(6)*v(61)+Fnew(3)*v(66) 69 | v(76)=(v(67)*v(67))+(v(72)*v(72))+(v(74)*v(74)) 70 | v(88)=-v(76)/3d0 71 | v(77)=(v(68)*v(68))+(v(70)*v(70))+(v(75)*v(75)) 72 | v(89)=-v(77)/3d0 73 | v(78)=(v(69)*v(69))+(v(71)*v(71))+(v(73)*v(73)) 74 | v(84)=-v(78)/3d0 75 | v(79)=v(67)*v(70)+v(68)*v(74)+v(72)*v(75) 76 | v(80)=v(68)*v(71)+v(70)*v(73)+v(69)*v(75) 77 | v(81)=v(69)*v(72)+v(67)*v(73)+v(71)*v(74) 78 | v(82)=v(78)*(v(76)*v(77)-(v(79)*v(79)))-v(76)*(v(80)*v(80))+2d0*v(79)*v(80)*v(81)-v(77)*(v(81)*v(81)) 79 | v(86)=props(2)*(v(82)-sqrt(v(82))) 80 | v(85)=1d0/v(82)**0.3333333333333333d0 81 | v(206)=props(1)*v(85) 82 | v(94)=1d0/v(165)**2 83 | v(100)=1d0/v(94)**0.3333333333333333d0 84 | v(204)=props(7)*v(100) 85 | v(205)=v(204)*v(94) 86 | v(95)=((v(195)*v(195))+(v(197)*v(197))+(v(198)*v(198)))*v(94) 87 | v(99)=-v(95)/3d0 88 | v(96)=((v(196)*v(196))+(v(201)*v(201))+(v(202)*v(202)))*v(94) 89 | v(102)=-v(96)/3d0 90 | v(97)=((v(199)*v(199))+(v(200)*v(200))+(v(203)*v(203)))*v(94) 91 | v(103)=-v(97)/3d0 92 | v(98)=v(204)*(v(102)+(2d0/3d0)*v(97)+v(99)) 93 | v(101)=v(204)*(v(103)+(2d0/3d0)*v(96)+v(99)) 94 | v(104)=v(204)*(v(102)+v(103)+(2d0/3d0)*v(95)) 95 | v(112)=(v(196)*v(199)+v(200)*v(201)+v(202)*v(203))*v(205) 96 | v(117)=(v(196)*v(198)+v(197)*v(201)+v(195)*v(202))*v(205) 97 | v(119)=(v(198)*v(199)+v(197)*v(200)+v(195)*v(203))*v(205) 98 | v(120)=v(86)+v(206)*((2d0/3d0)*v(76)+v(84)+v(89))-v(98) 99 | v(121)=-v(101)+v(86)+v(206)*((2d0/3d0)*v(77)+v(84)+v(88)) 100 | v(122)=-v(104)+v(86)+v(206)*((2d0/3d0)*v(78)+v(88)+v(89)) 101 | v(123)=-v(112)+v(206)*v(79) 102 | v(124)=-v(117)+v(206)*v(80) 103 | v(125)=-v(119)+v(206)*v(81) 104 | IF(dabs(props(5)).lt.0.1d-11) THEN 105 | v(207)=v(208) 106 | v(127)=v(207) 107 | ELSE 108 | v(209)=1d0/props(5) 109 | v(127)=v(209)*(1d0-dexp(-(props(5)*v(208)))) 110 | ENDIF 111 | v(135)=1d0/(props(3)+v(127)) 112 | v(210)=0.15d1*v(135) 113 | v(128)=-v(121)/3d0 114 | v(129)=-v(122)/3d0 115 | v(132)=(2d0/3d0)*v(120)+v(128)+v(129) 116 | v(130)=-v(120)/3d0 117 | v(137)=(2d0/3d0)*v(122)+v(128)+v(130) 118 | v(134)=(2d0/3d0)*v(121)+v(129)+v(130) 119 | v(133)=v(132)*v(210) 120 | v(136)=v(134)*v(210) 121 | v(138)=v(137)*v(210) 122 | v(139)=v(123)*v(210) 123 | v(161)=-(v(139)*v(185)) 124 | v(140)=v(124)*v(210) 125 | v(163)=-(v(140)*v(185)) 126 | v(141)=v(125)*v(210) 127 | v(170)=-(((-1d0)+props(6))*props(8)*(v(101)*v(136)+v(104)*v(138)+2d0*v(112)*v(139)+2d0*v(117)*v(140)+2d0*v(119)*v(141)& 128 | &+v(133)*v(98))) 129 | v(211)=(-1d0)+v(170) 130 | v(181)=-(v(185)*(v(117)*v(184)+v(140)*v(211))) 131 | v(179)=-(v(185)*(v(112)*v(184)+v(139)*v(211))) 132 | v(177)=-(v(185)*(v(119)*v(184)+v(141)*v(211))) 133 | v(159)=-(v(141)*v(185)) 134 | R(1)=-props(3)-v(127)+sqrt(0.15d1*(2d0*v(123)**2+2d0*v(124)**2+2d0*v(125)**2+v(132)**2+v(134)**2+v(137)**2)) 135 | R(2)=1d0-v(133)*v(185)+(-(statev(5)*v(190))-statev(8)*v(193)-statev(2)*v(194))*v(58) 136 | R(3)=1d0-v(136)*v(185)+(-(statev(3)*v(187))-statev(9)*v(191)-statev(6)*v(192))*v(58) 137 | R(4)=1d0-v(138)*v(185)+(-(statev(7)*v(186))-statev(10)*v(188)-statev(4)*v(189))*v(58) 138 | R(5)=v(161)+(-(statev(5)*v(187))-statev(2)*v(191)-statev(8)*v(192))*v(58) 139 | R(6)=v(163)+(-(statev(9)*v(186))-statev(3)*v(188)-statev(6)*v(189))*v(58) 140 | R(7)=v(159)+(-(statev(10)*v(190))-statev(4)*v(193)-statev(7)*v(194))*v(58) 141 | R(8)=v(159)+(-(statev(2)*v(186))-statev(5)*v(188)-statev(8)*v(189))*v(58) 142 | R(9)=v(161)+(-(statev(3)*v(190))-statev(6)*v(193)-statev(9)*v(194))*v(58) 143 | R(10)=v(163)+(-(statev(10)*v(187))-statev(7)*v(191)-statev(4)*v(192))*v(58) 144 | R(11)=1d0+statev(14)*v(212)+statev(17)*v(213)+statev(11)*v(214)-v(185)*(v(133)*v(211)+v(184)*v(98)) 145 | R(12)=1d0-v(185)*(v(101)*v(184)+v(136)*v(211))+statev(12)*v(215)+statev(15)*v(216)+statev(18)*v(217) 146 | R(13)=1d0-v(185)*(v(104)*v(184)+v(138)*v(211))+statev(16)*v(218)+statev(13)*v(219)+statev(19)*v(220) 147 | R(14)=v(179)+statev(14)*v(215)+statev(17)*v(216)+statev(11)*v(217) 148 | R(15)=v(181)+statev(18)*v(218)+statev(15)*v(219)+statev(12)*v(220) 149 | R(16)=v(177)+statev(19)*v(212)+statev(13)*v(213)+statev(16)*v(214) 150 | R(17)=v(177)+statev(11)*v(218)+statev(17)*v(219)+statev(14)*v(220) 151 | R(18)=v(179)+statev(12)*v(212)+statev(15)*v(213)+statev(18)*v(214) 152 | R(19)=v(181)+statev(19)*v(215)+statev(13)*v(216)+statev(16)*v(217) 153 | END 154 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/AGfiles/RF1_FE1_EV1_SC2.f90: -------------------------------------------------------------------------------- 1 | !************************************************************** 2 | !* AceGen 6.702 Windows (4 May 16) * 3 | !* Co. J. Korelc 2013 3 Apr 17 10:46:59 * 4 | !************************************************************** 5 | ! User : Full professional version 6 | ! Notebook : ResidualFunction 7 | ! Evaluation time : 7 s Mode : Optimal 8 | ! Number of formulae : 112 Method: Automatic 9 | ! Subroutine : RF1 size: 2578 10 | ! Total size of Mathematica code : 2578 subexpressions 11 | ! Total size of Fortran code : 5553 bytes 12 | 13 | !******************* S U B R O U T I N E ********************** 14 | SUBROUTINE RF1(v,x,props,statev,Fnew,R) 15 | USE SMSUtility 16 | IMPLICIT NONE 17 | LOGICAL b126 18 | DOUBLE PRECISION v(225),x(19),props(9),statev(19),Fnew(9),R(19) 19 | v(208)=props(4)*x(1) 20 | v(203)=x(12)*x(13)-x(15)*x(19) 21 | v(202)=-(x(13)*x(14))+x(17)*x(19) 22 | v(201)=x(14)*x(16)-x(11)*x(19) 23 | v(200)=-(x(12)*x(16))+x(18)*x(19) 24 | v(199)=x(15)*x(16)-x(13)*x(18) 25 | v(198)=-(x(11)*x(15))+x(17)*x(18) 26 | v(197)=x(11)*x(12)-x(14)*x(18) 27 | v(196)=x(11)*x(13)-x(16)*x(17) 28 | v(195)=x(14)*x(15)-x(12)*x(17) 29 | v(194)=x(3)*x(4)-x(10)*x(6) 30 | v(193)=-(x(3)*x(7))+x(10)*x(9) 31 | v(192)=-(x(10)*x(2))+x(5)*x(7) 32 | v(191)=-(x(4)*x(5))+x(10)*x(8) 33 | v(190)=x(6)*x(7)-x(4)*x(9) 34 | v(189)=x(2)*x(3)-x(5)*x(9) 35 | v(188)=-(x(2)*x(6))+x(8)*x(9) 36 | v(187)=x(2)*x(4)-x(7)*x(8) 37 | v(186)=x(5)*x(6)-x(3)*x(8) 38 | v(185)=-statev(1)+x(1) 39 | v(184)=(-0.15d1)*props(6)*props(8) 40 | v(58)=1d0/(v(188)*x(10)+v(189)*x(4)+v(186)*x(7)) 41 | v(165)=v(197)*x(13)+v(195)*x(16)+v(198)*x(19) 42 | v(220)=-(v(198)/v(165)) 43 | v(219)=-(v(197)/v(165)) 44 | v(218)=-(v(195)/v(165)) 45 | v(217)=-(v(202)/v(165)) 46 | v(216)=-(v(201)/v(165)) 47 | v(215)=-(v(196)/v(165)) 48 | v(214)=-(v(203)/v(165)) 49 | v(213)=-(v(200)/v(165)) 50 | v(212)=-(v(199)/v(165)) 51 | v(57)=v(194)*v(58) 52 | v(59)=v(187)*v(58) 53 | v(60)=v(189)*v(58) 54 | v(61)=v(191)*v(58) 55 | v(62)=v(188)*v(58) 56 | v(63)=v(193)*v(58) 57 | v(64)=v(186)*v(58) 58 | v(65)=v(190)*v(58) 59 | v(66)=v(192)*v(58) 60 | v(67)=Fnew(1)*v(57)+Fnew(7)*v(63)+Fnew(4)*v(65) 61 | v(68)=Fnew(2)*v(59)+Fnew(8)*v(61)+Fnew(5)*v(66) 62 | v(69)=Fnew(3)*v(60)+Fnew(9)*v(62)+Fnew(6)*v(64) 63 | v(70)=Fnew(4)*v(59)+Fnew(1)*v(61)+Fnew(7)*v(66) 64 | v(71)=Fnew(5)*v(60)+Fnew(2)*v(62)+Fnew(8)*v(64) 65 | v(72)=Fnew(6)*v(57)+Fnew(3)*v(63)+Fnew(9)*v(65) 66 | v(73)=Fnew(7)*v(60)+Fnew(4)*v(62)+Fnew(1)*v(64) 67 | v(74)=Fnew(8)*v(57)+Fnew(5)*v(63)+Fnew(2)*v(65) 68 | v(75)=Fnew(9)*v(59)+Fnew(6)*v(61)+Fnew(3)*v(66) 69 | v(76)=(v(67)*v(67))+(v(72)*v(72))+(v(74)*v(74)) 70 | v(88)=-v(76)/3d0 71 | v(77)=(v(68)*v(68))+(v(70)*v(70))+(v(75)*v(75)) 72 | v(89)=-v(77)/3d0 73 | v(78)=(v(69)*v(69))+(v(71)*v(71))+(v(73)*v(73)) 74 | v(84)=-v(78)/3d0 75 | v(79)=v(67)*v(70)+v(68)*v(74)+v(72)*v(75) 76 | v(80)=v(68)*v(71)+v(70)*v(73)+v(69)*v(75) 77 | v(81)=v(69)*v(72)+v(67)*v(73)+v(71)*v(74) 78 | v(82)=v(78)*(v(76)*v(77)-(v(79)*v(79)))-v(76)*(v(80)*v(80))+2d0*v(79)*v(80)*v(81)-v(77)*(v(81)*v(81)) 79 | v(86)=props(2)*(v(82)-sqrt(v(82))) 80 | v(85)=1d0/v(82)**0.3333333333333333d0 81 | v(206)=props(1)*v(85) 82 | v(94)=1d0/v(165)**2 83 | v(100)=1d0/v(94)**0.3333333333333333d0 84 | v(204)=-(props(7)*v(100)) 85 | v(205)=v(204)*v(94) 86 | v(95)=((v(195)*v(195))+(v(197)*v(197))+(v(198)*v(198)))*v(94) 87 | v(99)=-v(95)/3d0 88 | v(96)=((v(196)*v(196))+(v(201)*v(201))+(v(202)*v(202)))*v(94) 89 | v(102)=-v(96)/3d0 90 | v(97)=((v(199)*v(199))+(v(200)*v(200))+(v(203)*v(203)))*v(94) 91 | v(103)=-v(97)/3d0 92 | v(98)=v(204)*(v(102)+(2d0/3d0)*v(97)+v(99)) 93 | v(101)=v(204)*(v(103)+(2d0/3d0)*v(96)+v(99)) 94 | v(104)=v(204)*(v(102)+v(103)+(2d0/3d0)*v(95)) 95 | v(112)=(v(196)*v(199)+v(200)*v(201)+v(202)*v(203))*v(205) 96 | v(117)=(v(196)*v(198)+v(197)*v(201)+v(195)*v(202))*v(205) 97 | v(119)=(v(198)*v(199)+v(197)*v(200)+v(195)*v(203))*v(205) 98 | v(120)=v(86)+v(206)*((2d0/3d0)*v(76)+v(84)+v(89))-v(98) 99 | v(121)=-v(101)+v(86)+v(206)*((2d0/3d0)*v(77)+v(84)+v(88)) 100 | v(122)=-v(104)+v(86)+v(206)*((2d0/3d0)*v(78)+v(88)+v(89)) 101 | v(123)=-v(112)+v(206)*v(79) 102 | v(124)=-v(117)+v(206)*v(80) 103 | v(125)=-v(119)+v(206)*v(81) 104 | IF(dabs(props(5)).lt.0.1d-11) THEN 105 | v(207)=v(208) 106 | v(127)=v(207) 107 | ELSE 108 | v(209)=1d0/props(5) 109 | v(127)=v(209)*(1d0-dexp(-(props(5)*v(208)))) 110 | ENDIF 111 | v(135)=1d0/(props(3)+v(127)) 112 | v(210)=0.15d1*v(135) 113 | v(128)=-v(121)/3d0 114 | v(129)=-v(122)/3d0 115 | v(132)=(2d0/3d0)*v(120)+v(128)+v(129) 116 | v(130)=-v(120)/3d0 117 | v(137)=(2d0/3d0)*v(122)+v(128)+v(130) 118 | v(134)=(2d0/3d0)*v(121)+v(129)+v(130) 119 | v(133)=v(132)*v(210) 120 | v(136)=v(134)*v(210) 121 | v(138)=v(137)*v(210) 122 | v(139)=v(123)*v(210) 123 | v(161)=-(v(139)*v(185)) 124 | v(140)=v(124)*v(210) 125 | v(163)=-(v(140)*v(185)) 126 | v(141)=v(125)*v(210) 127 | v(170)=((-1d0)+props(6))*props(8)*(v(101)*v(136)+v(104)*v(138)+2d0*v(112)*v(139)+2d0*v(117)*v(140)+2d0*v(119)*v(141)+v& 128 | &(133)*v(98)) 129 | v(211)=1d0+v(170) 130 | v(181)=-(v(185)*(v(117)*v(184)+v(140)*v(211))) 131 | v(179)=-(v(185)*(v(112)*v(184)+v(139)*v(211))) 132 | v(177)=-(v(185)*(v(119)*v(184)+v(141)*v(211))) 133 | v(159)=-(v(141)*v(185)) 134 | R(1)=-props(3)-v(127)+sqrt(0.15d1*(2d0*v(123)**2+2d0*v(124)**2+2d0*v(125)**2+v(132)**2+v(134)**2+v(137)**2)) 135 | R(2)=1d0-v(133)*v(185)+(-(statev(5)*v(190))-statev(8)*v(193)-statev(2)*v(194))*v(58) 136 | R(3)=1d0-v(136)*v(185)+(-(statev(3)*v(187))-statev(9)*v(191)-statev(6)*v(192))*v(58) 137 | R(4)=1d0-v(138)*v(185)+(-(statev(7)*v(186))-statev(10)*v(188)-statev(4)*v(189))*v(58) 138 | R(5)=v(161)+(-(statev(5)*v(187))-statev(2)*v(191)-statev(8)*v(192))*v(58) 139 | R(6)=v(163)+(-(statev(9)*v(186))-statev(3)*v(188)-statev(6)*v(189))*v(58) 140 | R(7)=v(159)+(-(statev(10)*v(190))-statev(4)*v(193)-statev(7)*v(194))*v(58) 141 | R(8)=v(159)+(-(statev(2)*v(186))-statev(5)*v(188)-statev(8)*v(189))*v(58) 142 | R(9)=v(161)+(-(statev(3)*v(190))-statev(6)*v(193)-statev(9)*v(194))*v(58) 143 | R(10)=v(163)+(-(statev(10)*v(187))-statev(7)*v(191)-statev(4)*v(192))*v(58) 144 | R(11)=1d0+statev(14)*v(212)+statev(17)*v(213)+statev(11)*v(214)-v(185)*(v(133)*v(211)+v(184)*v(98)) 145 | R(12)=1d0-v(185)*(v(101)*v(184)+v(136)*v(211))+statev(12)*v(215)+statev(15)*v(216)+statev(18)*v(217) 146 | R(13)=1d0-v(185)*(v(104)*v(184)+v(138)*v(211))+statev(16)*v(218)+statev(13)*v(219)+statev(19)*v(220) 147 | R(14)=v(179)+statev(14)*v(215)+statev(17)*v(216)+statev(11)*v(217) 148 | R(15)=v(181)+statev(18)*v(218)+statev(15)*v(219)+statev(12)*v(220) 149 | R(16)=v(177)+statev(19)*v(212)+statev(13)*v(213)+statev(16)*v(214) 150 | R(17)=v(177)+statev(11)*v(218)+statev(17)*v(219)+statev(14)*v(220) 151 | R(18)=v(179)+statev(12)*v(212)+statev(15)*v(213)+statev(18)*v(214) 152 | R(19)=v(181)+statev(19)*v(215)+statev(13)*v(216)+statev(16)*v(217) 153 | END 154 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/AGfiles/RF1_FE2_EV1_SC1.f90: -------------------------------------------------------------------------------- 1 | !************************************************************** 2 | !* AceGen 6.702 Windows (4 May 16) * 3 | !* Co. J. Korelc 2013 18 Mar 17 19:11:38 * 4 | !************************************************************** 5 | ! User : Full professional version 6 | ! Notebook : ResidualFunction 7 | ! Evaluation time : 3 s Mode : Optimal 8 | ! Number of formulae : 97 Method: Automatic 9 | ! Subroutine : RF1 size: 2548 10 | ! Total size of Mathematica code : 2548 subexpressions 11 | ! Total size of Fortran code : 5188 bytes 12 | 13 | !******************* S U B R O U T I N E ********************** 14 | SUBROUTINE RF1(v,x,props,statev,Fnew,R) 15 | USE SMSUtility 16 | IMPLICIT NONE 17 | LOGICAL b107 18 | DOUBLE PRECISION v(210),x(19),props(9),statev(19),Fnew(9),R(19) 19 | v(202)=props(4)*x(1) 20 | v(200)=-(props(7)*(x(11)*x(16)+x(13)*x(17)+x(14)*x(19))) 21 | v(199)=-(props(7)*(x(13)*x(15)+x(16)*x(18)+x(12)*x(19))) 22 | v(198)=-(props(7)*(x(12)*x(14)+x(15)*x(17)+x(11)*x(18))) 23 | v(197)=(-2d0/3d0)*props(7) 24 | v(196)=(-3d0)*props(2) 25 | v(195)=2d0*props(1) 26 | v(194)=(-1d0)+x(13)**2+x(16)**2+x(19)**2 27 | v(193)=x(14)*x(16)-x(11)*x(19) 28 | v(192)=-(x(13)*x(14))+x(17)*x(19) 29 | v(191)=x(12)*x(13)-x(15)*x(19) 30 | v(190)=-(x(12)*x(16))+x(18)*x(19) 31 | v(189)=props(7)/3d0 32 | v(188)=(-1d0)+x(12)**2+x(15)**2+x(18)**2 33 | v(187)=x(11)*x(12)-x(14)*x(18) 34 | v(186)=-(x(11)*x(15))+x(17)*x(18) 35 | v(185)=x(15)*x(16)-x(13)*x(18) 36 | v(184)=(-1d0)+x(11)**2+x(14)**2+x(17)**2 37 | v(183)=x(11)*x(13)-x(16)*x(17) 38 | v(182)=x(14)*x(15)-x(12)*x(17) 39 | v(181)=x(3)*x(4)-x(10)*x(6) 40 | v(180)=-(x(3)*x(7))+x(10)*x(9) 41 | v(179)=-(x(10)*x(2))+x(5)*x(7) 42 | v(178)=-(x(4)*x(5))+x(10)*x(8) 43 | v(177)=x(6)*x(7)-x(4)*x(9) 44 | v(176)=x(2)*x(3)-x(5)*x(9) 45 | v(175)=-(x(2)*x(6))+x(8)*x(9) 46 | v(174)=x(2)*x(4)-x(7)*x(8) 47 | v(173)=x(5)*x(6)-x(3)*x(8) 48 | v(172)=-statev(1)+x(1) 49 | v(171)=0.15d1*props(6)*props(8) 50 | v(58)=1d0/(v(175)*x(10)+v(176)*x(4)+v(173)*x(7)) 51 | v(94)=v(184)*v(189) 52 | v(95)=v(188)*v(189) 53 | v(92)=v(189)*v(194) 54 | v(57)=v(181)*v(58) 55 | v(59)=v(174)*v(58) 56 | v(60)=v(176)*v(58) 57 | v(61)=v(178)*v(58) 58 | v(62)=v(175)*v(58) 59 | v(63)=v(180)*v(58) 60 | v(64)=v(173)*v(58) 61 | v(65)=v(177)*v(58) 62 | v(66)=v(179)*v(58) 63 | v(67)=Fnew(1)*v(57)+Fnew(7)*v(63)+Fnew(4)*v(65) 64 | v(68)=Fnew(2)*v(59)+Fnew(8)*v(61)+Fnew(5)*v(66) 65 | v(69)=Fnew(3)*v(60)+Fnew(9)*v(62)+Fnew(6)*v(64) 66 | v(70)=Fnew(4)*v(59)+Fnew(1)*v(61)+Fnew(7)*v(66) 67 | v(71)=Fnew(5)*v(60)+Fnew(2)*v(62)+Fnew(8)*v(64) 68 | v(72)=Fnew(6)*v(57)+Fnew(3)*v(63)+Fnew(9)*v(65) 69 | v(73)=Fnew(7)*v(60)+Fnew(4)*v(62)+Fnew(1)*v(64) 70 | v(74)=Fnew(8)*v(57)+Fnew(5)*v(63)+Fnew(2)*v(65) 71 | v(75)=Fnew(9)*v(59)+Fnew(6)*v(61)+Fnew(3)*v(66) 72 | v(76)=(v(67)*v(67))+(v(72)*v(72))+(v(74)*v(74)) 73 | v(77)=(v(68)*v(68))+(v(70)*v(70))+(v(75)*v(75)) 74 | v(78)=(v(69)*v(69))+(v(71)*v(71))+(v(73)*v(73)) 75 | v(79)=v(67)*v(70)+v(68)*v(74)+v(72)*v(75) 76 | v(80)=v(68)*v(71)+v(70)*v(73)+v(69)*v(75) 77 | v(81)=v(69)*v(72)+v(67)*v(73)+v(71)*v(74) 78 | v(83)=((v(195)+v(196))*(1d0+v(78)*(v(79)*v(79))+v(76)*(-(v(77)*v(78))+(v(80)*v(80)))-2d0*v(79)*v(80)*v(81)+v(77)*(v(81& 79 | &)*v(81))))/6d0 80 | v(89)=v(184)*v(197)+v(92)+v(95) 81 | v(93)=v(188)*v(197)+v(92)+v(94) 82 | v(97)=v(194)*v(197)+v(94)+v(95) 83 | v(101)=props(1)*((-1d0)+v(76))+v(83)-v(89) 84 | v(102)=props(1)*((-1d0)+v(77))+v(83)-v(93) 85 | v(103)=props(1)*((-1d0)+v(78))+v(83)-v(97) 86 | v(104)=-v(198)+props(1)*v(79) 87 | v(105)=-v(199)+props(1)*v(80) 88 | v(106)=-v(200)+props(1)*v(81) 89 | IF(dabs(props(5)).lt.0.1d-11) THEN 90 | v(201)=v(202) 91 | v(108)=v(201) 92 | ELSE 93 | v(203)=1d0/props(5) 94 | v(108)=v(203)*(1d0-dexp(-(props(5)*v(202)))) 95 | ENDIF 96 | v(116)=1d0/(props(3)+v(108)) 97 | v(204)=0.15d1*v(116) 98 | v(109)=-v(102)/3d0 99 | v(110)=-v(103)/3d0 100 | v(113)=(2d0/3d0)*v(101)+v(109)+v(110) 101 | v(111)=-v(101)/3d0 102 | v(118)=(2d0/3d0)*v(103)+v(109)+v(111) 103 | v(115)=(2d0/3d0)*v(102)+v(110)+v(111) 104 | v(114)=v(113)*v(204) 105 | v(117)=v(115)*v(204) 106 | v(119)=v(118)*v(204) 107 | v(120)=v(104)*v(204) 108 | v(142)=-(v(120)*v(172)) 109 | v(121)=v(105)*v(204) 110 | v(144)=-(v(121)*v(172)) 111 | v(122)=v(106)*v(204) 112 | v(149)=-(((-1d0)+props(6))*props(8)*(2d0*v(120)*v(198)+2d0*v(121)*v(199)+2d0*v(122)*v(200)+v(114)*v(89)+v(117)*v(93)+v& 113 | &(119)*v(97))) 114 | v(205)=(-1d0)+v(149) 115 | v(168)=-(v(172)*(v(171)*v(199)+v(121)*v(205))) 116 | v(166)=-(v(172)*(v(171)*v(198)+v(120)*v(205))) 117 | v(164)=-(v(172)*(v(171)*v(200)+v(122)*v(205))) 118 | v(140)=-(v(122)*v(172)) 119 | v(146)=1d0/(v(187)*x(13)+v(182)*x(16)+v(186)*x(19)) 120 | R(1)=-props(3)-v(108)+sqrt(0.15d1*(2d0*v(104)**2+2d0*v(105)**2+2d0*v(106)**2+v(113)**2+v(115)**2+v(118)**2)) 121 | R(2)=1d0-v(114)*v(172)+(-(statev(5)*v(177))-statev(8)*v(180)-statev(2)*v(181))*v(58) 122 | R(3)=1d0-v(117)*v(172)+(-(statev(3)*v(174))-statev(9)*v(178)-statev(6)*v(179))*v(58) 123 | R(4)=1d0-v(119)*v(172)+(-(statev(7)*v(173))-statev(10)*v(175)-statev(4)*v(176))*v(58) 124 | R(5)=v(142)+(-(statev(5)*v(174))-statev(2)*v(178)-statev(8)*v(179))*v(58) 125 | R(6)=v(144)+(-(statev(9)*v(173))-statev(3)*v(175)-statev(6)*v(176))*v(58) 126 | R(7)=v(140)+(-(statev(10)*v(177))-statev(4)*v(180)-statev(7)*v(181))*v(58) 127 | R(8)=v(140)+(-(statev(2)*v(173))-statev(5)*v(175)-statev(8)*v(176))*v(58) 128 | R(9)=v(142)+(-(statev(3)*v(177))-statev(6)*v(180)-statev(9)*v(181))*v(58) 129 | R(10)=v(144)+(-(statev(10)*v(174))-statev(7)*v(178)-statev(4)*v(179))*v(58) 130 | R(11)=1d0+v(146)*(-(statev(14)*v(185))-statev(17)*v(190)-statev(11)*v(191))-v(172)*(v(114)*v(205)+v(171)*v(89)) 131 | R(12)=1d0+v(146)*(-(statev(12)*v(183))-statev(18)*v(192)-statev(15)*v(193))-v(172)*(v(117)*v(205)+v(171)*v(93)) 132 | R(13)=1d0+v(146)*(-(statev(16)*v(182))-statev(19)*v(186)-statev(13)*v(187))-v(172)*(v(119)*v(205)+v(171)*v(97)) 133 | R(14)=v(166)+v(146)*(-(statev(14)*v(183))-statev(11)*v(192)-statev(17)*v(193)) 134 | R(15)=v(168)+v(146)*(-(statev(18)*v(182))-statev(12)*v(186)-statev(15)*v(187)) 135 | R(16)=v(164)+v(146)*(-(statev(19)*v(185))-statev(13)*v(190)-statev(16)*v(191)) 136 | R(17)=v(164)+v(146)*(-(statev(11)*v(182))-statev(14)*v(186)-statev(17)*v(187)) 137 | R(18)=v(166)+v(146)*(-(statev(12)*v(185))-statev(15)*v(190)-statev(18)*v(191)) 138 | R(19)=v(168)+v(146)*(-(statev(19)*v(183))-statev(16)*v(192)-statev(13)*v(193)) 139 | END 140 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/AGfiles/RF1_FE2_EV1_SC2.f90: -------------------------------------------------------------------------------- 1 | !************************************************************** 2 | !* AceGen 6.702 Windows (4 May 16) * 3 | !* Co. J. Korelc 2013 18 Mar 17 19:11:45 * 4 | !************************************************************** 5 | ! User : Full professional version 6 | ! Notebook : ResidualFunction 7 | ! Evaluation time : 3 s Mode : Optimal 8 | ! Number of formulae : 97 Method: Automatic 9 | ! Subroutine : RF1 size: 2544 10 | ! Total size of Mathematica code : 2544 subexpressions 11 | ! Total size of Fortran code : 5176 bytes 12 | 13 | !******************* S U B R O U T I N E ********************** 14 | SUBROUTINE RF1(v,x,props,statev,Fnew,R) 15 | USE SMSUtility 16 | IMPLICIT NONE 17 | LOGICAL b107 18 | DOUBLE PRECISION v(210),x(19),props(9),statev(19),Fnew(9),R(19) 19 | v(202)=props(4)*x(1) 20 | v(200)=props(7)*(x(11)*x(16)+x(13)*x(17)+x(14)*x(19)) 21 | v(199)=props(7)*(x(13)*x(15)+x(16)*x(18)+x(12)*x(19)) 22 | v(198)=props(7)*(x(12)*x(14)+x(15)*x(17)+x(11)*x(18)) 23 | v(197)=(2d0/3d0)*props(7) 24 | v(196)=(-3d0)*props(2) 25 | v(195)=2d0*props(1) 26 | v(194)=(-1d0)+x(13)**2+x(16)**2+x(19)**2 27 | v(193)=x(14)*x(16)-x(11)*x(19) 28 | v(192)=-(x(13)*x(14))+x(17)*x(19) 29 | v(191)=x(12)*x(13)-x(15)*x(19) 30 | v(190)=-(x(12)*x(16))+x(18)*x(19) 31 | v(189)=-props(7)/3d0 32 | v(188)=(-1d0)+x(12)**2+x(15)**2+x(18)**2 33 | v(187)=x(11)*x(12)-x(14)*x(18) 34 | v(186)=-(x(11)*x(15))+x(17)*x(18) 35 | v(185)=x(15)*x(16)-x(13)*x(18) 36 | v(184)=(-1d0)+x(11)**2+x(14)**2+x(17)**2 37 | v(183)=x(11)*x(13)-x(16)*x(17) 38 | v(182)=x(14)*x(15)-x(12)*x(17) 39 | v(181)=x(3)*x(4)-x(10)*x(6) 40 | v(180)=-(x(3)*x(7))+x(10)*x(9) 41 | v(179)=-(x(10)*x(2))+x(5)*x(7) 42 | v(178)=-(x(4)*x(5))+x(10)*x(8) 43 | v(177)=x(6)*x(7)-x(4)*x(9) 44 | v(176)=x(2)*x(3)-x(5)*x(9) 45 | v(175)=-(x(2)*x(6))+x(8)*x(9) 46 | v(174)=x(2)*x(4)-x(7)*x(8) 47 | v(173)=x(5)*x(6)-x(3)*x(8) 48 | v(172)=-statev(1)+x(1) 49 | v(171)=(-0.15d1)*props(6)*props(8) 50 | v(58)=1d0/(v(175)*x(10)+v(176)*x(4)+v(173)*x(7)) 51 | v(94)=v(184)*v(189) 52 | v(95)=v(188)*v(189) 53 | v(92)=v(189)*v(194) 54 | v(57)=v(181)*v(58) 55 | v(59)=v(174)*v(58) 56 | v(60)=v(176)*v(58) 57 | v(61)=v(178)*v(58) 58 | v(62)=v(175)*v(58) 59 | v(63)=v(180)*v(58) 60 | v(64)=v(173)*v(58) 61 | v(65)=v(177)*v(58) 62 | v(66)=v(179)*v(58) 63 | v(67)=Fnew(1)*v(57)+Fnew(7)*v(63)+Fnew(4)*v(65) 64 | v(68)=Fnew(2)*v(59)+Fnew(8)*v(61)+Fnew(5)*v(66) 65 | v(69)=Fnew(3)*v(60)+Fnew(9)*v(62)+Fnew(6)*v(64) 66 | v(70)=Fnew(4)*v(59)+Fnew(1)*v(61)+Fnew(7)*v(66) 67 | v(71)=Fnew(5)*v(60)+Fnew(2)*v(62)+Fnew(8)*v(64) 68 | v(72)=Fnew(6)*v(57)+Fnew(3)*v(63)+Fnew(9)*v(65) 69 | v(73)=Fnew(7)*v(60)+Fnew(4)*v(62)+Fnew(1)*v(64) 70 | v(74)=Fnew(8)*v(57)+Fnew(5)*v(63)+Fnew(2)*v(65) 71 | v(75)=Fnew(9)*v(59)+Fnew(6)*v(61)+Fnew(3)*v(66) 72 | v(76)=(v(67)*v(67))+(v(72)*v(72))+(v(74)*v(74)) 73 | v(77)=(v(68)*v(68))+(v(70)*v(70))+(v(75)*v(75)) 74 | v(78)=(v(69)*v(69))+(v(71)*v(71))+(v(73)*v(73)) 75 | v(79)=v(67)*v(70)+v(68)*v(74)+v(72)*v(75) 76 | v(80)=v(68)*v(71)+v(70)*v(73)+v(69)*v(75) 77 | v(81)=v(69)*v(72)+v(67)*v(73)+v(71)*v(74) 78 | v(83)=((v(195)+v(196))*(1d0+v(78)*(v(79)*v(79))+v(76)*(-(v(77)*v(78))+(v(80)*v(80)))-2d0*v(79)*v(80)*v(81)+v(77)*(v(81& 79 | &)*v(81))))/6d0 80 | v(89)=v(184)*v(197)+v(92)+v(95) 81 | v(93)=v(188)*v(197)+v(92)+v(94) 82 | v(97)=v(194)*v(197)+v(94)+v(95) 83 | v(101)=props(1)*((-1d0)+v(76))+v(83)-v(89) 84 | v(102)=props(1)*((-1d0)+v(77))+v(83)-v(93) 85 | v(103)=props(1)*((-1d0)+v(78))+v(83)-v(97) 86 | v(104)=-v(198)+props(1)*v(79) 87 | v(105)=-v(199)+props(1)*v(80) 88 | v(106)=-v(200)+props(1)*v(81) 89 | IF(dabs(props(5)).lt.0.1d-11) THEN 90 | v(201)=v(202) 91 | v(108)=v(201) 92 | ELSE 93 | v(203)=1d0/props(5) 94 | v(108)=v(203)*(1d0-dexp(-(props(5)*v(202)))) 95 | ENDIF 96 | v(116)=1d0/(props(3)+v(108)) 97 | v(204)=0.15d1*v(116) 98 | v(109)=-v(102)/3d0 99 | v(110)=-v(103)/3d0 100 | v(113)=(2d0/3d0)*v(101)+v(109)+v(110) 101 | v(111)=-v(101)/3d0 102 | v(118)=(2d0/3d0)*v(103)+v(109)+v(111) 103 | v(115)=(2d0/3d0)*v(102)+v(110)+v(111) 104 | v(114)=v(113)*v(204) 105 | v(117)=v(115)*v(204) 106 | v(119)=v(118)*v(204) 107 | v(120)=v(104)*v(204) 108 | v(142)=-(v(120)*v(172)) 109 | v(121)=v(105)*v(204) 110 | v(144)=-(v(121)*v(172)) 111 | v(122)=v(106)*v(204) 112 | v(149)=((-1d0)+props(6))*props(8)*(2d0*v(120)*v(198)+2d0*v(121)*v(199)+2d0*v(122)*v(200)+v(114)*v(89)+v(117)*v(93)+v& 113 | &(119)*v(97)) 114 | v(205)=1d0+v(149) 115 | v(168)=-(v(172)*(v(171)*v(199)+v(121)*v(205))) 116 | v(166)=-(v(172)*(v(171)*v(198)+v(120)*v(205))) 117 | v(164)=-(v(172)*(v(171)*v(200)+v(122)*v(205))) 118 | v(140)=-(v(122)*v(172)) 119 | v(146)=1d0/(v(187)*x(13)+v(182)*x(16)+v(186)*x(19)) 120 | R(1)=-props(3)-v(108)+sqrt(0.15d1*(2d0*v(104)**2+2d0*v(105)**2+2d0*v(106)**2+v(113)**2+v(115)**2+v(118)**2)) 121 | R(2)=1d0-v(114)*v(172)+(-(statev(5)*v(177))-statev(8)*v(180)-statev(2)*v(181))*v(58) 122 | R(3)=1d0-v(117)*v(172)+(-(statev(3)*v(174))-statev(9)*v(178)-statev(6)*v(179))*v(58) 123 | R(4)=1d0-v(119)*v(172)+(-(statev(7)*v(173))-statev(10)*v(175)-statev(4)*v(176))*v(58) 124 | R(5)=v(142)+(-(statev(5)*v(174))-statev(2)*v(178)-statev(8)*v(179))*v(58) 125 | R(6)=v(144)+(-(statev(9)*v(173))-statev(3)*v(175)-statev(6)*v(176))*v(58) 126 | R(7)=v(140)+(-(statev(10)*v(177))-statev(4)*v(180)-statev(7)*v(181))*v(58) 127 | R(8)=v(140)+(-(statev(2)*v(173))-statev(5)*v(175)-statev(8)*v(176))*v(58) 128 | R(9)=v(142)+(-(statev(3)*v(177))-statev(6)*v(180)-statev(9)*v(181))*v(58) 129 | R(10)=v(144)+(-(statev(10)*v(174))-statev(7)*v(178)-statev(4)*v(179))*v(58) 130 | R(11)=1d0+v(146)*(-(statev(14)*v(185))-statev(17)*v(190)-statev(11)*v(191))-v(172)*(v(114)*v(205)+v(171)*v(89)) 131 | R(12)=1d0+v(146)*(-(statev(12)*v(183))-statev(18)*v(192)-statev(15)*v(193))-v(172)*(v(117)*v(205)+v(171)*v(93)) 132 | R(13)=1d0+v(146)*(-(statev(16)*v(182))-statev(19)*v(186)-statev(13)*v(187))-v(172)*(v(119)*v(205)+v(171)*v(97)) 133 | R(14)=v(166)+v(146)*(-(statev(14)*v(183))-statev(11)*v(192)-statev(17)*v(193)) 134 | R(15)=v(168)+v(146)*(-(statev(18)*v(182))-statev(12)*v(186)-statev(15)*v(187)) 135 | R(16)=v(164)+v(146)*(-(statev(19)*v(185))-statev(13)*v(190)-statev(16)*v(191)) 136 | R(17)=v(164)+v(146)*(-(statev(11)*v(182))-statev(14)*v(186)-statev(17)*v(187)) 137 | R(18)=v(166)+v(146)*(-(statev(12)*v(185))-statev(15)*v(190)-statev(18)*v(191)) 138 | R(19)=v(168)+v(146)*(-(statev(19)*v(183))-statev(16)*v(192)-statev(13)*v(193)) 139 | END 140 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/RF1_FE1_EV1_SC1.f90: -------------------------------------------------------------------------------- 1 | !************************************************************** 2 | !* AceGen 6.702 Windows (4 May 16) * 3 | !* Co. J. Korelc 2013 28 Jan 19 09:32:52 * 4 | !************************************************************** 5 | ! User : Full professional version 6 | ! Notebook : ResidualFunction 7 | ! Evaluation time : 3 s Mode : Optimal 8 | ! Number of formulae : 113 Method: Automatic 9 | ! Subroutine : RF1 size: 2607 10 | ! Total size of Mathematica code : 2607 subexpressions 11 | ! Total size of Fortran code : 5701 bytes 12 | 13 | !******************* S U B R O U T I N E ********************** 14 | SUBROUTINE RF1(v,x,props,statev,Fnew,R) 15 | USE SMSUtility 16 | IMPLICIT NONE 17 | LOGICAL b126 18 | DOUBLE PRECISION v(226),x(19),props(9),statev(19),Fnew(9),R(19) 19 | v(209)=props(4)*x(1) 20 | v(204)=x(12)*x(13)-x(15)*x(19) 21 | v(203)=-(x(13)*x(14))+x(17)*x(19) 22 | v(202)=x(14)*x(16)-x(11)*x(19) 23 | v(201)=-(x(12)*x(16))+x(18)*x(19) 24 | v(200)=x(15)*x(16)-x(13)*x(18) 25 | v(199)=-(x(11)*x(15))+x(17)*x(18) 26 | v(198)=x(11)*x(12)-x(14)*x(18) 27 | v(197)=x(11)*x(13)-x(16)*x(17) 28 | v(196)=x(14)*x(15)-x(12)*x(17) 29 | v(195)=x(3)*x(4)-x(10)*x(6) 30 | v(194)=-(x(3)*x(7))+x(10)*x(9) 31 | v(193)=-(x(10)*x(2))+x(5)*x(7) 32 | v(192)=-(x(4)*x(5))+x(10)*x(8) 33 | v(191)=x(6)*x(7)-x(4)*x(9) 34 | v(190)=x(2)*x(3)-x(5)*x(9) 35 | v(189)=-(x(2)*x(6))+x(8)*x(9) 36 | v(188)=x(2)*x(4)-x(7)*x(8) 37 | v(187)=x(5)*x(6)-x(3)*x(8) 38 | v(186)=-statev(1)+x(1) 39 | v(185)=0.15d1*props(6)*props(8) 40 | v(58)=1d0/(v(189)*x(10)+v(190)*x(4)+v(187)*x(7)) 41 | v(165)=v(198)*x(13)+v(196)*x(16)+v(199)*x(19) 42 | v(221)=-(v(199)/v(165)) 43 | v(220)=-(v(198)/v(165)) 44 | v(219)=-(v(196)/v(165)) 45 | v(218)=-(v(203)/v(165)) 46 | v(217)=-(v(202)/v(165)) 47 | v(216)=-(v(197)/v(165)) 48 | v(215)=-(v(204)/v(165)) 49 | v(214)=-(v(201)/v(165)) 50 | v(213)=-(v(200)/v(165)) 51 | v(57)=v(195)*v(58) 52 | v(59)=v(188)*v(58) 53 | v(60)=v(190)*v(58) 54 | v(61)=v(192)*v(58) 55 | v(62)=v(189)*v(58) 56 | v(63)=v(194)*v(58) 57 | v(64)=v(187)*v(58) 58 | v(65)=v(191)*v(58) 59 | v(66)=v(193)*v(58) 60 | v(67)=Fnew(1)*v(57)+Fnew(7)*v(63)+Fnew(4)*v(65) 61 | v(68)=Fnew(2)*v(59)+Fnew(8)*v(61)+Fnew(5)*v(66) 62 | v(69)=Fnew(3)*v(60)+Fnew(9)*v(62)+Fnew(6)*v(64) 63 | v(70)=Fnew(4)*v(59)+Fnew(1)*v(61)+Fnew(7)*v(66) 64 | v(71)=Fnew(5)*v(60)+Fnew(2)*v(62)+Fnew(8)*v(64) 65 | v(72)=Fnew(6)*v(57)+Fnew(3)*v(63)+Fnew(9)*v(65) 66 | v(73)=Fnew(7)*v(60)+Fnew(4)*v(62)+Fnew(1)*v(64) 67 | v(74)=Fnew(8)*v(57)+Fnew(5)*v(63)+Fnew(2)*v(65) 68 | v(75)=Fnew(9)*v(59)+Fnew(6)*v(61)+Fnew(3)*v(66) 69 | v(76)=(v(67)*v(67))+(v(72)*v(72))+(v(74)*v(74)) 70 | v(88)=-v(76)/3d0 71 | v(77)=(v(68)*v(68))+(v(70)*v(70))+(v(75)*v(75)) 72 | v(89)=-v(77)/3d0 73 | v(78)=(v(69)*v(69))+(v(71)*v(71))+(v(73)*v(73)) 74 | v(84)=-v(78)/3d0 75 | v(79)=v(67)*v(70)+v(68)*v(74)+v(72)*v(75) 76 | v(80)=v(68)*v(71)+v(70)*v(73)+v(69)*v(75) 77 | v(81)=v(69)*v(72)+v(67)*v(73)+v(71)*v(74) 78 | v(82)=v(78)*(v(76)*v(77)-(v(79)*v(79)))-v(76)*(v(80)*v(80))+2d0*v(79)*v(80)*v(81)-v(77)*(v(81)*v(81)) 79 | v(86)=props(2)*(v(82)-sqrt(v(82))) 80 | v(85)=1d0/v(82)**0.3333333333333333d0 81 | v(207)=props(1)*v(85) 82 | v(94)=1d0/v(165)**2 83 | v(100)=1d0/v(94)**0.3333333333333333d0 84 | v(205)=props(7)*v(100) 85 | v(206)=v(205)*v(94) 86 | v(95)=((v(196)*v(196))+(v(198)*v(198))+(v(199)*v(199)))*v(94) 87 | v(99)=-v(95)/3d0 88 | v(96)=((v(197)*v(197))+(v(202)*v(202))+(v(203)*v(203)))*v(94) 89 | v(102)=-v(96)/3d0 90 | v(97)=((v(200)*v(200))+(v(201)*v(201))+(v(204)*v(204)))*v(94) 91 | v(103)=-v(97)/3d0 92 | v(98)=v(205)*(v(102)+(2d0/3d0)*v(97)+v(99)) 93 | v(101)=v(205)*(v(103)+(2d0/3d0)*v(96)+v(99)) 94 | v(104)=v(205)*(v(102)+v(103)+(2d0/3d0)*v(95)) 95 | v(112)=(v(197)*v(200)+v(201)*v(202)+v(203)*v(204))*v(206) 96 | v(117)=(v(197)*v(199)+v(198)*v(202)+v(196)*v(203))*v(206) 97 | v(119)=(v(199)*v(200)+v(198)*v(201)+v(196)*v(204))*v(206) 98 | v(120)=v(86)+v(207)*((2d0/3d0)*v(76)+v(84)+v(89))-v(98) 99 | v(121)=-v(101)+v(86)+v(207)*((2d0/3d0)*v(77)+v(84)+v(88)) 100 | v(122)=-v(104)+v(86)+v(207)*((2d0/3d0)*v(78)+v(88)+v(89)) 101 | v(123)=-v(112)+v(207)*v(79) 102 | v(124)=-v(117)+v(207)*v(80) 103 | v(125)=-v(119)+v(207)*v(81) 104 | IF(dabs(props(5)).lt.0.1d-11) THEN 105 | v(208)=v(209) 106 | v(127)=v(208) 107 | ELSE 108 | v(210)=1d0/props(5) 109 | v(127)=v(210)*(1d0-dexp(-(props(5)*v(209)))) 110 | ENDIF 111 | v(135)=1d0/(props(3)+v(127)) 112 | v(211)=0.15d1*v(135) 113 | v(128)=-v(121)/3d0 114 | v(129)=-v(122)/3d0 115 | v(132)=(2d0/3d0)*v(120)+v(128)+v(129) 116 | v(130)=-v(120)/3d0 117 | v(137)=(2d0/3d0)*v(122)+v(128)+v(130) 118 | v(134)=(2d0/3d0)*v(121)+v(129)+v(130) 119 | v(133)=v(132)*v(211) 120 | v(136)=v(134)*v(211) 121 | v(138)=v(137)*v(211) 122 | v(139)=v(123)*v(211) 123 | v(161)=-(v(139)*v(186)) 124 | v(140)=v(124)*v(211) 125 | v(163)=-(v(140)*v(186)) 126 | v(141)=v(125)*v(211) 127 | v(170)=-(((-1d0)+props(6))*props(8)*(v(101)*v(136)+v(104)*v(138)+2d0*v(112)*v(139)+2d0*v(117)*v(140)+2d0*v(119)*v(141)& 128 | &+v(133)*v(98))) 129 | v(212)=(-1d0)+v(170) 130 | v(181)=-(v(186)*(v(117)*v(185)+v(140)*v(212))) 131 | v(179)=-(v(186)*(v(112)*v(185)+v(139)*v(212))) 132 | v(177)=-(v(186)*(v(119)*v(185)+v(141)*v(212))) 133 | v(159)=-(v(141)*v(186)) 134 | write(*,'(g11.5,x,g11.5,x,g11.5,x,g11.5,x,g11.5,x,g11.5,x,g11.5,x,g11.5,x,g11.5)')v(133),v(136),v(138),v(139),v(140),v& 135 | &(141),v(141),v(139),v(140) 136 | R(1)=-props(3)-v(127)+sqrt(0.15d1*(2d0*v(123)**2+2d0*v(124)**2+2d0*v(125)**2+v(132)**2+v(134)**2+v(137)**2)) 137 | R(2)=1d0-v(133)*v(186)+(-(statev(5)*v(191))-statev(8)*v(194)-statev(2)*v(195))*v(58) 138 | R(3)=1d0-v(136)*v(186)+(-(statev(3)*v(188))-statev(9)*v(192)-statev(6)*v(193))*v(58) 139 | R(4)=1d0-v(138)*v(186)+(-(statev(7)*v(187))-statev(10)*v(189)-statev(4)*v(190))*v(58) 140 | R(5)=v(161)+(-(statev(5)*v(188))-statev(2)*v(192)-statev(8)*v(193))*v(58) 141 | R(6)=v(163)+(-(statev(9)*v(187))-statev(3)*v(189)-statev(6)*v(190))*v(58) 142 | R(7)=v(159)+(-(statev(10)*v(191))-statev(4)*v(194)-statev(7)*v(195))*v(58) 143 | R(8)=v(159)+(-(statev(2)*v(187))-statev(5)*v(189)-statev(8)*v(190))*v(58) 144 | R(9)=v(161)+(-(statev(3)*v(191))-statev(6)*v(194)-statev(9)*v(195))*v(58) 145 | R(10)=v(163)+(-(statev(10)*v(188))-statev(7)*v(192)-statev(4)*v(193))*v(58) 146 | R(11)=1d0+statev(14)*v(213)+statev(17)*v(214)+statev(11)*v(215)-v(186)*(v(133)*v(212)+v(185)*v(98)) 147 | R(12)=1d0-v(186)*(v(101)*v(185)+v(136)*v(212))+statev(12)*v(216)+statev(15)*v(217)+statev(18)*v(218) 148 | R(13)=1d0-v(186)*(v(104)*v(185)+v(138)*v(212))+statev(16)*v(219)+statev(13)*v(220)+statev(19)*v(221) 149 | R(14)=v(179)+statev(14)*v(216)+statev(17)*v(217)+statev(11)*v(218) 150 | R(15)=v(181)+statev(18)*v(219)+statev(15)*v(220)+statev(12)*v(221) 151 | R(16)=v(177)+statev(19)*v(213)+statev(13)*v(214)+statev(16)*v(215) 152 | R(17)=v(177)+statev(11)*v(219)+statev(17)*v(220)+statev(14)*v(221) 153 | R(18)=v(179)+statev(12)*v(213)+statev(15)*v(214)+statev(18)*v(215) 154 | R(19)=v(181)+statev(19)*v(216)+statev(13)*v(217)+statev(16)*v(218) 155 | END 156 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/ResidualSetup: -------------------------------------------------------------------------------- 1 | << TensorsToolboxMathematica 2 | << SpecialFunctions 3 | 4 | (*READ INPUT*) 5 | (*Material paramters*) 6 | mpar ⊢ SMSReal[Table[props$$[i], {i, nmp}]]; 7 | {Gmod, Kmod, Y0, Hiso, invYiso, delta} ⊨ Table[mpar[[i]], {i, 6}]; 8 | 9 | Hk ⊨ Table[mpar[[i]], {i, 7, 6 + 3*nback, 3}]; 10 | invYk ⊨ Table[mpar[[i]], {i, 8, 6 + 3*nback, 3}]; 11 | mexp ⊨ Table[mpar[[i]], {i, 9, 6 + 3*nback, 3}]; 12 | 13 | (*Old state variables*) 14 | svO ⊢ SMSReal[Table[statev$$[i], {i, nvar}]]; 15 | lambdaO ⊨ svO[[1]]; 16 | FpO ⊨ Table[svO[[1 + i]], {i, 9}]; 17 | FkO ⊨ Table[Table[svO[[10 + i + 9*(j - 1)]], {i, 9}], {j, nback}]; 18 | 19 | (*Current state variables*) 20 | X ⊢ SMSReal[Table[x$$[i], {i, nvar}]]; 21 | lambda ⊨ X[[1]]; 22 | Fp ⊨ Table[X[[i + 1]], {i, 9}]; 23 | Fk ⊨ Table[Table[X[[10 + i + 9*(j - 1)]], {i, 9}], {j, nback}]; 24 | 25 | (*Deformation gradient*) 26 | F9 ⊢ SMSReal[Table[Fnew$$[i], {i, 9}]]; 27 | Fpinv ⊨ inv9[Fp]; 28 | Fe ⊨ v9dv9[F9, Fpinv]; 29 | Ce ⊨ v9dv9[trans9[Fe], Fe]; 30 | 31 | (*CALCULATE STRESSES*) 32 | Mic ⊨ Micfun[Gmod, Kmod, Ce]; 33 | Mkic ⊨ Table[Mkicfun[Hk[[i]], Fk[[i]]], {i, nback}] 34 | Mredic ⊨ Mic - Sum[Mkic[[i]], {i, nback}] 35 | kappa ⊨ SMSIf[SMSAbs[invYiso] < eps, 36 | Hiso*lambda, (1 - Exp[-lambda*Hiso*invYiso])/invYiso]; 37 | 38 | (*CALCULATE RESIDUAL*) 39 | Meff ⊨ vonM[Mredic]; 40 | nu ⊨ (3/2)*dev9[trans9[Mredic]]/(Y0+kappa); 41 | 42 | Rphi ⊨ {Meff - (Y0 + kappa)}; 43 | Rpl ⊨ I2 - v9dv9[FpO,inv9[Fp]] - (lambda-lambdaO)*nu; 44 | Rk ⊨ Table[I2 - v9dv9[FkO[[i]],inv9[Fk[[i]]]] - (lambda-lambdaO)*nukfun[delta, invYk[[i]], mexp[[i]], nu, Mkic[[i]]], {i,nback}] 45 | R ⊨ Join[Rphi, Rpl]; 46 | Do[R ⊨ Join[R, Rk[[i]]], {i, nback} ] 47 | 48 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/SpecialFunctions: -------------------------------------------------------------------------------- 1 | 2 | (*General utility functions*) 3 | ck[Fk_]:=v9dv9[inv9[trans9[Fk]], inv9[Fk]]; 4 | Ck[Fk_]:=v9dv9[trans9[Fk], Fk]; 5 | 6 | (* STRESS CALCULATIONS *) 7 | 8 | Switch[FreeEnergy 9 | , 1,(*Larijani2013*) 10 | Micfun[Gmod_, Kmod_, Ce_] := Gmod*((det9[Ce])^(-1/3))*dev9[Ce] + Kmod*(det9[Ce] - SMSSqrt[det9[Ce]])*I2; 11 | Mkicfun[Hk_, Fk_] := (-signconv)*Hk*((det9[ck[Fk]])^(-1/3))*(dev9[ck[Fk]]); 12 | 13 | , 2,(*Vladimirov2007*) 14 | Micfun[Gmod_, Kmod_, Ce_] := Gmod*(Ce - I2) + (Kmod - (2/3)*Gmod)*(det9[Ce] - 1)*I2/2; 15 | Mkicfun[Hk_, Fk_] := signconv*dev9[Hk*(v9dv9[Fk, trans9[Fk]] - I2)]; 16 | 17 | , 3,(*Special combo*) 18 | Micfun[Gmod_, Kmod_, Ce_] := Gmod*((det9[Ce])^(-1/3))*dev9[Ce] + Kmod*(det9[Ce] - SMSSqrt[det9[Ce]])*I2; 19 | Mkicfun[Hk_, Fk_] := (signconv)*Hk*((det9[Ck[Fk]])^(-1/3))*((v9dv9[Fk, trans9[Fk]] - (1/3)*trace9[Ck[Fk]]*I2)); 20 | 21 | , _,(*DefaultOption*) 22 | Micfun[Gmod_, Kmod_, Ce_] := 0; 23 | Mkicfun[Hk_, Fk_] := 0; 24 | Style["Invalid free energy", 20, Bold, Background -> Red] 25 | ] 26 | 27 | 28 | (* EVOLUTION LAWS *) 29 | Switch[EvolutionLaw 30 | , 1,(*AF and BC combo*) 31 | nukfun[delta_, invYk_, mexp_, nu_, Mk_] := 32 | signconv*nu - signconv*( (3/2)*delta*dev9[trans9[Mk]]*invYk + (1 - delta)*invYk*dco[Mk, nu]*nu ); 33 | 34 | , 2,(*Ohno Wang type with AF/BC comb*) 35 | nukfun[delta_, invYk_, mexp_, nu_, Mk_] := signconv*nu - signconv*SMSIf[vonM[Mk] < eps, 0*nu, 36 | (invYk^(mexp + 1)) * macaulay[dco[nu, Mk]] * ((vonM[Mk])^mexp) * ( delta*(3/2)*dev9[trans9[Mk]]/vonM[Mk] + (1 - delta)*nu ) ]; 37 | 38 | , _,(*DefaultOption*) 39 | nukfun[delta_, invYk_, mexp_, nu_, Mk_]:=0; 40 | Style["Invalid evolution law", 20, Bold, Background -> Red] 41 | ] -------------------------------------------------------------------------------- /models/GenFiniteStrain/AceGen/findprefix.m: -------------------------------------------------------------------------------- 1 | function found = findprefix(str,pref) 2 | %Look for the pref in str 3 | tmp = regexp(str,pref); 4 | %Check if it was found and that it was first 5 | found = (~isempty(tmp))&&(tmp==1); 6 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/doc/gfs_bc.md: -------------------------------------------------------------------------------- 1 | # gfs_bc 2 | This model can have 2-4 back-stresses and is rate-independent. For a detailed description of the model formulation, please see the paper in ref.bib 3 | 4 | # parameters 5 | 1. G (Shear modulus) 6 | 2. K (Bulk modulus) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 11 | 7. Hk1 (Kinematic hardening modulus nr. 1) 12 | 8. invYk1 (Inverse of kinematic saturation stress nr 1) 13 | 9. mk1 (Not used in this model) 14 | 10. Hk2 (Kinematic hardening modulus nr. 2) 15 | 11. invYk2 (Inverse of kinematic saturation stress nr 2) 16 | 12. mk2 (Not used in this model) 17 | 18 | ... 19 | 20 | # state variables 21 | 1) lambda (Total plastic multiplier) 22 | 2-10) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 23 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 24 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 25 | 26 | ... -------------------------------------------------------------------------------- /models/GenFiniteStrain/doc/gfs_ob.md: -------------------------------------------------------------------------------- 1 | # gfs_ob 2 | This model can have 2-4 back-stresses and is rate-independent. For a detailed description of the model formulation, please see the paper Meyer2018 in ref.bib 3 | 4 | # parameters 5 | 1. G (Shear modulus) 6 | 2. K (Bulk modulus) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 11 | 7. Hk1 (Kinematic hardening modulus nr. 1) 12 | 8. invYk1 (Inverse of kinematic saturation stress nr 1) 13 | 9. mk1 (Exponent in ohno-wang evolution law for back-stress nr. 1) 14 | 10. Hk2 (Kinematic hardening modulus nr. 2) 15 | 11. invYk2 (Inverse of kinematic saturation stress nr 2) 16 | 12. mk2 (Exponent in ohno-wang evolution law for back-stress nr. 2) 17 | 18 | ... 19 | 20 | # state variables 21 | 1) lambda (Total plastic multiplier) 22 | 2-10) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 23 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 24 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 25 | 26 | ... -------------------------------------------------------------------------------- /models/GenFiniteStrain/ref.bib: -------------------------------------------------------------------------------- 1 | @article{Meyer2018, 2 | author = {Meyer, Knut Andreas and Ekh, Magnus and Ahlstr{\"{o}}m, Johan}, 3 | doi = {10.1016/j.ijsolstr.2017.10.007}, 4 | journal = {International Journal of Solids and Structures}, 5 | keywords = {Axial-Torsion,Biaxial,Finite strains,Multiaxial,Pearlitic steel}, 6 | pages = {122--132}, 7 | publisher = {Elsevier Ltd}, 8 | title = {{Modeling of kinematic hardening at large biaxial deformations in pearlitic rail steel}}, 9 | url = {https://doi.org/10.1016/j.ijsolstr.2017.10.007}, 10 | volume = {130-131}, 11 | year = {2018} 12 | } 13 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.0) 2 | 3 | set(model gfs_bc CACHE STRING "Which model to build, allowed values are gfs_bc or gfs_ob") 4 | 5 | if (NOT CMAKE_BUILD_TYPE) 6 | set(CMAKE_BUILD_TYPE Release CACHE STRING 7 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) 8 | endif() 9 | 10 | if (NOT umat_utils_path) 11 | set(umat_utils_path "${CMAKE_CURRENT_SOURCE_DIR}/../../umat_utils" CACHE STRING "Folder containing umat utility routines") 12 | endif() 13 | 14 | 15 | project(GFS) 16 | enable_language (Fortran) 17 | 18 | ## To build for 64 bit and visual studio, call (from build folder): cmake -G "Visual Studio 11 2012 Win64" 19 | ## if you have this particular version of Visual studio installed. 20 | 21 | # Get system information 22 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 23 | set(A64 TRUE) # 64 bit compilation system - needs to be same as for mpsim 24 | else() 25 | set(A64 FALSE) # 32 bit compilation system - needs to be same as for mpsim 26 | endif() 27 | get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) 28 | if (Fortran_COMPILER_NAME MATCHES "gfortran.*") 29 | set(GFORT TRUE) 30 | set(IFORT FALSE) 31 | if (A64) 32 | add_compile_options(-m64 -ffree-line-length-none -ffree-form) 33 | else () 34 | add_compile_options(-ffree-line-length-none -ffree-form) 35 | endif() 36 | elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") 37 | set(GFORT FALSE) 38 | set(IFORT TRUE) 39 | add_compile_options("$<$:/warn>") 40 | add_compile_options("$<$:/check>") 41 | endif() 42 | 43 | 44 | # Add files 45 | add_library(GFS SHARED "GeneralFiniteStrain.for") 46 | target_sources(GFS PRIVATE 47 | "${umat_utils_path}/smsutility.f90" 48 | "${model}.f90" 49 | "${umat_utils_path}/SolveMatrixEquation.f90" 50 | "${umat_utils_path}/tensors_module.f90" 51 | "GFS_module.f90" 52 | ) 53 | 54 | set_target_properties(GFS PROPERTIES OUTPUT_NAME "${model}") 55 | set_target_properties(GFS PROPERTIES PREFIX "") 56 | 57 | # Link to MKL library 58 | if (MSVC) #If Microsoft Visual compiler 59 | if (A64) 60 | target_link_libraries(GFS PRIVATE "mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib") 61 | else() 62 | target_link_libraries(GFS PRIVATE "mkl_intel_c.lib mkl_sequential.lib mkl_core.lib") 63 | endif() 64 | elseif (A64) 65 | if (UNIX AND NOT APPLE) # I.e. linux 66 | set (MKLROOT $ENV{MKLROOT} CACHE STRING "Please specify your MKLROOT path") 67 | target_include_directories(GFS PRIVATE "${MKLROOT}/include") 68 | if (GFORT) 69 | target_link_libraries(GFS PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 70 | elseif (IFORT) 71 | target_link_libraries(GFS PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 72 | endif () 73 | endif() 74 | else() 75 | message("System configuration not supported") 76 | endif() 77 | -------------------------------------------------------------------------------- /models/GenFiniteStrain/src/abaqus_compile_files.txt: -------------------------------------------------------------------------------- 1 | gfs_bc,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","gfs_bc.f90","../../umat_utils/tensors_module.f90","GFS_module.f90","GeneralFiniteStrain.for" 2 | gfs_ob,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","gfs_ob.f90","../../umat_utils/tensors_module.f90","GFS_module.f90","GeneralFiniteStrain.for" -------------------------------------------------------------------------------- /models/GenFiniteStrain/src/smsutility.f90: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/GenFiniteStrain/src/smsutility.f90 -------------------------------------------------------------------------------- /models/GenSmallStrain/AceGen/ResidualSetup: -------------------------------------------------------------------------------- 1 | < Red] 19 | 20 | ] 21 | 22 | (* OVERSTRESS_FUNCTIONS *) 23 | 24 | Switch[overstress 25 | 26 | , 1,(*Norton*) 27 | etafun[phi_, y0_, kap_, nexp_] := (macaulay[phi]/y0)^nexp; 28 | 29 | , 2,(*cowsym*) 30 | etafun[phi_, y0_, kap_, nexp_] := (macaulay[phi]/(y0+kap))^nexp; 31 | 32 | , 3,(*Delobelle*) 33 | etafun[phi_, y0_, kap_, nexp_] := Sinh[(macaulay[phi]/y0)^nexp]; 34 | 35 | , _,(*DefaultOption*) 36 | etafun[phi_, y0_, nexp_] := 0; 37 | Style["Invalid overstress function", 20, Bold, Background -> Red] 38 | 39 | ] -------------------------------------------------------------------------------- /models/GenSmallStrain/AceGen/make_acegen_mods.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | 5 | def main(input_args): 6 | 7 | ftyps = ['RF', 'dRdX'] # The two function types that should exist 8 | 9 | (umod, ftyp, nbak) = get_flist(ftyps) 10 | 11 | 12 | for m,f,n in zip(umod, ftyp, nbak): 13 | write_module(m,f,n) 14 | 15 | 16 | def get_flist(ftyps): 17 | dirs = os.listdir('build/') 18 | 19 | ftypes = [] 20 | models = [] 21 | nbacks = [] 22 | for file in dirs: 23 | tmp = file.split('.') 24 | if tmp[-1] == 'f90': 25 | base = tmp[0].split('_') 26 | if base[0] in ftyps: 27 | ftypes.append(base[0]) 28 | models.append('_'.join(base[1:-1])) 29 | nbacks.append(int(base[-1])) 30 | else: 31 | print('Unknown function type ' + base[0]) 32 | 33 | # Organize 34 | umodels = list(set(models)) 35 | ftyp = [] 36 | nbak = [] 37 | for um in umodels: 38 | ftyp.append([]) 39 | nbak.append([]) 40 | for m,f,n in zip(models, ftypes, nbacks): 41 | if m==um: 42 | ftyp[-1].append(f) 43 | nbak[-1].append(n) 44 | 45 | return umodels, ftyp, nbak 46 | 47 | 48 | def write_module(model, ftypes, nback): 49 | module_name = 'build_output/' + model + '_acegen_mod.f90' 50 | fid = open(module_name, 'w') 51 | fid.write('! Module for ' + model + '\n') 52 | fid.write('! Functions generated with AceGen and collected by make_acegen_mods.py' + '\n') 53 | fid.write('module acegen_mod' + '\n') 54 | fid.write('use smsutility' + '\n') 55 | fid.write('implicit none' + '\n\n') 56 | fid.write('private' + '\n\n') 57 | for f,n in zip(ftypes, nback): 58 | fid.write('public ' + f + str(n) + '\n') 59 | 60 | fid.write('\n') 61 | fid.write('contains' + '\n\n') 62 | 63 | for f,n in zip(ftypes, nback): 64 | fname = 'build/' + f + '_' + model + '_' + str(n) + '.f90' 65 | fid.write(clean_filestring(fname)) 66 | 67 | fid.write('end module acegen_mod') 68 | fid.close() 69 | 70 | 71 | def clean_filestring(file): 72 | # Remove comments above subroutine 73 | # Remove the v argument from the subroutine 74 | # Remove the use SMSUtility line 75 | # Add " SUBROUTINE" to the last "END" statement (Needed?) (not implemented...) 76 | 77 | with open(file, 'r') as fid: 78 | for line in fid: 79 | if len(line.split('!')[0])>1: 80 | break # First non-empty, non-commented line found 81 | line = '('.join(line.split('(v,')) 82 | fstr = line 83 | line = fid.readline() # Discard the next line (use SMSUtility) 84 | 85 | for line in fid: 86 | fstr = fstr + line 87 | 88 | fstr = fstr[:-1] + ' subroutine' + '\n\n' # Add end subroutine statement 89 | 90 | return fstr 91 | 92 | 93 | if __name__ == '__main__': 94 | main(sys.argv) # run the main function 95 | -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/chaboche.md: -------------------------------------------------------------------------------- 1 | # chaboche 2 | This model can have up to 4 back-stresses and is rate-independent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. Hk1 (Kinematic hardening modulus nr. 1) 11 | 7. invYk1 (Inverse of kinematic saturation stress nr 1) 12 | 8. Hk2 (Kinematic hardening modulus nr. 2) 13 | 9. invYk2 (Inverse of kinematic saturation stress nr 2) 14 | 15 | ... 16 | 17 | # state variables 18 | 1) kappa (Isotropic hardening stress) 19 | 20 | 2) lambda (plastic multiplier) 21 | 22 | 3-8) bs1 (back-stress 1) 23 | 24 | 9-14) bs2 (back-stress 2) 25 | 26 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/chaboche_cowsym.md: -------------------------------------------------------------------------------- 1 | # chaboche_cowsym 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. Hk1 (Kinematic hardening modulus nr. 1) 13 | 9. invYk1 (Inverse of kinematic saturation stress nr 1) 14 | 10. Hk2 (Kinematic hardening modulus nr. 2) 15 | 11. invYk2 (Inverse of kinematic saturation stress nr 2) 16 | 17 | ... 18 | 19 | # state variables 20 | 1) kappa (Isotropic hardening stress) 21 | 22 | 2-7) bs1 (back-stress 1) 23 | 24 | 8-13) bs2 (back-stress 2) 25 | 26 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/chaboche_delobelle.md: -------------------------------------------------------------------------------- 1 | # chaboche_delobelle 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. Hk1 (Kinematic hardening modulus nr. 1) 13 | 9. invYk1 (Inverse of kinematic saturation stress nr 1) 14 | 10. Hk2 (Kinematic hardening modulus nr. 2) 15 | 11. invYk2 (Inverse of kinematic saturation stress nr 2) 16 | 17 | ... 18 | 19 | # state variables 20 | 1) kappa (Isotropic hardening stress) 21 | 22 | 2-7) bs1 (back-stress 1) 23 | 24 | 8-13) bs2 (back-stress 2) 25 | 26 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/chaboche_norton.md: -------------------------------------------------------------------------------- 1 | # chaboche_norton 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. Hk1 (Kinematic hardening modulus nr. 1) 13 | 9. invYk1 (Inverse of kinematic saturation stress nr 1) 14 | 10. Hk2 (Kinematic hardening modulus nr. 2) 15 | 11. invYk2 (Inverse of kinematic saturation stress nr 2) 16 | 17 | ... 18 | 19 | # state variables 20 | 1) kappa (Isotropic hardening stress) 21 | 22 | 2-7) bs1 (back-stress 1) 23 | 24 | 8-13) bs2 (back-stress 2) 25 | 26 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/delobelle.md: -------------------------------------------------------------------------------- 1 | # delobelle 2 | This model can have up to 4 back-stresses and is rate-independent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 11 | 7. Hk1 (Kinematic hardening modulus nr. 1) 12 | 8. invYk1 (Inverse of kinematic saturation stress nr 1) 13 | 9. Hk2 (Kinematic hardening modulus nr. 2) 14 | 10. invYk2 (Inverse of kinematic saturation stress nr 2) 15 | 16 | ... 17 | 18 | # state variables 19 | 1) kappa (Isotropic hardening stress) 20 | 21 | 2) lambda (plastic multiplier) 22 | 23 | 3-8) bs1 (back-stress 1) 24 | 25 | 9-14) bs2 (back-stress 2) 26 | 27 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/delobelle_cowsym.md: -------------------------------------------------------------------------------- 1 | # delobelle_cowsym 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 13 | 9. Hk1 (Kinematic hardening modulus nr. 1) 14 | 10. invYk1 (Inverse of kinematic saturation stress nr 1) 15 | 11. Hk2 (Kinematic hardening modulus nr. 2) 16 | 12. invYk2 (Inverse of kinematic saturation stress nr 2) 17 | 18 | ... 19 | 20 | # state variables 21 | 1) kappa (Isotropic hardening stress) 22 | 23 | 2-7) bs1 (back-stress 1) 24 | 25 | 8-13) bs2 (back-stress 2) 26 | 27 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/delobelle_delobelle.md: -------------------------------------------------------------------------------- 1 | # delobelle_delobelle 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 13 | 9. Hk1 (Kinematic hardening modulus nr. 1) 14 | 10. invYk1 (Inverse of kinematic saturation stress nr 1) 15 | 11. Hk2 (Kinematic hardening modulus nr. 2) 16 | 12. invYk2 (Inverse of kinematic saturation stress nr 2) 17 | 18 | ... 19 | 20 | # state variables 21 | 1) kappa (Isotropic hardening stress) 22 | 23 | 2-7) bs1 (back-stress 1) 24 | 25 | 8-13) bs2 (back-stress 2) 26 | 27 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/delobelle_norton.md: -------------------------------------------------------------------------------- 1 | # delobelle_norton 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 13 | 9. Hk1 (Kinematic hardening modulus nr. 1) 14 | 10. invYk1 (Inverse of kinematic saturation stress nr 1) 15 | 11. Hk2 (Kinematic hardening modulus nr. 2) 16 | 12. invYk2 (Inverse of kinematic saturation stress nr 2) 17 | 18 | ... 19 | 20 | # state variables 21 | 1) kappa (Isotropic hardening stress) 22 | 23 | 2-7) bs1 (back-stress 1) 24 | 25 | 8-13) bs2 (back-stress 2) 26 | 27 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/GenSmallStrain/doc/description.pdf -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/latex/MyCustomCommands.sty: -------------------------------------------------------------------------------- 1 | %My custom commands 2 | \usepackage{bm} 3 | \usepackage{accents} 4 | \usepackage{subdepth} %Ensure subscripts height is unaffected by superscripts 5 | \usepackage{fixltx2e} %Alternatively: etoolbox with robustify 6 | \MakeRobust{\underaccent} 7 | 8 | %% Special fonts etc to ensure consistency througout document 9 | \newcommand{\unit}[1]{\,\mathrm{#1}} %Use this for unit notation to ensure consistency (an possibility to change later) 10 | \newcommand{\e}[1]{\times 10^{#1}} 11 | 12 | %% MATH OPERATORS ==================================================== 13 | %Differential operators 14 | \newcommand{\dif} {\mathrm{d}} 15 | \newcommand{\diff}[2][]{\frac{\dif #1}{\dif #2}} 16 | \newcommand{\tdif}[2][]{\frac{\dif ^2 #1}{(\dif #2)^2}} 17 | \newcommand{\ndiff}[3][]{\frac{\dif ^{#3} #1}{(\dif #2)^{#3}}} 18 | \newcommand{\pdif} {\partial} 19 | \newcommand{\pdiff}[2][]{\frac{\partial #1}{\partial #2}} 20 | \newcommand{\ptdif}[2][]{\frac{\partial ^2 #1}{(\partial #2)^2}} 21 | \newcommand{\pttdif}[3][]{\frac{\partial ^2 #1}{\partial #2 \partial #3}} 22 | 23 | %Subscripts and superscripts 24 | \newcommand{\inds}[1]{_{#1}} %Use for index notation 25 | \newcommand{\subscr}[1]{_{\mathrm{#1}}} 26 | \newcommand{\supscr}[1]{^{\mathrm{#1}}} 27 | \newcommand{\subsup}[2]{\subscr{#1}\supscr{#2}} 28 | 29 | \newcommand\leftidx[3]{%Super/subsripts in front and after 30 | {\vphantom{#2}}#1#2#3% 31 | } 32 | \newcommand\leftidxrm[3]{%Super/subsripts in front and after in roman 33 | {\vphantom{#2}}\mathrm{#1}#2\mathrm{#3}% 34 | } 35 | 36 | 37 | %Numerical time 38 | % General time (use by default, and change n to k using renewcommand if desired) 39 | \newcommand{\old}[1]{\leftidxrm{^{n-1}}{#1}{}} 40 | \newcommand{\cur}[1]{\leftidxrm{^{n}}{#1}{}} 41 | \newcommand{\new}[1]{\leftidxrm{^{n+1}}{#1}{}} 42 | %If n is to be used in special case 43 | \newcommand{\oldn}[1]{\leftidxrm{^{n-1}}{#1}{}} 44 | \newcommand{\curn}[1]{\leftidxrm{^{n}}{#1}{}} 45 | \newcommand{\newn}[1]{\leftidxrm{^{n+1}}{#1}{}} 46 | %If k is to be used in special case 47 | \newcommand{\oldk}[1]{\leftidxrm{^{k-1}}{#1}{}} 48 | \newcommand{\curk}[1]{\leftidxrm{^{k}}{#1}{}} 49 | \newcommand{\newk}[1]{\leftidxrm{^{k+1}}{#1}{}} 50 | 51 | % Special symbols often used with dots 52 | \newcommand{\lambdadot}{\dot{\lambda}} 53 | 54 | 55 | %% NOTATIONS ========================================================= 56 | \newcommand{\voigt}[1]{\underline{\bm{#1}}} %Voigt notation 57 | \newcommand{\set}[1]{\mathbb{#1}} %Set 58 | 59 | % Standard tensors 60 | \newcommand{\ta}[1]{\bm{#1}} %1st order tensor 61 | \newcommand{\ts}[1]{\bm{#1}} %2nd order tensor 62 | \newcommand{\td}[1]{\mathcal{#1}} %3rd order tensor 63 | \newcommand{\tf}[1]{\mathsf{#1}} %4th order tensor 64 | 65 | % Inverse tensors 66 | \newcommand{\tsi}[1]{\ts{#1}^{-1}} %Inverse 2nd 67 | \newcommand{\tfi}[1]{\tf{#1}^{-1}} %Inverse 4th 68 | 69 | % Transpose tensors 70 | \newcommand{\tst}[1]{\ts{#1}^{\mathrm{t}}} %Transpose 2nd 71 | \newcommand{\tft}[1]{\tf{#1}^{\mathrm{T}}} %Transpose 4th 72 | 73 | % Transpose inverse tensors 74 | \newcommand{\tsti}[1]{\ts{#1}^{-\mathrm{t}}} %Transpose inverse 2nd 75 | \newcommand{\tfti}[1]{\tf{#1}^{-\mathrm{T}}} %Transpose inverse 4th 76 | 77 | \newcommand{\tad}[1]{\dot{\ta{#1}}} %Dot 1st 78 | \newcommand{\tsd}[1]{\dot{\ts{#1}}} %Dot 2nd 79 | \newcommand{\tdd}[1]{\dot{\td{#1}}} %Dot 3rd 80 | \newcommand{\tfd}[1]{\dot{\tf{#1}}} %Dot 4th 81 | 82 | %% TENSOR DECORATIONS =============================================== 83 | % Index notation of decorated tensors 84 | \newcommand{\indnot}[2]{\left(#1\right)\inds{#2}} 85 | 86 | % Superscripts 87 | \newcommand{\eff}{^{\mathrm{eff}}} % Effective value 88 | \newcommand{\dev}{^{\mathrm{dev}}} % Deviatoric part 89 | \newcommand{\vol}{^{\mathrm{vol}}} % Volumetric part 90 | \newcommand{\sym}{^{\mathrm{sym}}} % Symmetric part 91 | \newcommand{\skw}{^{\mathrm{skw}}} % Skew part 92 | \newcommand{\trans}{^{\mathrm{t}}} % Transpose small t 93 | \newcommand{\Trans}{^{\mathrm{T}}} % Transpose captial T 94 | \newcommand{\itrans}{^{-\mathrm{t}}} % Inverse transpose t 95 | \newcommand{\iTrans}{^{-\mathrm{T}}} % Inverse transpose T 96 | \newcommand{\inv}{^{-1}} % Inverse 97 | 98 | % Subscripts 99 | \newcommand{\el}{_{\mathrm{e}}} % Elastic 100 | \newcommand{\pl}{_{\mathrm{p}}} % Plastic 101 | \newcommand{\mean}{_{\mathrm{m}}} % Mean value 102 | \newcommand{\red}{_{\mathrm{red}}} % Reduced value 103 | \newcommand{\iso}{_{\mathrm{iso}}} % Isotropic 104 | \newcommand{\kin}{_{\mathrm{kin}}} % Kinematic 105 | \newcommand{\kini}{_{\mathrm{kin}, i}} % Kinematic, i 106 | \newcommand{\trial}{_{\mathrm{tr}}} % Trial value 107 | 108 | % For typing out second order base indicies conveniently 109 | \newcommand{\be}[1]{\ta{e}_{#1}} 110 | \newcommand{\bee}[2]{\ta{e}_{#1}\otimes\ta{e}_{#2}} 111 | \newcommand{\beee}[3]{\ta{e}_{#1}\otimes\ta{e}_{#2}\otimes\ta{e}_{#3}} 112 | \newcommand{\beeee}[4]{\ta{e}_{#1}\otimes\ta{e}_{#2}\otimes\ta{e}_{#3}\otimes\ta{e}_{#4}} 113 | 114 | %% OPERATIONS ======================================================== 115 | %% Scalar operations 116 | \newcommand{\macaulay}[1]{\left\langle #1 \right\rangle} 117 | 118 | %% Vector and tensor operations 119 | \newcommand{\abs}[1]{\vert #1 \vert} %Absolute value 120 | \newcommand{\norm}[1]{\left\vert\left\vert #1 \right\vert\right\vert} %Norm ||x|| 121 | \newcommand{\tr}{\mathrm{tr}} 122 | \newcommand{\lotimes}{\mathrm{Use\,opl\,instead}} 123 | \newcommand{\uotimes}{\mathrm{Use\,opu\,instead}} 124 | 125 | \newcommand{\op}{\otimes} %Open product ij x kl 126 | \newcommand{\opl}{\mkern2.5mu\underline{\mkern-2.5mu\otimes\mkern-2.5mu}\mkern2.5mu} %Lower open product il x jk 127 | \newcommand{\opu}{\mkern2.5mu\overline{\mkern-2.5mu\otimes\mkern-2.5mu}\mkern2.5mu} %Upper open product ik x jl 128 | \newcommand{\dco}{:} %Double contraction 129 | 130 | -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/latex/Settings.tex: -------------------------------------------------------------------------------- 1 | \usepackage[latin1]{inputenc} 2 | \usepackage[english]{babel} 3 | \usepackage{amsmath} 4 | \usepackage{amsfonts} 5 | \usepackage{amssymb} 6 | \usepackage{graphicx} 7 | \usepackage{tabularx} 8 | \usepackage{tikz} 9 | \usepackage{siunitx} 10 | \usetikzlibrary{shapes.geometric, arrows} 11 | \usepackage{subfiles} 12 | \usepackage[obeyspaces,spaces,hyphens]{url} 13 | \usepackage{hyperref} 14 | %\usepackage{showframe} 15 | \usepackage{makecell} 16 | \usepackage{ifthen} 17 | \usepackage{xstring} 18 | \usepackage{csquotes} 19 | 20 | 21 | \usepackage{MyCustomCommands} 22 | 23 | -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/ohnowang.md: -------------------------------------------------------------------------------- 1 | # ohnowang 2 | This model can have up to 4 back-stresses and is rate-independent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 11 | 7. Hk1 (Kinematic hardening modulus nr. 1) 12 | 8. invYk1 (Inverse of kinematic saturation stress nr 1) 13 | 9. mk1 (Exponent in kinematic evolution law nr 1) 14 | 10. Hk2 (Kinematic hardening modulus nr. 2) 15 | 11. invYk2 (Inverse of kinematic saturation stress nr 2) 16 | 12. mk2 (Exponent in kinematic evolution law nr 2) 17 | ... 18 | 19 | # state variables 20 | 1) kappa (Isotropic hardening stress) 21 | 22 | 2) lambda (plastic multiplier) 23 | 24 | 3-8) bs1 (back-stress 1) 25 | 26 | 9-14) bs2 (back-stress 2) 27 | 28 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/ohnowang_cowsym.md: -------------------------------------------------------------------------------- 1 | # ohnowang_cowsym 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 13 | 9. Hk1 (Kinematic hardening modulus nr. 1) 14 | 10. invYk1 (Inverse of kinematic saturation stress nr 1) 15 | 11. mk1 (Exponent in kinematic evolution law nr 1) 16 | 12. Hk2 (Kinematic hardening modulus nr. 2) 17 | 13. invYk2 (Inverse of kinematic saturation stress nr 2) 18 | 14. mk2 (Exponent in kinematic evolution law nr 2) 19 | 20 | ... 21 | 22 | # state variables 23 | 1) kappa (Isotropic hardening stress) 24 | 25 | 2-7) bs1 (back-stress 1) 26 | 27 | 8-13) bs2 (back-stress 2) 28 | 29 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/ohnowang_delobelle.md: -------------------------------------------------------------------------------- 1 | # ohnowang_delobelle 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 13 | 9. Hk1 (Kinematic hardening modulus nr. 1) 14 | 10. invYk1 (Inverse of kinematic saturation stress nr 1) 15 | 11. mk1 (Exponent in kinematic evolution law nr 1) 16 | 12. Hk2 (Kinematic hardening modulus nr. 2) 17 | 13. invYk2 (Inverse of kinematic saturation stress nr 2) 18 | 14. mk2 (Exponent in kinematic evolution law nr 2) 19 | 20 | ... 21 | 22 | # state variables 23 | 1) kappa (Isotropic hardening stress) 24 | 25 | 2-7) bs1 (back-stress 1) 26 | 27 | 8-13) bs2 (back-stress 2) 28 | 29 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/doc/ohnowang_norton.md: -------------------------------------------------------------------------------- 1 | # ohnowang_norton 2 | This model can have up to 4 back-stresses and is rate-dependent 3 | 4 | # parameters 5 | 1. E (Elastic modulus) 6 | 2. nu (Poissons ratio) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. invYiso (Inverse of isotropic saturation stress) 10 | 6. tstar (Relaxation time parameter) 11 | 7. nexp (Exponent in overstress function) 12 | 8. delta (Scaling of armstrong frederick (delta=1) and burlet-cailletaud (delta=0)) 13 | 9. Hk1 (Kinematic hardening modulus nr. 1) 14 | 10. invYk1 (Inverse of kinematic saturation stress nr 1) 15 | 11. mk1 (Exponent in kinematic evolution law nr 1) 16 | 12. Hk2 (Kinematic hardening modulus nr. 2) 17 | 13. invYk2 (Inverse of kinematic saturation stress nr 2) 18 | 14. mk2 (Exponent in kinematic evolution law nr 2) 19 | 20 | ... 21 | 22 | # state variables 23 | 1) kappa (Isotropic hardening stress) 24 | 25 | 2-7) bs1 (back-stress 1) 26 | 27 | 8-13) bs2 (back-stress 2) 28 | 29 | ... -------------------------------------------------------------------------------- /models/GenSmallStrain/ref.bib: -------------------------------------------------------------------------------- 1 | @misc{Meyer2019, 2 | author = {Meyer, Knut Andreas}, 3 | title = {umat collection}, 4 | url = {https://github.com/KnutAM/umat}, 5 | year = {2019}, 6 | note = {These models have been developed soley based on known literature, and it suffices to reference from where you obtained them} 7 | } 8 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ## CMake for general small strain plasticity models for matmodfit 2 | 3 | ## To build for 64 bit and visual studio, call (from build folder): cmake -G "Visual Studio 11 2012 Win64" 4 | ## if you have this particular version of Visual studio installed. 5 | 6 | ## For building of different methods, specify the basemod and ratemod as CMake input: 7 | ## E.g. cmake -D basemod=ohnowang -D ratemod=norton ../src 8 | ## Or modify using either ccmake or cmake-gui 9 | 10 | cmake_minimum_required (VERSION 3.0) 11 | 12 | set(basemod chaboche CACHE STRING "Which base model to build") 13 | set_property(CACHE basemod PROPERTY STRINGS "chaboche" "delobelle" "ohnowang") 14 | 15 | set(ratemod norate CACHE STRING "Which overstress model to build") 16 | set_property(CACHE ratemod PROPERTY STRINGS "norate" "norton" "cowsym" "delobelle") 17 | 18 | if (NOT CMAKE_BUILD_TYPE) 19 | set(CMAKE_BUILD_TYPE Release CACHE STRING 20 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) 21 | endif() 22 | 23 | if (NOT umat_utils_path) 24 | set(umat_utils_path "${CMAKE_CURRENT_SOURCE_DIR}/../../umat_utils" CACHE STRING "Folder containing umat utility routines") 25 | endif() 26 | 27 | project(GeneralSmallStrainPlasticity) 28 | enable_language (Fortran) 29 | 30 | # Get system information 31 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 32 | set(A64 TRUE) # 64 bit compilation system - needs to be same as for mpsim 33 | else() 34 | set(A64 FALSE) # 32 bit compilation system - needs to be same as for mpsim 35 | endif() 36 | get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) 37 | if (Fortran_COMPILER_NAME MATCHES "gfortran.*") 38 | set(GFORT TRUE) 39 | set(IFORT FALSE) 40 | if (A64) 41 | add_compile_options(-m64 -ffree-line-length-none -ffree-form) 42 | else () 43 | add_compile_options(-ffree-line-length-none -ffree-form) 44 | endif() 45 | elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") 46 | set(GFORT FALSE) 47 | set(IFORT TRUE) 48 | add_compile_options("$<$:/warn>") 49 | add_compile_options("$<$:/check>") 50 | endif() 51 | 52 | 53 | # Add files 54 | add_library(GSS SHARED "GeneralSmallStrain.f90") 55 | target_sources(GSS PRIVATE 56 | "gss_module.f90" 57 | "${umat_utils_path}/SolveMatrixEquation.f90" 58 | "${umat_utils_path}/smsutility.f90" 59 | ) 60 | if ("${ratemod}" STREQUAL "norate") 61 | target_sources(GSS PRIVATE 62 | "${basemod}.f90" # Special version for the rate independent models 63 | "${basemod}_acegen_mod.f90" 64 | ) 65 | set_target_properties(GSS PROPERTIES OUTPUT_NAME "${basemod}") 66 | else() 67 | target_sources(GSS PRIVATE 68 | "${basemod}_rdep.f90" 69 | "${basemod}_${ratemod}_acegen_mod.f90" 70 | ) 71 | set_target_properties(GSS PROPERTIES OUTPUT_NAME "${basemod}_${ratemod}") 72 | endif() 73 | 74 | set_target_properties(GSS PROPERTIES PREFIX "") # Avoid the lib prefix on linux 75 | 76 | # Link to MKL library 77 | if (MSVC) #If Microsoft Visual compiler 78 | if (A64) 79 | target_link_libraries(GSS PRIVATE "mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib") 80 | else() 81 | target_link_libraries(GSS PRIVATE "mkl_intel_c.lib mkl_sequential.lib mkl_core.lib") 82 | endif() 83 | elseif (A64) 84 | if (UNIX AND NOT APPLE) # I.e. linux 85 | set (MKLROOT $ENV{MKLROOT} CACHE STRING "Please specify your MKLROOT path") 86 | target_include_directories(GSS PRIVATE "${MKLROOT}/include") 87 | if (GFORT) 88 | target_link_libraries(GSS PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 89 | elseif (IFORT) 90 | target_link_libraries(GSS PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 91 | endif () 92 | endif() 93 | else() 94 | message("System configuration not supported") 95 | endif() 96 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/abaqus_compile_files.txt: -------------------------------------------------------------------------------- 1 | chaboche,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","chaboche_acegen_mod.f90","chaboche.f90","gss_module.f90","GeneralSmallStrain.f90" 2 | chaboche_norton,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","chaboche_norton_acegen_mod.f90","chaboche_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 3 | chaboche_delobelle,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","chaboche_delobelle_acegen_mod.f90","chaboche_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 4 | chaboche_cowsym,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","chaboche_cowsym_acegen_mod.f90","chaboche_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 5 | delobelle,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","delobelle_acegen_mod.f90","delobelle.f90","gss_module.f90","GeneralSmallStrain.f90" 6 | delobelle_norton,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","delobelle_norton_acegen_mod.f90","delobelle_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 7 | delobelle_delobelle,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","delobelle_delobelle_acegen_mod.f90","delobelle_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 8 | delobelle_cowsym,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","delobelle_cowsym_acegen_mod.f90","delobelle_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 9 | ohnowang,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","ohnowang_acegen_mod.f90","ohnowang.f90","gss_module.f90","GeneralSmallStrain.f90" 10 | ohnowang_norton,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","ohnowang_norton_acegen_mod.f90","ohnowang_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 11 | ohnowang_delobelle,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","ohnowang_delobelle_acegen_mod.f90","ohnowang_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" 12 | ohnowang_cowsym,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","ohnowang_cowsym_acegen_mod.f90","ohnowang_rdep.f90","gss_module.f90","GeneralSmallStrain.f90" -------------------------------------------------------------------------------- /models/GenSmallStrain/src/chaboche.f90: -------------------------------------------------------------------------------- 1 | ! Material parameter definition for the Chaboche model, nprops = 5+2*nback 2 | ! Input: props = E, v, Y0, Hiso, invYiso, Hk1, invYk1, Hk2, ... 3 | ! Internal: mpar = G, K, Y0, Hiso, invYiso, {delta}, Hk1, invYk1, {mk1}, Hk2, ... 4 | 5 | module model_module 6 | implicit none 7 | 8 | integer, parameter, dimension(4):: nback_allowed = (/1,2,3,4/) 9 | integer, parameter :: nvar_add = 0 !Addition of variables relative rate independent model (hence zero here) 10 | integer :: nback !Number of backstresses 11 | integer :: nvar !Number of variables in local problem 12 | 13 | contains 14 | 15 | !Check that the input to the UMAT is correct (must be called first to assign nback) 16 | subroutine checkinput(nprops, nstatv, props, mpar) 17 | implicit none 18 | integer, intent(in) :: nprops, nstatv 19 | double precision, intent(in) :: props(:) ! Material properties input to umat 20 | double precision, allocatable :: mpar(:) ! Internally used material properties, to be consistent for different models 21 | logical :: error 22 | integer :: k1 23 | 24 | nback = (nstatv-2)/6 ! Calculate number of backstresses 25 | nvar = nstatv + 6 ! Calculate number of variables in local problem 26 | 27 | error = .false. 28 | ! Check allowed number of backstresses 29 | if (.not.any(nback==nback_allowed)) then 30 | error = .true. 31 | endif 32 | 33 | ! Check correct number of material parameters 34 | if (nprops.ne.(5 + 2*nback)) then 35 | error = .true. 36 | endif 37 | 38 | ! Check correct number of state variables 39 | if (nstatv.ne.(2 + 6*nback)) then 40 | error = .true. 41 | endif 42 | 43 | ! Quit analysis if invalid input 44 | if (error) then 45 | write(*,*) 'Invalid input to the Chaboche model (umat), it should be' 46 | write(*,*) 'nprops = 5+2*nback and' 47 | write(*,*) 'nstatv = 2+6*nback, but' 48 | write(*,"(A)", advance="no") 'nstatv = ' 49 | write(*,*) nstatv 50 | write(*,"(A)", advance="no") 'nprops = ' 51 | write(*,*) nprops 52 | write(*,"(A)", advance="no") 'nback = ' 53 | write(*,*) nback 54 | stop 55 | endif 56 | 57 | ! Put material parameters at consistent location to allow using the same AceGen code for multiple models: 58 | 59 | allocate(mpar(6+3*nback)) 60 | mpar = 0.d0 61 | mpar(1) = props(1)/(2*(1+props(2))) ! Convert from E and v to G = E/(2*(1+v)) 62 | mpar(2) = props(1)/(3*(1-2*props(2))) ! Convert from E and v to K = E/(3*(1-2v)) 63 | mpar(3:5) = props(3:5) 64 | do k1 = 1,nback 65 | mpar(7+3*(k1-1)) = props(6+2*(k1-1)) 66 | mpar(8+3*(k1-1)) = props(7+2*(k1-1)) 67 | enddo 68 | 69 | end subroutine checkinput 70 | 71 | end module 72 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/chaboche_rdep.f90: -------------------------------------------------------------------------------- 1 | ! Material parameter definition for the Chaboche model, nprops = 5+2*nback 2 | ! Input: props = E, v, Y0, Hiso, invYiso, tstar, nexp, Hk1, invYk1, Hk2, ... 3 | ! Internal: mpar = G, K, Y0, Hiso, invYiso, tstar, nexp, {delta}, Hk1, invYk1, {mk1}, Hk2, ... 4 | 5 | module model_module 6 | implicit none 7 | 8 | integer, parameter, dimension(4):: nback_allowed = (/1,2,3,4/) 9 | integer, parameter :: nvar_add = -1 !Addition of variables relative rate independent model 10 | integer :: nback !Number of backstresses 11 | integer :: nvar !Number of variables in local problem 12 | 13 | contains 14 | 15 | !Check that the input to the UMAT is correct (must be called first to assign nback) 16 | subroutine checkinput(nprops, nstatv, props, mpar) 17 | implicit none 18 | integer, intent(in) :: nprops, nstatv 19 | double precision, intent(in) :: props(:) ! Material properties input to umat 20 | double precision, allocatable :: mpar(:) ! Internally used material properties, to be consistent for different models 21 | logical :: error 22 | integer :: k1 23 | 24 | nback = (nstatv-1)/6 ! Calculate number of backstresses 25 | nvar = nstatv + 6 ! Calculate number of variables in local problem 26 | 27 | error = .false. 28 | ! Check allowed number of backstresses 29 | if (.not.any(nback==nback_allowed)) then 30 | error = .true. 31 | endif 32 | 33 | ! Check correct number of material parameters 34 | if (nprops.ne.(7 + 2*nback)) then 35 | error = .true. 36 | endif 37 | 38 | ! Check correct number of state variables 39 | if (nstatv.ne.(1 + 6*nback)) then 40 | error = .true. 41 | endif 42 | 43 | ! Quit analysis if invalid input 44 | if (error) then 45 | write(*,*) 'Invalid input to the chaboche rate dependent model (umat), it should be' 46 | write(*,*) 'nprops = 7+2*nback and' 47 | write(*,*) 'nstatv = 1+6*nback, but' 48 | write(*,"(A)", advance="no") 'nstatv = ' 49 | write(*,*) nstatv 50 | write(*,"(A)", advance="no") 'nprops = ' 51 | write(*,*) nprops 52 | write(*,"(A)", advance="no") 'nback = ' 53 | write(*,*) nback 54 | stop 55 | endif 56 | 57 | ! Put material parameters at consistent location to allow using the same AceGen code for multiple models: 58 | 59 | allocate(mpar(8+3*nback)) 60 | mpar = 0.d0 61 | mpar(1) = props(1)/(2*(1+props(2))) ! Convert from E and v to G = E/(2*(1+v)) 62 | mpar(2) = props(1)/(3*(1-2*props(2))) ! Convert from E and v to K = E/(3*(1-2v)) 63 | mpar(3:7) = props(3:7) 64 | do k1 = 1,nback 65 | mpar( 9+3*(k1-1)) = props(8+2*(k1-1)) 66 | mpar(10+3*(k1-1)) = props(9+2*(k1-1)) 67 | enddo 68 | 69 | end subroutine checkinput 70 | 71 | end module 72 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/cmake_compile_models.txt: -------------------------------------------------------------------------------- 1 | chaboche:-D basemod=chaboche -D ratemod=norate 2 | chaboche_norton:-D basemod=chaboche -D ratemod=norton 3 | chaboche_delobelle:-D basemod=chaboche -D ratemod=delobelle 4 | chaboche_cowsym:-D basemod=chaboche -D ratemod=cowsym 5 | delobelle:-D basemod=delobelle -D ratemod=norate 6 | delobelle_norton:-D basemod=delobelle -D ratemod=norton 7 | delobelle_delobelle:-D basemod=delobelle -D ratemod=delobelle 8 | delobelle_cowsym:-D basemod=delobelle -D ratemod=cowsym 9 | ohnowang:-D basemod=ohnowang -D ratemod=norate 10 | ohnowang_norton:-D basemod=ohnowang -D ratemod=norton 11 | ohnowang_delobelle:-D basemod=ohnowang -D ratemod=delobelle 12 | ohnowang_cowsym:-D basemod=ohnowang -D ratemod=cowsym -------------------------------------------------------------------------------- /models/GenSmallStrain/src/delobelle.f90: -------------------------------------------------------------------------------- 1 | ! Material parameter definition for the Delobelle model, nprops = 6+2*nback 2 | ! Input: props = E, v, Y0, Hiso, invYiso, delta, Hk1, invYk1, Hk2, ... 3 | ! Internal: mpar = G, K, Y0, Hiso, invYiso, delta, Hk1, invYk1, {mk1}, Hk2, ... 4 | 5 | module model_module 6 | use acegen_mod 7 | implicit none 8 | 9 | integer, parameter, dimension(4):: nback_allowed = (/1,2,3,4/) 10 | integer, parameter :: nvar_add = 0 !Addition of variables relative rate independent model (hence zero here) 11 | integer :: nback !Number of backstresses 12 | integer :: nvar !Number of variables in local problem 13 | 14 | contains 15 | 16 | !Check that the input to the UMAT is correct (must be called first to assign nback) 17 | subroutine checkinput(nprops, nstatv, props, mpar) 18 | implicit none 19 | integer, intent(in) :: nprops, nstatv 20 | double precision, intent(in) :: props(:) ! Material properties input to umat 21 | double precision, allocatable :: mpar(:) ! Internally used material properties, to be consistent for different models 22 | logical :: error 23 | integer :: k1 24 | 25 | nback = (nstatv-2)/6 ! Calculate number of backstresses 26 | nvar = nstatv + 6 ! Calculate number of variables in local problem 27 | 28 | error = .false. 29 | ! Check allowed number of backstresses 30 | if (.not.any(nback==nback_allowed)) then 31 | error = .true. 32 | endif 33 | 34 | ! Check correct number of material parameters 35 | if (nprops.ne.(6 + 2*nback)) then 36 | error = .true. 37 | endif 38 | 39 | ! Check correct number of state variables 40 | if (nstatv.ne.(2 + 6*nback)) then 41 | error = .true. 42 | endif 43 | 44 | ! Quit analysis if invalid input 45 | if (error) then 46 | write(*,*) 'Invalid input to the Delobelle model (umat), it should be' 47 | write(*,*) 'nprops = 6+2*nback and' 48 | write(*,*) 'nstatv = 2+6*nback, but' 49 | write(*,"(A)", advance="no") 'nstatv = ' 50 | write(*,*) nstatv 51 | write(*,"(A)", advance="no") 'nprops = ' 52 | write(*,*) nprops 53 | write(*,"(A)", advance="no") 'nback = ' 54 | write(*,*) nback 55 | stop 56 | endif 57 | 58 | ! Put material parameters at consistent location to allow using the same AceGen code for multiple models: 59 | 60 | allocate(mpar(6+3*nback)) 61 | mpar = 0.d0 62 | mpar(1) = props(1)/(2*(1+props(2))) ! Convert from E and v to G = E/(2*(1+v)) 63 | mpar(2) = props(1)/(3*(1-2*props(2))) ! Convert from E and v to K = E/(3*(1-2v)) 64 | mpar(3:6) = props(3:6) 65 | do k1 = 1,nback 66 | mpar(7+3*(k1-1)) = props(7+2*(k1-1)) 67 | mpar(8+3*(k1-1)) = props(8+2*(k1-1)) 68 | enddo 69 | 70 | end subroutine checkinput 71 | 72 | end module 73 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/delobelle_rdep.f90: -------------------------------------------------------------------------------- 1 | ! Material parameter definition for the Delobelle model, nprops = 6+2*nback 2 | ! Input: props = E, v, Y0, Hiso, invYiso, delta, Hk1, invYk1, Hk2, ... 3 | ! Internal: mpar = G, K, Y0, Hiso, invYiso, delta, Hk1, invYk1, {mk1}, Hk2, ... 4 | 5 | module model_module 6 | use acegen_mod 7 | implicit none 8 | 9 | integer, parameter, dimension(4):: nback_allowed = (/1,2,3,4/) 10 | integer, parameter :: nvar_add = -1 !Addition of variables relative rate independent model 11 | integer :: nback !Number of backstresses 12 | integer :: nvar !Number of variables in local problem 13 | 14 | contains 15 | 16 | !Check that the input to the UMAT is correct (must be called first to assign nback) 17 | subroutine checkinput(nprops, nstatv, props, mpar) 18 | implicit none 19 | integer, intent(in) :: nprops, nstatv 20 | double precision, intent(in) :: props(:) ! Material properties input to umat 21 | double precision, allocatable :: mpar(:) ! Internally used material properties, to be consistent for different models 22 | logical :: error 23 | integer :: k1 24 | 25 | nback = (nstatv-1)/6 ! Calculate number of backstresses 26 | nvar = nstatv + 6 ! Calculate number of variables in local problem 27 | 28 | error = .false. 29 | ! Check allowed number of backstresses 30 | if (.not.any(nback==nback_allowed)) then 31 | error = .true. 32 | endif 33 | 34 | ! Check correct number of material parameters 35 | if (nprops.ne.(8 + 2*nback)) then 36 | error = .true. 37 | endif 38 | 39 | ! Check correct number of state variables 40 | if (nstatv.ne.(1 + 6*nback)) then 41 | error = .true. 42 | endif 43 | 44 | ! Quit analysis if invalid input 45 | if (error) then 46 | write(*,*) 'Invalid input to the Delobelle rate dependent model (umat), it should be' 47 | write(*,*) 'nprops = 8+2*nback and' 48 | write(*,*) 'nstatv = 1+6*nback, but' 49 | write(*,"(A)", advance="no") 'nstatv = ' 50 | write(*,*) nstatv 51 | write(*,"(A)", advance="no") 'nprops = ' 52 | write(*,*) nprops 53 | write(*,"(A)", advance="no") 'nback = ' 54 | write(*,*) nback 55 | stop 56 | endif 57 | 58 | ! Put material parameters at consistent location to allow using the same AceGen code for multiple models: 59 | 60 | allocate(mpar(6+3*nback)) 61 | mpar = 0.d0 62 | mpar(1) = props(1)/(2*(1+props(2))) ! Convert from E and v to G = E/(2*(1+v)) 63 | mpar(2) = props(1)/(3*(1-2*props(2))) ! Convert from E and v to K = E/(3*(1-2v)) 64 | mpar(3:8) = props(3:8) 65 | do k1 = 1,nback 66 | mpar(9+3*(k1-1)) = props(9+2*(k1-1)) 67 | mpar(10+3*(k1-1)) = props(10+2*(k1-1)) 68 | enddo 69 | 70 | end subroutine checkinput 71 | 72 | end module 73 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/ohnowang.f90: -------------------------------------------------------------------------------- 1 | ! Material parameter definition for the Delobelle model, nprops = 6+2*nback 2 | ! Input: props = E, v, Y0, Hiso, invYiso, delta, Hk1, invYk1, mk1, Hk2, ... 3 | ! Internal: mpar = G, K, Y0, Hiso, invYiso, delta, Hk1, invYk1, mk1, Hk2, ... (same as props) 4 | 5 | module model_module 6 | use acegen_mod 7 | implicit none 8 | 9 | integer, parameter, dimension(4):: nback_allowed = (/1,2,3,4/) 10 | integer, parameter :: nvar_add = 0 !Addition of variables relative rate independent model (hence zero here) 11 | integer :: nback !Number of backstresses 12 | integer :: nvar !Number of variables in local problem 13 | 14 | contains 15 | 16 | !Check that the input to the UMAT is correct (must be called first to assign nback) 17 | subroutine checkinput(nprops, nstatv, props, mpar) 18 | implicit none 19 | integer, intent(in) :: nprops, nstatv 20 | double precision, intent(in) :: props(:) ! Material properties input to umat 21 | double precision, allocatable :: mpar(:) ! Internally used material properties, to be consistent for different models 22 | logical :: error 23 | integer :: k1 24 | 25 | nback = (nstatv-2)/6 ! Calculate number of backstresses 26 | nvar = nstatv + 6 ! Calculate number of variables in local problem 27 | 28 | error = .false. 29 | ! Check allowed number of backstresses 30 | if (.not.any(nback==nback_allowed)) then 31 | error = .true. 32 | endif 33 | 34 | ! Check correct number of material parameters 35 | if (nprops.ne.(6 + 3*nback)) then 36 | error = .true. 37 | endif 38 | 39 | ! Check correct number of state variables 40 | if (nstatv.ne.(2 + 6*nback)) then 41 | error = .true. 42 | endif 43 | 44 | ! Quit analysis if invalid input 45 | if (error) then 46 | write(*,*) 'Invalid input to the Ohno-Wang model (umat), it should be' 47 | write(*,*) 'nprops = 6+3*nback and' 48 | write(*,*) 'nstatv = 2+6*nback, but' 49 | write(*,"(A)", advance="no") 'nstatv = ' 50 | write(*,*) nstatv 51 | write(*,"(A)", advance="no") 'nprops = ' 52 | write(*,*) nprops 53 | write(*,"(A)", advance="no") 'nback = ' 54 | write(*,*) nback 55 | stop 56 | endif 57 | 58 | ! Put material parameters at consistent location to allow using the same AceGen code for multiple models: 59 | 60 | allocate(mpar(6+3*nback)) 61 | mpar = props 62 | mpar(1) = props(1)/(2*(1+props(2))) ! Convert from E and v to G = E/(2*(1+v)) 63 | mpar(2) = props(1)/(3*(1-2*props(2))) ! Convert from E and v to K = E/(3*(1-2v)) 64 | 65 | 66 | end subroutine checkinput 67 | 68 | end module 69 | -------------------------------------------------------------------------------- /models/GenSmallStrain/src/ohnowang_rdep.f90: -------------------------------------------------------------------------------- 1 | ! Material parameter definition for the Delobelle model, nprops = 6+2*nback 2 | ! Input: props = E, v, Y0, Hiso, invYiso, delta, Hk1, invYk1, mk1, Hk2, ... 3 | ! Internal: mpar = G, K, Y0, Hiso, invYiso, delta, Hk1, invYk1, mk1, Hk2, ... (same as props) 4 | 5 | module model_module 6 | use acegen_mod 7 | implicit none 8 | 9 | integer, parameter, dimension(4):: nback_allowed = (/1,2,3,4/) 10 | integer, parameter :: nvar_add = -1 !Addition of variables relative rate independent model 11 | integer :: nback !Number of backstresses 12 | integer :: nvar !Number of variables in local problem 13 | 14 | contains 15 | 16 | !Check that the input to the UMAT is correct (must be called first to assign nback) 17 | subroutine checkinput(nprops, nstatv, props, mpar) 18 | implicit none 19 | integer, intent(in) :: nprops, nstatv 20 | double precision, intent(in) :: props(:) ! Material properties input to umat 21 | double precision, allocatable :: mpar(:) ! Internally used material properties, to be consistent for different models 22 | logical :: error 23 | integer :: k1 24 | 25 | nback = (nstatv-1)/6 ! Calculate number of backstresses 26 | nvar = nstatv + 6 ! Calculate number of variables in local problem 27 | 28 | error = .false. 29 | ! Check allowed number of backstresses 30 | if (.not.any(nback==nback_allowed)) then 31 | error = .true. 32 | endif 33 | 34 | ! Check correct number of material parameters 35 | if (nprops.ne.(8 + 3*nback)) then 36 | error = .true. 37 | endif 38 | 39 | ! Check correct number of state variables 40 | if (nstatv.ne.(1 + 6*nback)) then 41 | error = .true. 42 | endif 43 | 44 | ! Quit analysis if invalid input 45 | if (error) then 46 | write(*,*) 'Invalid input to the Ohno-Wang model (umat), it should be' 47 | write(*,*) 'nprops = 8+3*nback and' 48 | write(*,*) 'nstatv = 1+6*nback, but' 49 | write(*,"(A)", advance="no") 'nstatv = ' 50 | write(*,*) nstatv 51 | write(*,"(A)", advance="no") 'nprops = ' 52 | write(*,*) nprops 53 | write(*,"(A)", advance="no") 'nback = ' 54 | write(*,*) nback 55 | stop 56 | endif 57 | 58 | ! Put material parameters at consistent location to allow using the same AceGen code for multiple models: 59 | 60 | allocate(mpar(6+3*nback)) 61 | mpar = props 62 | mpar(1) = props(1)/(2*(1+props(2))) ! Convert from E and v to G = E/(2*(1+v)) 63 | mpar(2) = props(1)/(3*(1-2*props(2))) ! Convert from E and v to K = E/(3*(1-2v)) 64 | 65 | 66 | end subroutine checkinput 67 | 68 | end module 69 | -------------------------------------------------------------------------------- /models/MM2021/acegen_rmodel/combine_files.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | from pathlib import Path 4 | import os 5 | 6 | 7 | def main(argv): 8 | print(os.getcwd()) 9 | module_name = "acegen_mod" 10 | subroutine_names = ("model_size", "elastic", "residual", "jacobian", "plastic_output") 11 | if len(argv) > 1: 12 | name = argv[1] 13 | else: 14 | name = "tmp" 15 | 16 | with open(name + ".f90", "w") as fid: 17 | write_header(fid, module_name) 18 | for name in subroutine_names: 19 | sub = fix_subroutine(name) 20 | fid.write(sub) 21 | fid.write("\n" + "end module " + module_name) 22 | 23 | 24 | def fix_subroutine(name): 25 | subroutine = Path(name+'.f90').read_text() 26 | subroutine = re.sub("SUBROUTINE " + name + "\(v,", "SUBROUTINE " + name + "(", subroutine) 27 | subroutine = re.sub("END$", "END SUBROUTINE", subroutine) 28 | 29 | return subroutine 30 | 31 | 32 | def write_header(fid, module_name): 33 | with open('tmpinfo.txt') as inp_fid: 34 | for line in inp_fid: 35 | fid.write('!' + line) 36 | 37 | fid.write("\n" + "module " + module_name + "\n") 38 | fid.write("implicit none" + "\n") 39 | fid.write("contains" + "\n") 40 | 41 | 42 | if __name__ == '__main__': 43 | main(sys.argv) 44 | -------------------------------------------------------------------------------- /models/MM2021/acegen_rmodel/model_size.f90: -------------------------------------------------------------------------------- 1 | 2 | subroutine model_size(nparam,nstatv,nvar) 3 | implicit none 4 | integer nparam, nstatv, nvar 5 | nparam = 16 6 | nstatv = 58 7 | nvar = 16 8 | end subroutine model_size 9 | -------------------------------------------------------------------------------- /models/MM2021/acegen_rmodel/tmpinfo.txt: -------------------------------------------------------------------------------- 1 | AceGenModule rmodel_ISO2_BC2 2 | nstatv: 58 3 | ElasticType: NeoHookean 4 | IsoHardType: TwoIsoHard 5 | KinHardType: BC_hat 6 | DistHardType: rmodel 7 | 8 | Material parameters (16): 9 | G (Shear modulus) 10 | K (Bulk modulus) 11 | Y0 (Initial yield limit) 12 | k1 (Isotropic hardening constant 1) 13 | Rinf1 (Isotropic saturation 1) 14 | k2 (Isotropic hardening constant 2) 15 | Rinf2 (Isotropic saturation 2) 16 | delta (amount of AF vs BC) 17 | Hkin1 18 | Binf1 19 | Hkin2 20 | Binf2 21 | cL (Evolution parameter for CL) 22 | bL (Amount of latent hardening) 23 | Hr (hardening modulus for r) 24 | rinf (saturation value of r) 25 | -------------------------------------------------------------------------------- /models/MM2021/acegen_symyld/combine_files.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | from pathlib import Path 4 | import os 5 | 6 | 7 | def main(argv): 8 | print(os.getcwd()) 9 | module_name = "acegen_mod" 10 | subroutine_names = ("model_size", "elastic", "residual", "jacobian", "plastic_output") 11 | if len(argv) > 1: 12 | name = argv[1] 13 | else: 14 | name = "tmp" 15 | 16 | with open(name + ".f90", "w") as fid: 17 | write_header(fid, module_name) 18 | for name in subroutine_names: 19 | sub = fix_subroutine(name) 20 | fid.write(sub) 21 | fid.write("\n" + "end module " + module_name) 22 | 23 | 24 | def fix_subroutine(name): 25 | subroutine = Path(name+'.f90').read_text() 26 | subroutine = re.sub("SUBROUTINE " + name + "\(v,", "SUBROUTINE " + name + "(", subroutine) 27 | subroutine = re.sub("END$", "END SUBROUTINE", subroutine) 28 | 29 | return subroutine 30 | 31 | 32 | def write_header(fid, module_name): 33 | with open('tmpinfo.txt') as inp_fid: 34 | for line in inp_fid: 35 | fid.write('!' + line) 36 | 37 | fid.write("\n" + "module " + module_name + "\n") 38 | fid.write("implicit none" + "\n") 39 | fid.write("contains" + "\n") 40 | 41 | 42 | if __name__ == '__main__': 43 | main(sys.argv) 44 | -------------------------------------------------------------------------------- /models/MM2021/acegen_symyld/model_size.f90: -------------------------------------------------------------------------------- 1 | 2 | subroutine model_size(nparam,nstatv,nvar) 3 | implicit none 4 | integer nparam, nstatv, nvar 5 | nparam = 14 6 | nstatv = 49 7 | nvar = 11 8 | end subroutine model_size 9 | -------------------------------------------------------------------------------- /models/MM2021/acegen_symyld/tmpinfo.txt: -------------------------------------------------------------------------------- 1 | AceGenModule disthard_ISO2_BC2 2 | nstatv: 49 3 | ElasticType: NeoHookean 4 | IsoHardType: TwoIsoHard 5 | KinHardType: BC_hat 6 | DistHardType: CSquare 7 | 8 | Material parameters (14): 9 | G (Shear modulus) 10 | K (Bulk modulus) 11 | Y0 (Initial yield limit) 12 | k1 (Isotropic hardening constant 1) 13 | Rinf1 (Isotropic saturation 1) 14 | k2 (Isotropic hardening constant 2) 15 | Rinf2 (Isotropic saturation 2) 16 | delta (amount of AF vs BC) 17 | Hkin1 18 | Binf1 19 | Hkin2 20 | Binf2 21 | cc (Evolution parameter for Cc) 22 | bc (Amount of cross hardening) 23 | -------------------------------------------------------------------------------- /models/MM2021/doc/readme.md: -------------------------------------------------------------------------------- 1 | In Meyer and Menzel (2021), two model variations were presented. More details are found in their respective document: 2 | 3 | * ``H_r=0``: [symyld](symyld.md) 4 | * `H_r\neq 0`: [rmodel](rmodel.md) -------------------------------------------------------------------------------- /models/MM2021/doc/rmodel.md: -------------------------------------------------------------------------------- 1 | # rmodel_ISO2_BC2 2 | 3 | This model is generated in ``acegen_rmodel``. It can have 2 back-stresses and is rate-independent. The kinematic hardening is of Delobelle type (Combined AF and BC). For a detailed description of the model formulation, please see the paper in ref.bib, where this model is denoted by `H_r\neq 0` 4 | 5 | # parameters 6 | 7 | 1. G (Shear modulus) 8 | 2. K (Bulk modulus) 9 | 3. Y0 (Initial yield limit) 10 | 4. k1 (Isotropic hardening constant 1) 11 | 5. Rinf1 (Isotropic saturation stress 1) 12 | 6. k2 (Isotropic hardening constant 2) 13 | 7. Rinf2 (Isotropic saturation stress 2) 14 | 8. delta (Amount of AF vs BC) 15 | 9. Hkin1 (Kinematic hardening modulus nr. 1) 16 | 10. Binf1 (Kinematic saturation stress nr 1) 17 | 11. Hkin2 (Kinematic hardening modulus nr. 2) 18 | 12. Binf2 (Kinematic saturation stress nr 2) 19 | 13. cc (Evolution parameter for C_c) 20 | 14. bc (Amount of cross hardening) 21 | 15. Hr (hardening modulus for r) 22 | 16. rinf (saturation value of r) 23 | 24 | 25 | # state variables 26 | 27 | 1-9) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 28 | 29 | 10) lambda (Accumulated plastic deformation (time integral of plastic multiplier)) 30 | 31 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 32 | 33 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 34 | 35 | 29-49) Cc-I4symdev (4th order cross hardening tensor. It is major and minor symmetric, and thus only 21 components are stored. This converted by a custom ordering, see V21toV9x9FULLSYM in [umat_utils](../../umat_utils/AceGenUtils/MathematicaTensorsToolbox.nb) (Isymdev is the symmetric fourth order identity tensor, minus I2 otimes I2 / 3 to remove the deviatoric part) 36 | 37 | 50-58) Fr-I2 (r deformation gradient minus 2nd order identity) 38 | -------------------------------------------------------------------------------- /models/MM2021/doc/symyld.md: -------------------------------------------------------------------------------- 1 | # disthard_ISO2_BC2 2 | This model is generated in ``acegen_symyld``. It can have 2 back-stresses and is rate-independent. The kinematic hardening is of Delobelle type (Combined AF and BC). For a detailed description of the model formulation, please see the paper in ref.bib, where this model is denoted by `H_r=0` 3 | 4 | # parameters 5 | 6 | 1. G (Shear modulus) 7 | 2. K (Bulk modulus) 8 | 3. Y0 (Initial yield limit) 9 | 4. k1 (Isotropic hardening constant 1) 10 | 5. Rinf1 (Isotropic saturation stress 1) 11 | 6. k2 (Isotropic hardening constant 2) 12 | 7. Rinf2 (Isotropic saturation stress 2) 13 | 8. delta (Amount of AF vs BC) 14 | 9. Hkin1 (Kinematic hardening modulus nr. 1) 15 | 10. Binf1 (Kinematic saturation stress nr 1) 16 | 11. Hkin2 (Kinematic hardening modulus nr. 2) 17 | 12. Binf2 (Kinematic saturation stress nr 2) 18 | 13. cc (Evolution parameter for C_c) 19 | 14. bc (Amount of cross hardening) 20 | 21 | 22 | # state variables 23 | 1-9) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 24 | 25 | 10) lambda (Accumulated plastic deformation (time integral of plastic multiplier)) 26 | 27 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 28 | 29 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 30 | 31 | 29-49) Cc-I4symdev (4th order cross hardening tensor. It is major and minor symmetric, and thus only 21 components are stored. This converted by a custom ordering, see V21toV9x9FULLSYM in [umat_utils](../../umat_utils/AceGenUtils/MathematicaTensorsToolbox.nb) (Isymdev is the symmetric fourth order identity tensor, minus I2 otimes I2 / 3 to remove the deviatoric part) 32 | -------------------------------------------------------------------------------- /models/MM2021/ref.bib: -------------------------------------------------------------------------------- 1 | @article{Meyer2021, 2 | author = {Meyer, Knut Andreas and Menzel, Andreas}, 3 | doi = {10.1016/j.ijsolstr.2021.111055}, 4 | issn = {00207683}, 5 | journal = {International Journal of Solids and Structures}, 6 | pages = {111055}, 7 | title = {{A distortional hardening model for finite plasticity}}, 8 | volume = {232}, 9 | year = {2021} 10 | } 11 | -------------------------------------------------------------------------------- /models/MM2021/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Setup with Windows (example): 2 | # Or if need of another generator e.g.: 3 | # Build from command line: 4 | cmake_minimum_required (VERSION 3.0) 5 | 6 | if (NOT CMAKE_BUILD_TYPE) 7 | set(CMAKE_BUILD_TYPE Release CACHE STRING 8 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) 9 | endif() 10 | 11 | set(model disthard_ISO2_BC2 CACHE STRING "Which base model to build") 12 | set_property(CACHE model PROPERTY STRINGS 13 | rmodel_ISO2_BC2 14 | disthard_ISO2_BC2) 15 | 16 | if (NOT umat_utils_path) 17 | set(umat_utils_path "${CMAKE_CURRENT_SOURCE_DIR}/../../umat_utils" CACHE STRING "Folder containing umat utility routines") 18 | endif() 19 | 20 | project(disthard) 21 | enable_language (Fortran) 22 | 23 | # Get system information 24 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 25 | set(A64 TRUE) # 64 bit compilation system - needs to be same as for mpsim 26 | else() 27 | set(A64 FALSE) # 32 bit compilation system - needs to be same as for mpsim 28 | endif() 29 | get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) 30 | if (Fortran_COMPILER_NAME MATCHES "gfortran.*") 31 | set(GFORT TRUE) 32 | set(IFORT FALSE) 33 | if (A64) 34 | add_compile_options(-m64 -ffree-line-length-none -ffree-form) 35 | else () 36 | add_compile_options(-ffree-line-length-none -ffree-form) 37 | endif() 38 | elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") 39 | set(GFORT FALSE) 40 | set(IFORT TRUE) 41 | # add_compile_options("$<$:/warn>") 42 | # add_compile_options("$<$:/check>") 43 | endif() 44 | 45 | 46 | # Add files 47 | add_library(disthard SHARED "umat.f90") 48 | target_sources(disthard PRIVATE 49 | "${umat_utils_path}/smsutility.f90" 50 | "${umat_utils_path}/SolveMatrixEquation.f90" 51 | "${model}.f90" 52 | "umat_module.f90" 53 | ) 54 | 55 | set_target_properties(disthard PROPERTIES PREFIX "") 56 | set_target_properties(disthard PROPERTIES OUTPUT_NAME "${model}") 57 | 58 | # Link to MKL library 59 | if (MSVC) #If Microsoft Visual compiler 60 | if (A64) 61 | target_link_libraries(disthard PRIVATE "mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib") 62 | else() 63 | target_link_libraries(disthard PRIVATE "mkl_intel_c.lib mkl_sequential.lib mkl_core.lib") 64 | endif() 65 | elseif (A64) 66 | if (UNIX AND NOT APPLE) # I.e. linux 67 | set (MKLROOT $ENV{MKLROOT} CACHE STRING "Please specify your MKLROOT path") 68 | target_include_directories(disthard PRIVATE "${MKLROOT}/include") 69 | if (GFORT) 70 | target_link_libraries(disthard PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 71 | elseif (IFORT) 72 | target_link_libraries(disthard PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 73 | endif () 74 | endif() 75 | else() 76 | message("System configuration not supported") 77 | endif() 78 | -------------------------------------------------------------------------------- /models/MM2021/src/abaqus_compile_files.txt: -------------------------------------------------------------------------------- 1 | disthard_ISO2_BC2,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","disthard_ISO2_BC2.f90","umat_module.f90","umat.f90" 2 | rmodel_ISO2_BC2,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","rmodel_ISO2_BC2.f90","umat_module.f90","umat.f90" -------------------------------------------------------------------------------- /models/MM2021/src/umat.f90: -------------------------------------------------------------------------------- 1 | !DEC$ FREEFORM 2 | ! See acegen generated code for definitions of material parameters and state variables 3 | ! ====== Start of constant umat header (Knut Andreas) ======== 4 | ! Variables that always should be updated 5 | ! stress [1 x ntens] stress tensor at beginning of increment, to be updated 6 | ! statev [1 x nstatv] Array of solution dependent state variables, to be updated (and rotated using drot) 7 | ! ddsdde [ntens x ntens] The jacobian dsigma/epsilon. 8 | ! sse [1] Specific elastic strain energy 9 | ! spd [1] Specific plastic dissipation 10 | ! scd [1] Specific creep dissipation 11 | ! 12 | ! Variables that should only be updated in fully coupled thermal-stress analysis 13 | ! rpl [1] Volumetric heat generation per unit time at the end of increment (see guide if geostatic pores) 14 | ! ddsddt [1 x ntens] Variation of the stress increments with respect to temperature 15 | ! drplde [1 x ntens] Variation of rpl with respect to the strain increments 16 | ! drpldt [1] Variation of rpl with respect to temperature 17 | ! 18 | ! Variables passed for information (DO NOT CHANGE) 19 | ! stran [1 x ntens] Strains at the beginning of the increment. Strain components rotated to account for RBM before UMAT call 20 | ! dstran [1 x ntens] Strain increments 21 | ! time [1 x 2] Value of [step time, total time] at the beginning of the current increment 22 | ! dtime [1] Time increment 23 | ! temp [1] Temperature at the start of the increment 24 | ! dtemp [1] Increment of temperature 25 | ! predef [1 x ?] Array of interpolated values of predefined field variables at this point at the start of the increment 26 | ! dpred [1 x ?] Array of increments of predefined field variables 27 | ! cmname [string] User-defined material name, left justified. 28 | ! ndi [int] Number of direct stress components at this point 29 | ! nshr [int] Number of engineering shear stress components at this point 30 | ! ntens [int] Size of the stress or strain component array (ndi + nshr) 31 | ! nstatv [int] Number of solution-dependent state variables that are associated with this material type 32 | ! props [1 x nprops] User-specified array of material constants associated with this user material 33 | ! nprops [int] User-defined number of material constants associated with this user material 34 | ! coords [1 x 3] An array containing the coordinates of this point. 35 | ! drot [3 x 3] Rotation increment matrix 36 | ! pnewdt [1] CAN BE CHANGED: Ratio of suggested new time increment to the time increment being used 37 | ! celent [1] Characteristic element length 38 | ! dfgrd0 [3,3] Deformation gradient at the beginning of the increment 39 | ! dfgrd1 [3,3] Deformation gradient at the end of the increment 40 | ! noel [int] Element number 41 | ! npt [int] Integration point number 42 | ! layer [int] Layer number (for composite shells and layered solids) 43 | ! kspt [int] Section point number within the current layer 44 | ! kstep [int] Step number 45 | ! kinc [int] Increment number 46 | ! 47 | 48 | ! To compile for abaqus, remove comments on smsutility, umat_module. 49 | ! Also comment out "!DEC$ ATTRIBUTES DLLEXPORT :: UMAT" by adding another exclamation mark in front. 50 | 51 | !include '../../umat_utils/smsutility.f90' ! Required for AceGen code 52 | !include 'Shi2014_1.f90' ! Particular model functions generated by AceGen 53 | !include '../../umat_utils/SolveMatrixEquation.f90' ! Solving of nonlinear matrix equation system 54 | !include 'umat_module.f90' ! Support function for this umat 55 | 56 | SUBROUTINE umat(stress,statev,ddsdde,sse,spd,scd, & 57 | rpl,ddsddt,drplde,drpldt,& 58 | stran,dstran,time,dtime,temp,dtemp,predef,dpred,cmname,& 59 | ndi,nshr,ntens,nstatv,props,nprops,coords,drot,pnewdt,& 60 | celent,dfgrd0,dfgrd1,noel,npt,layer,kspt,kstep,kinc) 61 | !DEC$ ATTRIBUTES DLLEXPORT :: UMAT 62 | use SolveMatrixEquation 63 | use umat_module 64 | use acegen_mod 65 | 66 | implicit none 67 | ! 68 | character*80 cmname 69 | integer:: ndi,nshr,ntens,nstatv,nprops,noel,npt,& 70 | layer, kspt, kstep, kinc 71 | double precision:: dtime,temp,dtemp,pnewdt,celent,sse,spd,scd,rpl,drpldt 72 | double precision:: stress(ntens),statev(nstatv),& 73 | ddsdde(ntens,ntens),ddsddt(ntens),drplde(ntens),& 74 | stran(ntens),dstran(ntens),time(2),predef(1),dpred(1),& 75 | props(nprops),coords(3),drot(3,3),dfgrd0(3,3),dfgrd1(3,3) 76 | ! 77 | ! 78 | ! ====== End of constant umat header excl. includes (Knut Andreas) ======== 79 | double precision :: Fnew(9) 80 | double precision, allocatable :: jac_inv(:,:), r0(:), x0(:), param(:), statevNew(:) 81 | integer :: k1, info, max_iter 82 | logical :: lconv, use_el_stiff 83 | double precision :: newton_tolerance, yielding 84 | double precision :: stressi(6), ddsddei(6,6) ! Internal stress and stiffness (always full) 85 | 86 | ! Iteration settings 87 | newton_tolerance = 1.d-8 88 | max_iter = 20 89 | 90 | ! Check input 91 | call checkinput(nprops, nstatv) ! Assigns nvar and nslip 92 | allocate(jac_inv(nvar, nvar)) 93 | allocate(r0(nvar), statevNew(nstatv), x0(nvar)) 94 | 95 | ! Check elastic response 96 | Fnew = m3x3_2_v9(dfgrd1) 97 | call elastic(props,statev,Fnew,stressi,ddsddei,yielding,x0) 98 | 99 | if (yielding>0) then ! Solve for plasticity 100 | 101 | !Set parameters for "Solve Matrix Equation" 102 | call sme_setparam(itertol=newton_tolerance, maxiter=max_iter) 103 | 104 | !Solve local problem using newton raphson iterations and analytical jacobian 105 | call newton_raphson_ana(residualfun, anajac, x0, jac_inv, lconv, info, props, statev, param=Fnew, printres=0) 106 | 107 | !call newton_raphson_num(residualfun, x0, jac_inv, lconv, info, props, statev, param=Fnew, printres=2) 108 | 109 | !Calculate ddsdde, statev and stress from solution of local problem 110 | call plastic_output(x0,props,statev,Fnew,jac_inv,stressi,ddsddei,statevNew,spd) 111 | 112 | statev=statevNew 113 | 114 | !Check that solution converged 115 | call check_analysis(lconv,pnewdt) 116 | 117 | 118 | endif 119 | 120 | stress = stressi(1:ntens) 121 | ddsdde = ddsddei(1:ntens, 1:ntens) 122 | 123 | END SUBROUTINE -------------------------------------------------------------------------------- /models/MM2021/src/umat_module.f90: -------------------------------------------------------------------------------- 1 | module umat_module 2 | use acegen_mod 3 | implicit none 4 | 5 | integer :: nvar ! Number of variables in local problem 6 | 7 | contains 8 | 9 | !Check that the input to the UMAT is correct 10 | subroutine checkinput(nprops, nstatv) 11 | implicit none 12 | integer, intent(in) :: nprops, nstatv 13 | logical :: error 14 | integer :: nstatv_model ! Number of state variables in model 15 | integer :: nprops_model ! Number of material params in model 16 | 17 | call model_size(nprops_model,nstatv_model,nvar) 18 | 19 | error = .false. 20 | if (nprops.ne.nprops_model) then 21 | error = .true. 22 | elseif (nstatv.ne.nstatv_model) then 23 | error = .true. 24 | endif 25 | 26 | ! Quit analysis if invalid input 27 | if (error) then 28 | write(*,*) 'Invalid input to umat subroutine' 29 | write(*,*) 'You specified ', nprops, ' material parameters: ', nprops_model, ' should be given' 30 | write(*,*) 'You specified ', nstatv, ' state variables: ', nstatv_model, ' should be given' 31 | call quit_analysis() 32 | endif 33 | 34 | 35 | end subroutine checkinput 36 | 37 | !Residual function (wrapper for AceGen code) 38 | subroutine residualfun(r, x, props, statev, param) 39 | implicit none 40 | double precision, intent(in) :: x(:) 41 | double precision, intent(in), optional :: props(:), statev(:), param(:) !Residual function parameters 42 | double precision, allocatable, intent(out) :: r(:) 43 | 44 | allocate(r(nvar)) 45 | 46 | call residual(x,props,statev,param,r) 47 | 48 | end subroutine residualfun 49 | 50 | !Jacobian function (wrapper for AceGen code) 51 | subroutine anajac(ajacobian, x, props, statev, param) 52 | implicit none 53 | double precision, intent(in) :: x(:) 54 | double precision, intent(in), optional :: props(:), statev(:), param(:) !parameters 55 | double precision, allocatable, intent(out) :: ajacobian(:,:) 56 | 57 | allocate(ajacobian(nvar,nvar)) 58 | 59 | call jacobian(x,props,statev,param,ajacobian) 60 | 61 | end subroutine anajac 62 | 63 | 64 | ! Check if problem converged 65 | subroutine check_analysis(lconv, pnewdt) 66 | implicit none 67 | logical, intent(in) :: lconv 68 | double precision :: pnewdt 69 | if (.not.lconv) then 70 | !write(*,*) 'Local problem did not converge' 71 | pnewdt = 5.d-1 72 | return 73 | endif 74 | 75 | end subroutine check_analysis 76 | 77 | function m3x3_2_v9(mat) result(v9) 78 | implicit none 79 | double precision :: mat(3,3), v9(9) 80 | 81 | v9 = (/mat(1,1), mat(2,2), mat(3,3), mat(1,2), mat(2,3), mat(3,1), mat(1,3), mat(2,1), mat(3,2)/) 82 | 83 | end function 84 | 85 | !Safely quit analysis in a correct way 86 | subroutine quit_analysis() 87 | implicit none 88 | !call xit() !Quit abaqus analysis in a correct way (Comment out if running outside abaqus) 89 | stop !Use if running outside abaqus 90 | end subroutine quit_analysis 91 | 92 | end module -------------------------------------------------------------------------------- /models/Qin2018/acegen/combine_files.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | from pathlib import Path 4 | import os 5 | 6 | 7 | def main(argv): 8 | print(os.getcwd()) 9 | module_name = "acegen_mod" 10 | subroutine_names = ("model_size", "elastic", "residual", "jacobian", "plastic_output") 11 | if len(argv) > 1: 12 | name = argv[1] 13 | else: 14 | name = "tmp" 15 | 16 | with open(name + ".f90", "w") as fid: 17 | write_header(fid, module_name) 18 | for name in subroutine_names: 19 | sub = fix_subroutine(name) 20 | fid.write(sub) 21 | fid.write("\n" + "end module " + module_name) 22 | 23 | 24 | def fix_subroutine(name): 25 | subroutine = Path(name+'.f90').read_text() 26 | subroutine = re.sub("SUBROUTINE " + name + "\(v,", "SUBROUTINE " + name + "(", subroutine) 27 | subroutine = re.sub("END$", "END SUBROUTINE", subroutine) 28 | 29 | return subroutine 30 | 31 | 32 | def write_header(fid, module_name): 33 | with open('tmpinfo.txt') as inp_fid: 34 | for line in inp_fid: 35 | fid.write('!' + line) 36 | 37 | fid.write("\n" + "module " + module_name + "\n") 38 | fid.write("implicit none" + "\n") 39 | fid.write("contains" + "\n") 40 | 41 | 42 | if __name__ == '__main__': 43 | main(sys.argv) 44 | -------------------------------------------------------------------------------- /models/Qin2018/acegen/model_size.f90: -------------------------------------------------------------------------------- 1 | 2 | subroutine model_size(nparam,nstatv,nvar) 3 | implicit none 4 | integer nparam, nstatv, nvar 5 | nparam = 21 6 | nstatv = 36 7 | nvar = 16 8 | end subroutine model_size 9 | -------------------------------------------------------------------------------- /models/Qin2018/acegen/tmpinfo.txt: -------------------------------------------------------------------------------- 1 | AceGenModule Qin2018_BC2 2 | nstatv: 36 3 | ElasticType: NeoHookean 4 | KinHardType: BC_D07mod 5 | 6 | Material parameters (21): 7 | G (Shear modulus) 8 | K (Bulk modulus) 9 | R0 (Initial yield limit) 10 | DeR1 (Delta epsilon R1) 11 | R1sat (Isotropic saturation) 12 | DeR2 (Delta epsilon R2) 13 | R2sat (Isotropic saturation) 14 | kr 15 | k0 16 | qr 17 | Der (Delta epsilon r) 18 | delta (amount of AF vs BC) 19 | Hkin1 20 | Binf1 21 | Hkin2 22 | Binf2 23 | DeP 24 | alpha 25 | q0 26 | n 27 | De0 28 | -------------------------------------------------------------------------------- /models/Qin2018/doc/Qin2018.md: -------------------------------------------------------------------------------- 1 | # Qin2018_AF 2 | This model can have 2 back-stresses and is rate-independent. It only supports Armstrong-Frederick type of kinematic hardening. For a detailed description of the model formulation, please see the paper in ref.bib 3 | 4 | # parameters 5 | 1. G (Shear modulus) 6 | 2. K (Bulk modulus) 7 | 3. R0 (Initial yield limit) 8 | 4. DeR1 (Isotropic hardening rate 1) 9 | 5. R1sat (Isotropic saturation stress 1) 10 | 6. DeR2 (Isotropic hardening rate 2) 11 | 7. R2sat (Isotropic saturation stress 2) 12 | 8. kr 13 | 9. k0 14 | 10. qr 15 | 11. Der (Delta epsilon r) 16 | 12. Hkin1 (Kinematic hardening modulus nr. 1) 17 | 13. Binf1 (Kinematic saturation stress nr 1) 18 | 14. Hkin2 (Kinematic hardening modulus nr. 2) 19 | 15. Binf2 (Kinematic saturation stress nr 2) 20 | 16. DeP 21 | 17. alpha 22 | 18. q0 23 | 19. n 24 | 20. De0 25 | 26 | 27 | # state variables 28 | 1-9) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 29 | 10) lambda (Accumulated plastic deformation (time integral of plastic multiplier)) 30 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 31 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 32 | 29-33) P (Microstructure tensor (symmetric and deviatoric, hence only 5 components) 33 | 34) S0 34 | 35) Rtr 35 | 36) Sr 36 | -------------------------------------------------------------------------------- /models/Qin2018/ref.bib: -------------------------------------------------------------------------------- 1 | @article{Meyer2020, 2 | author = {Meyer, Knut Andreas}, 3 | doi = {10.1016/j.ijsolstr.2020.04.037}, 4 | journal = {International Journal of Solids and Structures (in press)}, 5 | title = {{Evaluation of material models describing the evolution of plastic anisotropy in pearlitic steel}}, 6 | year = {2020} 7 | } 8 | -------------------------------------------------------------------------------- /models/Qin2018/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Setup with Windows (example): 2 | # Or if need of another generator e.g.: 3 | # Build from command line: 4 | cmake_minimum_required (VERSION 3.0) 5 | 6 | if (NOT CMAKE_BUILD_TYPE) 7 | set(CMAKE_BUILD_TYPE Release CACHE STRING 8 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) 9 | endif() 10 | 11 | set(model Qin2018_AF2 CACHE STRING "Which base model to build") 12 | set_property(CACHE model PROPERTY STRINGS 13 | Qin2018_AF2) 14 | 15 | if (NOT umat_utils_path) 16 | set(umat_utils_path "${CMAKE_CURRENT_SOURCE_DIR}/../../umat_utils" CACHE STRING "Folder containing umat utility routines") 17 | endif() 18 | 19 | project(disthard) 20 | enable_language (Fortran) 21 | 22 | # Get system information 23 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 24 | set(A64 TRUE) # 64 bit compilation system - needs to be same as for mpsim 25 | else() 26 | set(A64 FALSE) # 32 bit compilation system - needs to be same as for mpsim 27 | endif() 28 | get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) 29 | if (Fortran_COMPILER_NAME MATCHES "gfortran.*") 30 | set(GFORT TRUE) 31 | set(IFORT FALSE) 32 | if (A64) 33 | add_compile_options(-m64 -ffree-line-length-none -ffree-form) 34 | else () 35 | add_compile_options(-ffree-line-length-none -ffree-form) 36 | endif() 37 | elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") 38 | set(GFORT FALSE) 39 | set(IFORT TRUE) 40 | # add_compile_options("$<$:/warn>") 41 | # add_compile_options("$<$:/check>") 42 | endif() 43 | 44 | 45 | # Add files 46 | add_library(disthard SHARED "umat.f90") 47 | target_sources(disthard PRIVATE 48 | "${umat_utils_path}/smsutility.f90" 49 | "${umat_utils_path}/SolveMatrixEquation.f90" 50 | "${model}.f90" 51 | "umat_module.f90" 52 | ) 53 | 54 | set_target_properties(disthard PROPERTIES PREFIX "") 55 | set_target_properties(disthard PROPERTIES OUTPUT_NAME "${model}") 56 | 57 | # Link to MKL library 58 | if (MSVC) #If Microsoft Visual compiler 59 | if (A64) 60 | target_link_libraries(disthard PRIVATE "mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib") 61 | else() 62 | target_link_libraries(disthard PRIVATE "mkl_intel_c.lib mkl_sequential.lib mkl_core.lib") 63 | endif() 64 | elseif (A64) 65 | if (UNIX AND NOT APPLE) # I.e. linux 66 | set (MKLROOT $ENV{MKLROOT} CACHE STRING "Please specify your MKLROOT path") 67 | target_include_directories(disthard PRIVATE "${MKLROOT}/include") 68 | if (GFORT) 69 | target_link_libraries(disthard PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 70 | elseif (IFORT) 71 | target_link_libraries(disthard PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 72 | endif () 73 | endif() 74 | else() 75 | message("System configuration not supported") 76 | endif() 77 | -------------------------------------------------------------------------------- /models/Qin2018/src/abaqus_compile_files.txt: -------------------------------------------------------------------------------- 1 | Qin2018_AF2,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","Qin2018_AF2.f90","umat_module.f90","umat.f90" 2 | Qin2018_BC2,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","Qin2018_BC2.f90","umat_module.f90","umat.f90" -------------------------------------------------------------------------------- /models/Qin2018/src/umat.f90: -------------------------------------------------------------------------------- 1 | !DEC$ FREEFORM 2 | ! See acegen generated code for definitions of material parameters and state variables 3 | ! ====== Start of constant umat header (Knut Andreas) ======== 4 | ! Variables that always should be updated 5 | ! stress [1 x ntens] stress tensor at beginning of increment, to be updated 6 | ! statev [1 x nstatv] Array of solution dependent state variables, to be updated (and rotated using drot) 7 | ! ddsdde [ntens x ntens] The jacobian dsigma/epsilon. 8 | ! sse [1] Specific elastic strain energy 9 | ! spd [1] Specific plastic dissipation 10 | ! scd [1] Specific creep dissipation 11 | ! 12 | ! Variables that should only be updated in fully coupled thermal-stress analysis 13 | ! rpl [1] Volumetric heat generation per unit time at the end of increment (see guide if geostatic pores) 14 | ! ddsddt [1 x ntens] Variation of the stress increments with respect to temperature 15 | ! drplde [1 x ntens] Variation of rpl with respect to the strain increments 16 | ! drpldt [1] Variation of rpl with respect to temperature 17 | ! 18 | ! Variables passed for information (DO NOT CHANGE) 19 | ! stran [1 x ntens] Strains at the beginning of the increment. Strain components rotated to account for RBM before UMAT call 20 | ! dstran [1 x ntens] Strain increments 21 | ! time [1 x 2] Value of [step time, total time] at the beginning of the current increment 22 | ! dtime [1] Time increment 23 | ! temp [1] Temperature at the start of the increment 24 | ! dtemp [1] Increment of temperature 25 | ! predef [1 x ?] Array of interpolated values of predefined field variables at this point at the start of the increment 26 | ! dpred [1 x ?] Array of increments of predefined field variables 27 | ! cmname [string] User-defined material name, left justified. 28 | ! ndi [int] Number of direct stress components at this point 29 | ! nshr [int] Number of engineering shear stress components at this point 30 | ! ntens [int] Size of the stress or strain component array (ndi + nshr) 31 | ! nstatv [int] Number of solution-dependent state variables that are associated with this material type 32 | ! props [1 x nprops] User-specified array of material constants associated with this user material 33 | ! nprops [int] User-defined number of material constants associated with this user material 34 | ! coords [1 x 3] An array containing the coordinates of this point. 35 | ! drot [3 x 3] Rotation increment matrix 36 | ! pnewdt [1] CAN BE CHANGED: Ratio of suggested new time increment to the time increment being used 37 | ! celent [1] Characteristic element length 38 | ! dfgrd0 [3,3] Deformation gradient at the beginning of the increment 39 | ! dfgrd1 [3,3] Deformation gradient at the end of the increment 40 | ! noel [int] Element number 41 | ! npt [int] Integration point number 42 | ! layer [int] Layer number (for composite shells and layered solids) 43 | ! kspt [int] Section point number within the current layer 44 | ! kstep [int] Step number 45 | ! kinc [int] Increment number 46 | ! 47 | 48 | ! To compile for abaqus, remove comments on smsutility, umat_module. 49 | ! Also comment out "!DEC$ ATTRIBUTES DLLEXPORT :: UMAT" by adding another exclamation mark in front. 50 | 51 | !include '../../umat_utils/smsutility.f90' ! Required for AceGen code 52 | !include 'Shi2014_1.f90' ! Particular model functions generated by AceGen 53 | !include '../../umat_utils/SolveMatrixEquation.f90' ! Solving of nonlinear matrix equation system 54 | !include 'umat_module.f90' ! Support function for this umat 55 | 56 | SUBROUTINE umat(stress,statev,ddsdde,sse,spd,scd, & 57 | rpl,ddsddt,drplde,drpldt,& 58 | stran,dstran,time,dtime,temp,dtemp,predef,dpred,cmname,& 59 | ndi,nshr,ntens,nstatv,props,nprops,coords,drot,pnewdt,& 60 | celent,dfgrd0,dfgrd1,noel,npt,layer,kspt,kstep,kinc) 61 | !DEC$ ATTRIBUTES DLLEXPORT :: UMAT 62 | use SolveMatrixEquation 63 | use umat_module 64 | use acegen_mod 65 | 66 | implicit none 67 | ! 68 | character*80 cmname 69 | integer:: ndi,nshr,ntens,nstatv,nprops,noel,npt,& 70 | layer, kspt, kstep, kinc 71 | double precision:: dtime,temp,dtemp,pnewdt,celent,sse,spd,scd,rpl,drpldt 72 | double precision:: stress(ntens),statev(nstatv),& 73 | ddsdde(ntens,ntens),ddsddt(ntens),drplde(ntens),& 74 | stran(ntens),dstran(ntens),time(2),predef(1),dpred(1),& 75 | props(nprops),coords(3),drot(3,3),dfgrd0(3,3),dfgrd1(3,3) 76 | ! 77 | ! 78 | ! ====== End of constant umat header excl. includes (Knut Andreas) ======== 79 | double precision :: Fnew(9) 80 | double precision, allocatable :: jac_inv(:,:), r0(:), x0(:), param(:), statevNew(:) 81 | integer :: k1, info, max_iter 82 | logical :: lconv, use_el_stiff 83 | double precision :: newton_tolerance, yielding 84 | double precision :: stressi(6), ddsddei(6,6) ! Internal stress and stiffness (always full) 85 | 86 | ! Iteration settings 87 | newton_tolerance = 1.d-8 88 | max_iter = 20 89 | 90 | ! Check input 91 | call checkinput(nprops, nstatv) ! Assigns nvar and nslip 92 | allocate(jac_inv(nvar, nvar)) 93 | allocate(r0(nvar), statevNew(nstatv), x0(nvar)) 94 | 95 | ! Check elastic response 96 | Fnew = m3x3_2_v9(dfgrd1) 97 | call elastic(props,statev,Fnew,stressi,ddsddei,yielding,x0) 98 | 99 | if (yielding>0) then ! Solve for plasticity 100 | 101 | !Set parameters for "Solve Matrix Equation" 102 | call sme_setparam(itertol=newton_tolerance, maxiter=max_iter) 103 | 104 | !Solve local problem using newton raphson iterations and analytical jacobian 105 | call newton_raphson_ana(residualfun, anajac, x0, jac_inv, lconv, info, props, statev, param=Fnew, printres=0) 106 | 107 | !call newton_raphson_num(residualfun, x0, jac_inv, lconv, info, props, statev, param=Fnew, printres=3) 108 | 109 | !Calculate ddsdde, statev and stress from solution of local problem 110 | call plastic_output(x0,props,statev,Fnew,jac_inv,stressi,ddsddei,statevNew) 111 | 112 | statev=statevNew 113 | 114 | !Check that solution converged 115 | call check_analysis(lconv,pnewdt) 116 | 117 | 118 | endif 119 | 120 | stress = stressi(1:ntens) 121 | ddsdde = ddsddei(1:ntens, 1:ntens) 122 | 123 | END SUBROUTINE -------------------------------------------------------------------------------- /models/Qin2018/src/umat_module.f90: -------------------------------------------------------------------------------- 1 | module umat_module 2 | use acegen_mod 3 | implicit none 4 | 5 | integer :: nvar ! Number of variables in local problem 6 | 7 | contains 8 | 9 | !Check that the input to the UMAT is correct 10 | subroutine checkinput(nprops, nstatv) 11 | implicit none 12 | integer, intent(in) :: nprops, nstatv 13 | logical :: error 14 | integer :: nstatv_model ! Number of state variables in model 15 | integer :: nprops_model ! Number of material params in model 16 | 17 | call model_size(nprops_model,nstatv_model,nvar) 18 | 19 | error = .false. 20 | if (nprops.ne.nprops_model) then 21 | error = .true. 22 | elseif (nstatv.ne.nstatv_model) then 23 | error = .true. 24 | endif 25 | 26 | ! Quit analysis if invalid input 27 | if (error) then 28 | write(*,*) 'Invalid input to umat subroutine' 29 | write(*,*) 'You specified ', nprops, ' material parameters: ', nprops_model, ' should be given' 30 | write(*,*) 'You specified ', nstatv, ' state variables: ', nstatv_model, ' should be given' 31 | call quit_analysis() 32 | endif 33 | 34 | 35 | end subroutine checkinput 36 | 37 | !Residual function (wrapper for AceGen code) 38 | subroutine residualfun(r, x, props, statev, param) 39 | implicit none 40 | double precision, intent(in) :: x(:) 41 | double precision, intent(in), optional :: props(:), statev(:), param(:) !Residual function parameters 42 | double precision, allocatable, intent(out) :: r(:) 43 | 44 | allocate(r(nvar)) 45 | 46 | call residual(x,props,statev,param,r) 47 | 48 | end subroutine residualfun 49 | 50 | !Jacobian function (wrapper for AceGen code) 51 | subroutine anajac(ajacobian, x, props, statev, param) 52 | implicit none 53 | double precision, intent(in) :: x(:) 54 | double precision, intent(in), optional :: props(:), statev(:), param(:) !parameters 55 | double precision, allocatable, intent(out) :: ajacobian(:,:) 56 | 57 | allocate(ajacobian(nvar,nvar)) 58 | 59 | call jacobian(x,props,statev,param,ajacobian) 60 | 61 | end subroutine anajac 62 | 63 | 64 | ! Check if problem converged 65 | subroutine check_analysis(lconv, pnewdt) 66 | implicit none 67 | logical, intent(in) :: lconv 68 | double precision :: pnewdt 69 | if (.not.lconv) then 70 | write(*,*) 'Local problem did not converge' 71 | pnewdt = 5.d-1 72 | return 73 | endif 74 | 75 | end subroutine check_analysis 76 | 77 | function m3x3_2_v9(mat) result(v9) 78 | implicit none 79 | double precision :: mat(3,3), v9(9) 80 | 81 | v9 = (/mat(1,1), mat(2,2), mat(3,3), mat(1,2), mat(2,3), mat(3,1), mat(1,3), mat(2,1), mat(3,2)/) 82 | 83 | end function 84 | 85 | !Safely quit analysis in a correct way 86 | subroutine quit_analysis() 87 | implicit none 88 | !call xit() !Quit abaqus analysis in a correct way (Comment out if running outside abaqus) 89 | stop !Use if running outside abaqus 90 | end subroutine quit_analysis 91 | 92 | end module -------------------------------------------------------------------------------- /models/Shi2014/acegen/combine_files.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import re 3 | from pathlib import Path 4 | import os 5 | 6 | 7 | def main(argv): 8 | print(os.getcwd()) 9 | module_name = "acegen_mod" 10 | subroutine_names = ("model_size", "elastic", "residual", "jacobian", "plastic_output") 11 | if len(argv) > 1: 12 | name = argv[1] 13 | else: 14 | name = "tmp" 15 | 16 | with open(name + ".f90", "w") as fid: 17 | write_header(fid, module_name) 18 | for name in subroutine_names: 19 | sub = fix_subroutine(name) 20 | fid.write(sub) 21 | fid.write("\n" + "end module " + module_name) 22 | 23 | 24 | def fix_subroutine(name): 25 | subroutine = Path(name+'.f90').read_text() 26 | subroutine = re.sub("SUBROUTINE " + name + "\(v,", "SUBROUTINE " + name + "(", subroutine) 27 | subroutine = re.sub("END$", "END SUBROUTINE", subroutine) 28 | 29 | return subroutine 30 | 31 | 32 | def write_header(fid, module_name): 33 | with open('tmpinfo.txt') as inp_fid: 34 | for line in inp_fid: 35 | fid.write('!' + line) 36 | 37 | fid.write("\n" + "module " + module_name + "\n") 38 | fid.write("implicit none" + "\n") 39 | fid.write("contains" + "\n") 40 | 41 | 42 | if __name__ == '__main__': 43 | main(sys.argv) 44 | -------------------------------------------------------------------------------- /models/Shi2014/acegen/model_size.f90: -------------------------------------------------------------------------------- 1 | 2 | subroutine model_size(nparam,nstatv,nvar) 3 | implicit none 4 | integer nparam, nstatv, nvar 5 | nparam = 14 6 | nstatv = 70 7 | nvar = 11 8 | end subroutine model_size 9 | -------------------------------------------------------------------------------- /models/Shi2014/acegen/tmpinfo.txt: -------------------------------------------------------------------------------- 1 | AceGenModule Shi2014exp_BC2 2 | nstatv: 70 3 | ElasticType: NeoHookean 4 | IsoHardType: Standard 5 | KinHardType: BC_D07mod 6 | DistHardType: Shi2014 7 | 8 | Material parameters (NumDistHardParam + NumElasticParam + NumIsoHardParam + NumKinHardParam): 9 | -------------------------------------------------------------------------------- /models/Shi2014/doc/Shi2014exp_AF.md: -------------------------------------------------------------------------------- 1 | # Shi2014exp_AF 2 | This model can have 2 back-stresses and is rate-independent. It only supports Armstrong-Frederick type of kinematic hardening. For a detailed description of the model formulation, please see the paper in ref.bib 3 | 4 | # parameters 5 | 1. G (Shear modulus) 6 | 2. K (Bulk modulus) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. Rinf (Isotropic saturation stress) 10 | 6. Hkin1 (Kinematic hardening modulus nr. 1) 11 | 7. Binf1 (Kinematic saturation stress nr 1) 12 | 8. Hkin2 (Kinematic hardening modulus nr. 2) 13 | 9. Binf2 (Kinematic saturation stress nr 2) 14 | 10. bD (Amount of dynamic hardening) 15 | 11. bL (Amount of latent hardening) 16 | 12. cD (Evolution parameter for CD) 17 | 13. cL (Evolution parameter for CL) 18 | 19 | 20 | # state variables 21 | 1-9) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 22 | 10) lambda (Accumulated plastic deformation (time integral of plastic multiplier)) 23 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 24 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 25 | 29-49) CD - I4 (Dynamic hardening 4th order tensor (minus 4th order symmetric identity tensor). Saved in special format using that it is minor and major symmetric) 26 | 50-70) CL - I4 (Latent hardening 4th order tensor (minus 4th order symmetric identity tensor). Saved in special format using that it is minor and major symmetric) -------------------------------------------------------------------------------- /models/Shi2014/doc/Shi2014exp_BC.md: -------------------------------------------------------------------------------- 1 | # Shi2014exp_BC 2 | This model can have 2 back-stresses and is rate-independent. It only supports Armstrong-Frederick type of kinematic hardening. For a detailed description of the model formulation, please see the paper in ref.bib 3 | 4 | # parameters 5 | 1. G (Shear modulus) 6 | 2. K (Bulk modulus) 7 | 3. Y0 (Initial yield limit) 8 | 4. Hiso (Isotropic hardening modulus) 9 | 5. Rinf (Isotropic saturation stress) 10 | 6. delta (Fraction of Armstrong-Frederick (delta=1) and Burlet-Cailletaud (delta=0) type of kinematic hardening) 11 | 7. Hkin1 (Kinematic hardening modulus nr. 1) 12 | 8. Binf1 (Kinematic saturation stress nr 1) 13 | 9. Hkin2 (Kinematic hardening modulus nr. 2) 14 | 10. Binf2 (Kinematic saturation stress nr 2) 15 | 11. bD (Amount of dynamic hardening) 16 | 12. bL (Amount of latent hardening) 17 | 13. cD (Evolution parameter for CD) 18 | 14. cL (Evolution parameter for CL) 19 | 20 | 21 | # state variables 22 | 1-9) Fp-I2 (Plastic deformation gradient (minus 2nd order identity)) 23 | 10) lambda (Accumulated plastic deformation (time integral of plastic multiplier)) 24 | 11-19) Fk1-I2 (Kinematic deformation gradient nr1 (minus 2nd order identity)) 25 | 20-28) Fk2-I2 (Kinematic deformation gradient nr2 (minus 2nd order identity)) 26 | 29-49) CD - I4 (Dynamic hardening 4th order tensor (minus 4th order symmetric identity tensor). Saved in special format using that it is minor and major symmetric) 27 | 50-70) CL - I4 (Latent hardening 4th order tensor (minus 4th order symmetric identity tensor). Saved in special format using that it is minor and major symmetric) -------------------------------------------------------------------------------- /models/Shi2014/ref.bib: -------------------------------------------------------------------------------- 1 | @article{Meyer2020, 2 | author = {Meyer, Knut Andreas}, 3 | doi = {10.1016/j.ijsolstr.2020.04.037}, 4 | journal = {International Journal of Solids and Structures (in press)}, 5 | title = {{Evaluation of material models describing the evolution of plastic anisotropy in pearlitic steel}}, 6 | year = {2020} 7 | } 8 | -------------------------------------------------------------------------------- /models/Shi2014/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Setup with Windows (example): 2 | # Or if need of another generator e.g.: 3 | # Build from command line: 4 | cmake_minimum_required (VERSION 3.0) 5 | 6 | if (NOT CMAKE_BUILD_TYPE) 7 | set(CMAKE_BUILD_TYPE Release CACHE STRING 8 | "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) 9 | endif() 10 | 11 | set(model Shi2014exp_AF2 CACHE STRING "Which base model to build") 12 | set_property(CACHE model PROPERTY STRINGS 13 | Shi2014exp_AF2 14 | Shi2014exp_BC2) 15 | 16 | if (NOT umat_utils_path) 17 | set(umat_utils_path "${CMAKE_CURRENT_SOURCE_DIR}/../../umat_utils" CACHE STRING "Folder containing umat utility routines") 18 | endif() 19 | 20 | project(disthard) 21 | enable_language (Fortran) 22 | 23 | # Get system information 24 | if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 25 | set(A64 TRUE) # 64 bit compilation system - needs to be same as for mpsim 26 | else() 27 | set(A64 FALSE) # 32 bit compilation system - needs to be same as for mpsim 28 | endif() 29 | get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) 30 | if (Fortran_COMPILER_NAME MATCHES "gfortran.*") 31 | set(GFORT TRUE) 32 | set(IFORT FALSE) 33 | if (A64) 34 | add_compile_options(-m64 -ffree-line-length-none -ffree-form) 35 | else () 36 | add_compile_options(-ffree-line-length-none -ffree-form) 37 | endif() 38 | elseif (Fortran_COMPILER_NAME MATCHES "ifort.*") 39 | set(GFORT FALSE) 40 | set(IFORT TRUE) 41 | # add_compile_options("$<$:/warn>") 42 | # add_compile_options("$<$:/check>") 43 | endif() 44 | 45 | 46 | # Add files 47 | add_library(disthard SHARED "umat.f90") 48 | target_sources(disthard PRIVATE 49 | "${umat_utils_path}/smsutility.f90" 50 | "${umat_utils_path}/SolveMatrixEquation.f90" 51 | "${model}.f90" 52 | "umat_module.f90" 53 | ) 54 | 55 | set_target_properties(disthard PROPERTIES PREFIX "") 56 | set_target_properties(disthard PROPERTIES OUTPUT_NAME "${model}") 57 | 58 | # Link to MKL library 59 | if (MSVC) #If Microsoft Visual compiler 60 | if (A64) 61 | target_link_libraries(disthard PRIVATE "mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib") 62 | else() 63 | target_link_libraries(disthard PRIVATE "mkl_intel_c.lib mkl_sequential.lib mkl_core.lib") 64 | endif() 65 | elseif (A64) 66 | if (UNIX AND NOT APPLE) # I.e. linux 67 | set (MKLROOT $ENV{MKLROOT} CACHE STRING "Please specify your MKLROOT path") 68 | target_include_directories(disthard PRIVATE "${MKLROOT}/include") 69 | if (GFORT) 70 | target_link_libraries(disthard PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 71 | elseif (IFORT) 72 | target_link_libraries(disthard PRIVATE "-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl") 73 | endif () 74 | endif() 75 | else() 76 | message("System configuration not supported") 77 | endif() 78 | -------------------------------------------------------------------------------- /models/Shi2014/src/abaqus_compile_files.txt: -------------------------------------------------------------------------------- 1 | Shi2014exp_AF2,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","Shi2014exp_AF2.f90","umat_module.f90","umat.f90" 2 | Shi2014exp_BC2,"../../umat_utils/SolveMatrixEquation.f90","../../umat_utils/smsutility.f90","Shi2014exp_BC2.f90","umat_module.f90","umat.f90" -------------------------------------------------------------------------------- /models/Shi2014/src/umat.f90: -------------------------------------------------------------------------------- 1 | !DEC$ FREEFORM 2 | ! See acegen generated code for definitions of material parameters and state variables 3 | ! ====== Start of constant umat header (Knut Andreas) ======== 4 | ! Variables that always should be updated 5 | ! stress [1 x ntens] stress tensor at beginning of increment, to be updated 6 | ! statev [1 x nstatv] Array of solution dependent state variables, to be updated (and rotated using drot) 7 | ! ddsdde [ntens x ntens] The jacobian dsigma/epsilon. 8 | ! sse [1] Specific elastic strain energy 9 | ! spd [1] Specific plastic dissipation 10 | ! scd [1] Specific creep dissipation 11 | ! 12 | ! Variables that should only be updated in fully coupled thermal-stress analysis 13 | ! rpl [1] Volumetric heat generation per unit time at the end of increment (see guide if geostatic pores) 14 | ! ddsddt [1 x ntens] Variation of the stress increments with respect to temperature 15 | ! drplde [1 x ntens] Variation of rpl with respect to the strain increments 16 | ! drpldt [1] Variation of rpl with respect to temperature 17 | ! 18 | ! Variables passed for information (DO NOT CHANGE) 19 | ! stran [1 x ntens] Strains at the beginning of the increment. Strain components rotated to account for RBM before UMAT call 20 | ! dstran [1 x ntens] Strain increments 21 | ! time [1 x 2] Value of [step time, total time] at the beginning of the current increment 22 | ! dtime [1] Time increment 23 | ! temp [1] Temperature at the start of the increment 24 | ! dtemp [1] Increment of temperature 25 | ! predef [1 x ?] Array of interpolated values of predefined field variables at this point at the start of the increment 26 | ! dpred [1 x ?] Array of increments of predefined field variables 27 | ! cmname [string] User-defined material name, left justified. 28 | ! ndi [int] Number of direct stress components at this point 29 | ! nshr [int] Number of engineering shear stress components at this point 30 | ! ntens [int] Size of the stress or strain component array (ndi + nshr) 31 | ! nstatv [int] Number of solution-dependent state variables that are associated with this material type 32 | ! props [1 x nprops] User-specified array of material constants associated with this user material 33 | ! nprops [int] User-defined number of material constants associated with this user material 34 | ! coords [1 x 3] An array containing the coordinates of this point. 35 | ! drot [3 x 3] Rotation increment matrix 36 | ! pnewdt [1] CAN BE CHANGED: Ratio of suggested new time increment to the time increment being used 37 | ! celent [1] Characteristic element length 38 | ! dfgrd0 [3,3] Deformation gradient at the beginning of the increment 39 | ! dfgrd1 [3,3] Deformation gradient at the end of the increment 40 | ! noel [int] Element number 41 | ! npt [int] Integration point number 42 | ! layer [int] Layer number (for composite shells and layered solids) 43 | ! kspt [int] Section point number within the current layer 44 | ! kstep [int] Step number 45 | ! kinc [int] Increment number 46 | ! 47 | 48 | ! To compile for abaqus, remove comments on smsutility, umat_module. 49 | ! Also comment out "!DEC$ ATTRIBUTES DLLEXPORT :: UMAT" by adding another exclamation mark in front. 50 | 51 | !include '../../umat_utils/smsutility.f90' ! Required for AceGen code 52 | !include 'Shi2014_1.f90' ! Particular model functions generated by AceGen 53 | !include '../../umat_utils/SolveMatrixEquation.f90' ! Solving of nonlinear matrix equation system 54 | !include 'umat_module.f90' ! Support function for this umat 55 | 56 | SUBROUTINE umat(stress,statev,ddsdde,sse,spd,scd, & 57 | rpl,ddsddt,drplde,drpldt,& 58 | stran,dstran,time,dtime,temp,dtemp,predef,dpred,cmname,& 59 | ndi,nshr,ntens,nstatv,props,nprops,coords,drot,pnewdt,& 60 | celent,dfgrd0,dfgrd1,noel,npt,layer,kspt,kstep,kinc) 61 | !DEC$ ATTRIBUTES DLLEXPORT :: UMAT 62 | use SolveMatrixEquation 63 | use umat_module 64 | use acegen_mod 65 | 66 | implicit none 67 | ! 68 | character*80 cmname 69 | integer:: ndi,nshr,ntens,nstatv,nprops,noel,npt,& 70 | layer, kspt, kstep, kinc 71 | double precision:: dtime,temp,dtemp,pnewdt,celent,sse,spd,scd,rpl,drpldt 72 | double precision:: stress(ntens),statev(nstatv),& 73 | ddsdde(ntens,ntens),ddsddt(ntens),drplde(ntens),& 74 | stran(ntens),dstran(ntens),time(2),predef(1),dpred(1),& 75 | props(nprops),coords(3),drot(3,3),dfgrd0(3,3),dfgrd1(3,3) 76 | ! 77 | ! 78 | ! ====== End of constant umat header excl. includes (Knut Andreas) ======== 79 | double precision :: Fnew(9) 80 | double precision, allocatable :: jac_inv(:,:), r0(:), x0(:), param(:), statevNew(:) 81 | integer :: k1, info, max_iter 82 | logical :: lconv, use_el_stiff 83 | double precision :: newton_tolerance, yielding 84 | double precision :: stressi(6), ddsddei(6,6) ! Internal stress and stiffness (always full) 85 | 86 | ! Iteration settings 87 | newton_tolerance = 1.d-8 88 | max_iter = 20 89 | 90 | ! Check input 91 | call checkinput(nprops, nstatv) ! Assigns nvar and nslip 92 | allocate(jac_inv(nvar, nvar)) 93 | allocate(r0(nvar), statevNew(nstatv), x0(nvar)) 94 | 95 | ! Check elastic response 96 | Fnew = m3x3_2_v9(dfgrd1) 97 | call elastic(props,statev,Fnew,stressi,ddsddei,yielding,x0) 98 | 99 | if (yielding>0) then ! Solve for plasticity 100 | 101 | !Set parameters for "Solve Matrix Equation" 102 | call sme_setparam(itertol=newton_tolerance, maxiter=max_iter) 103 | 104 | !Solve local problem using newton raphson iterations and analytical jacobian 105 | call newton_raphson_ana(residualfun, anajac, x0, jac_inv, lconv, info, props, statev, param=Fnew, printres=0) 106 | 107 | !call newton_raphson_num(residualfun, x0, jac_inv, lconv, info, props, statev, param=Fnew, printres=2) 108 | 109 | !Calculate ddsdde, statev and stress from solution of local problem 110 | call plastic_output(x0,props,statev,Fnew,jac_inv,stressi,ddsddei,statevNew,spd) 111 | 112 | statev=statevNew 113 | 114 | !Check that solution converged 115 | call check_analysis(lconv,pnewdt) 116 | 117 | 118 | endif 119 | 120 | stress = stressi(1:ntens) 121 | ddsdde = ddsddei(1:ntens, 1:ntens) 122 | 123 | END SUBROUTINE -------------------------------------------------------------------------------- /models/Shi2014/src/umat_module.f90: -------------------------------------------------------------------------------- 1 | module umat_module 2 | use acegen_mod 3 | implicit none 4 | 5 | integer :: nvar ! Number of variables in local problem 6 | 7 | contains 8 | 9 | !Check that the input to the UMAT is correct 10 | subroutine checkinput(nprops, nstatv) 11 | implicit none 12 | integer, intent(in) :: nprops, nstatv 13 | logical :: error 14 | integer :: nstatv_model ! Number of state variables in model 15 | integer :: nprops_model ! Number of material params in model 16 | 17 | call model_size(nprops_model,nstatv_model,nvar) 18 | 19 | error = .false. 20 | if (nprops.ne.nprops_model) then 21 | error = .true. 22 | elseif (nstatv.ne.nstatv_model) then 23 | error = .true. 24 | endif 25 | 26 | ! Quit analysis if invalid input 27 | if (error) then 28 | write(*,*) 'Invalid input to umat subroutine' 29 | write(*,*) 'You specified ', nprops, ' material parameters: ', nprops_model, ' should be given' 30 | write(*,*) 'You specified ', nstatv, ' state variables: ', nstatv_model, ' should be given' 31 | call quit_analysis() 32 | endif 33 | 34 | 35 | end subroutine checkinput 36 | 37 | !Residual function (wrapper for AceGen code) 38 | subroutine residualfun(r, x, props, statev, param) 39 | implicit none 40 | double precision, intent(in) :: x(:) 41 | double precision, intent(in), optional :: props(:), statev(:), param(:) !Residual function parameters 42 | double precision, allocatable, intent(out) :: r(:) 43 | 44 | allocate(r(nvar)) 45 | 46 | call residual(x,props,statev,param,r) 47 | 48 | end subroutine residualfun 49 | 50 | !Jacobian function (wrapper for AceGen code) 51 | subroutine anajac(ajacobian, x, props, statev, param) 52 | implicit none 53 | double precision, intent(in) :: x(:) 54 | double precision, intent(in), optional :: props(:), statev(:), param(:) !parameters 55 | double precision, allocatable, intent(out) :: ajacobian(:,:) 56 | 57 | allocate(ajacobian(nvar,nvar)) 58 | 59 | call jacobian(x,props,statev,param,ajacobian) 60 | 61 | end subroutine anajac 62 | 63 | 64 | ! Check if problem converged 65 | subroutine check_analysis(lconv, pnewdt) 66 | implicit none 67 | logical, intent(in) :: lconv 68 | double precision :: pnewdt 69 | if (.not.lconv) then 70 | !write(*,*) 'Local problem did not converge' 71 | pnewdt = 5.d-1 72 | return 73 | endif 74 | 75 | end subroutine check_analysis 76 | 77 | function m3x3_2_v9(mat) result(v9) 78 | implicit none 79 | double precision :: mat(3,3), v9(9) 80 | 81 | v9 = (/mat(1,1), mat(2,2), mat(3,3), mat(1,2), mat(2,3), mat(3,1), mat(1,3), mat(2,1), mat(3,2)/) 82 | 83 | end function 84 | 85 | !Safely quit analysis in a correct way 86 | subroutine quit_analysis() 87 | implicit none 88 | !call xit() !Quit abaqus analysis in a correct way (Comment out if running outside abaqus) 89 | stop !Use if running outside abaqus 90 | end subroutine quit_analysis 91 | 92 | end module -------------------------------------------------------------------------------- /models/umat_utils/Tensors_module/Abaqus_conversions.f90: -------------------------------------------------------------------------------- 1 | ! ABAQUS CONVERSIONS 2 | ! Functions Input Description 3 | ! sigma_v9_2_sigma_abaqus sigma_v9 Convert sigma in 9-voigt to abaqus sigma 6-voigt and abaqus index order 4 | ! sigma_abaqus_2_sigma_v9 sigma_abaqus Convert sigma in abaqus sigma 6-voigt and abaqus index order to 9-voigt 5 | ! eps_abaqus_2_eps_v9 eps_aba Convert epsilon in abaqus output format to tensor module format 6 | ! eps_v9_2_eps_abaqus eps_v9 Convert epsilon in tensor module format to abaqus output format 7 | ! 8 | ! dtaudF_2_DDSDDE dtaudF, F Convert dtaudF in 9x9voigt to Abaqus DDSDDE in 6x6 voigt and abaqus index order 9 | 10 | module ABAQUS_Conversions 11 | use Conversions 12 | use Open_products 13 | use Contractions 14 | use Standard_tensors 15 | use Stiffness_Conversions 16 | Implicit none 17 | contains 18 | 19 | !============================================================================== 20 | function sigma_v9_2_sigma_abaqus(sigma_v9) result(sigma_abaqus) 21 | !Convert sigma in tensor module format to abaqus output format 22 | implicit none 23 | double precision, intent(in) :: sigma_v9(9) 24 | double precision :: sigma_abaqus(6) 25 | double precision :: tmp(9) 26 | tmp = 0.5*(sigma_v9 + trans_V9(sigma_v9)) !Symmetrize 27 | sigma_abaqus = tmp((/1, 2, 3, 4, 6, 5/)) !Convert indicies 28 | 29 | end function sigma_v9_2_sigma_abaqus 30 | !============================================================================== 31 | 32 | !============================================================================== 33 | function sigma_abaqus_2_sigma_v9(sigma_abaqus) result(sigma_v9) 34 | !Convert sigma in abaqus output format to tensor module format 35 | implicit none 36 | double precision, intent(in) :: sigma_abaqus(6) 37 | double precision :: sigma_v9(9) 38 | sigma_v9 = sigma_abaqus((/1, 2, 3, 4, 6, 5, 5, 4, 6/)) !Convert indicies 39 | 40 | end function sigma_abaqus_2_sigma_v9 41 | !============================================================================== 42 | 43 | !============================================================================== 44 | function eps_abaqus_2_eps_v9(eps_aba) result(eps_v9) 45 | !Convert epsilon in abaqus output format to tensor module format 46 | implicit none 47 | double precision, intent(in) :: eps_aba(6) 48 | double precision :: eps_v9(9) 49 | eps_v9 = eps_aba((/1, 2, 3, 4, 6, 5, 5, 4, 6/)) !Convert indicies 50 | eps_v9(4:9) = eps_v9(4:9)/2 51 | 52 | end function eps_abaqus_2_eps_v9 53 | !============================================================================== 54 | 55 | !============================================================================== 56 | function eps_v9_2_eps_abaqus(eps_v9) result(eps_aba) 57 | !Convert epsilon in tensor module format to abaqus output format 58 | implicit none 59 | double precision, intent(in) :: eps_v9(9) 60 | double precision :: eps_aba(6) 61 | eps_aba(1:3) = eps_v9((/1, 2, 3/)) 62 | eps_aba(4:6) = eps_v9((/4, 7, 5/)) + eps_v9((/8, 6, 9/)) 63 | 64 | end function eps_v9_2_eps_abaqus 65 | !============================================================================== 66 | 67 | !============================================================================== 68 | function dtaudF_2_ddsdde(dtaudF, F) result(ddsdde) 69 | implicit none 70 | double precision, intent(in) :: dtaudF(9,9), F(9) 71 | double precision :: tmp(9,9), ddsdde(6,6) 72 | integer :: posvec(6) 73 | 74 | tmp = (1.d0/det_V9(F)) * V9x9_dd_V9x9(dtaudF, op_a_V9(eye_V9(), trans_V9(F))) 75 | tmp = minsym_V9x9(tmp) 76 | 77 | posvec = (/1, 2, 3, 4, 6, 5/) ! Index conversion 78 | ddsdde = tmp(posvec, posvec) 79 | 80 | end function dtaudF_2_ddsdde 81 | !============================================================================== 82 | 83 | end module -------------------------------------------------------------------------------- /models/umat_utils/Tensors_module/Standard_tensors.f90: -------------------------------------------------------------------------------- 1 | ! STANDARD_TENSORS (PROJECTION TENSORS) 2 | ! eye_V9 2nd order identity tensor (9 components) 3 | ! idev_v9x9 4th order deviatoric identity tensor 4 | module standard_tensors 5 | use open_products 6 | implicit none 7 | contains 8 | 9 | !============================================================================== 10 | function eye_v9() result(eye) 11 | implicit none 12 | double precision :: eye(9) 13 | 14 | eye = 0.0d0 15 | 16 | eye(1:3) = (/ 1.0d0, 1.0d0, 1.0d0 /) 17 | 18 | end function eye_V9 19 | !============================================================================== 20 | 21 | !============================================================================== 22 | function idev_v9x9() result(idev) 23 | implicit none 24 | double precision :: idev(9,9), eye(9) 25 | 26 | eye = eye_v9() 27 | idev = op_a_v9(eye,eye) - op_v9(eye, eye)/3.d0 28 | 29 | end function idev_v9x9 30 | !============================================================================== 31 | 32 | end module -------------------------------------------------------------------------------- /models/umat_utils/Tensors_module/Stiffness_conversions.f90: -------------------------------------------------------------------------------- 1 | ! STIFFNESS_CONVERSIONS 2 | ! dSdE_2_dPdF Convert dSdE to dPdF 3 | ! dSdE_2_dtaudF Convert dSdE to d(tau)dF 4 | ! dPdF_2_dtaudF Convert dPdF to d(tau)dF 5 | 6 | Module Stiffness_Conversions 7 | use Conversions 8 | use Open_products 9 | use Contractions 10 | use Standard_tensors 11 | use Operations 12 | Implicit none 13 | CONTAINS 14 | 15 | !============================================================================== 16 | FUNCTION dSdE_2_dPdF(dSdE,F,S) result(dPdF) 17 | implicit none 18 | double precision, intent(in) :: dSdE(9,9), F(9), S(9) 19 | double precision :: dPdF(9,9), I2(9), Ft(9) 20 | I2 = eye_V9() 21 | Ft = trans_V9(F) 22 | dPdF = op_a_V9(I2, S) + (1/2)*V9x9_dd_V9x9(V9x9_dd_V9x9(op_a_V9(F, I2), dSdE), op_b_V9(I2, Ft)+op_a_V9(Ft,I2)) 23 | 24 | END FUNCTION dSdE_2_dPdF 25 | !============================================================================== 26 | 27 | !============================================================================== 28 | FUNCTION dSdE_2_dtaudF(dSdE,F,S) result(dtaudF) 29 | !S = 2nd Piola Kirchoff 30 | !E = 0.5(C-I2), C=F^T*F 31 | !F = Deformation gradient 32 | implicit none 33 | double precision, intent(in) :: dSdE(9,9), F(9), S(9) 34 | double precision :: dtaudF(9,9), I2(9), Ft(9) 35 | I2 = eye_V9() 36 | Ft = trans_V9(F) 37 | dtaudF = op_a_V9(I2, V9_d_V9(F, S)) + op_b_V9(V9_d_V9(F, S), I2) & 38 | + 0.5*V9x9_dd_V9x9(V9x9_dd_V9x9(op_a_V9(F, F), dSdE), op_b_V9(I2, Ft)+op_a_V9(Ft, I2)) 39 | 40 | END FUNCTION dSdE_2_dtaudF 41 | !============================================================================== 42 | 43 | !============================================================================== 44 | FUNCTION dPdF_2_dtaudF(dPdF,F,P) result(dtaudF) 45 | implicit none 46 | double precision, intent(in) :: dPdF(9,9), F(9), P(9) 47 | double precision :: dtaudF(9,9), I2(9), Ft(9) 48 | I2 = eye_V9() 49 | Ft = trans_V9(F) 50 | dtaudF = V9x9_dd_V9x9(op_a_V9(I2, F), dPdF) + op_b_V9(P, I2) 51 | 52 | END FUNCTION dPdF_2_dtaudF 53 | !============================================================================== 54 | 55 | end module -------------------------------------------------------------------------------- /models/umat_utils/smsutility.f90: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KnutAM/MaterialModels/50fce6ae965c711f2b1d9977470c368770b35572/models/umat_utils/smsutility.f90 -------------------------------------------------------------------------------- /models/umat_utils/umat_utils_instructions.md: -------------------------------------------------------------------------------- 1 | # Utility functions for umats 2 | `smsutility.f90` Needed for use with AceGen 3 | `SolveMatrixEquation.f90` Solve nonlinear system of equations on the form R(x)=0 using Newtons method (Hence the matrix name) 4 | `Tensors_module.f90` Tensor utility functions 5 | 6 | ## Rules for how different utilities should be put in this folder 7 | * Only one file should be required to include per utility 8 | * If more files are needed these should be included explicitly 9 | * These should be put in a folder with the same name as the main file. -------------------------------------------------------------------------------- /scripts/compile_abaqus.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import pathlib as pl 4 | import shutil 5 | import distutils.dir_util as dutil 6 | 7 | all_model_categories = ['GenSmallStrain', 'GenFiniteStrain'] 8 | 9 | def main(argv): 10 | # Tasks, for each folder (model category): 11 | # For each line in "abaqus_compile_files.txt" 12 | # - Create a file umat.for or umat.f for windows or linux, respectively, with all content of included files 13 | # - Call abaqus make routine, i.e., abaqus make library="umat.[for/f]" (Note that previous builds should be removed) 14 | # - Rename output according to info in "abaqus_compile_files.txt" and move to the compiled_abaqus folder (if not 15 | # existent, create this folder) 16 | 17 | if len(argv) > 1: 18 | model_categories = [argv[1]] 19 | else: 20 | model_categories = all_model_categories 21 | 22 | if len(argv) > 2: 23 | line_numbers = [] 24 | for nr in argv[2:]: 25 | line_numbers.append(int(nr)) 26 | else: 27 | line_numbers = None 28 | 29 | for model_cat in model_categories: 30 | build_model_cat(model_cat, line_numbers) 31 | 32 | 33 | def build_model_cat(model_cat, line_numbers=None): 34 | # Tasks 35 | # For each row in model_cat/src/abaqus_compile_files.txt 36 | # Call routine to build specific model 37 | # If line_numbers is not None, only call build routine at those particular lines 38 | model_cat_folder = pl.Path('../models/' + model_cat) 39 | lines = (model_cat_folder / 'src' / 'abaqus_compile_files.txt').read_text().splitlines() 40 | if line_numbers is None: 41 | for line in lines: 42 | build_model(model_cat, line) 43 | else: 44 | for nr in line_numbers: 45 | build_model(model_cat, lines[nr]) 46 | 47 | 48 | def build_model(model_cat, model_info): 49 | # Given the model_cat (giving the base folder containing the src folder) and 50 | # the model_info (the line in abaqus_compile_files.txt) containing the model name followed by each used file in 51 | # correct order (relative path from the src folder) 52 | # Combine all files into one umat and build it 53 | model_name = model_info.split(',')[0] 54 | model_files = model_info.split(',')[1:] 55 | 56 | print('Building model ' + model_cat + ' (' + model_name + ')') 57 | 58 | umat = create_umat() 59 | file_contents = '' 60 | for model_file in model_files: 61 | file = pl.Path('../models/' + model_cat) / 'src' / model_file.strip('"') 62 | try: 63 | file_contents = file_contents + file.read_text() + '\n' 64 | except UnicodeDecodeError: 65 | file_contents = file_contents + file.read_text(encoding='latin1') + '\n' 66 | 67 | # dec_freeform (if written, is not needed within the file). Remove it, and add it in the beginning of the whole file 68 | dec_freeform = '!DEC$ FREEFORM' 69 | ind = file_contents.find(dec_freeform) 70 | file_contents = file_contents[:ind] + '\n' + file_contents[(ind+len(dec_freeform)):] 71 | file_contents = dec_freeform + '\n' + file_contents 72 | 73 | # Write to the umat.for / umat.f file 74 | umat.write_text(file_contents) 75 | 76 | dutil._path_created = {} # Need to clear cache after deleting the old tree using shutil.rmtree 77 | dutil.copy_tree('../models/umat_utils', str(umat.parent)) 78 | 79 | os.chdir(umat.parent) 80 | os.system('abaqus make library=' + str(umat.name)) 81 | 82 | os.chdir('..') 83 | print(os.getcwd()) 84 | 85 | compiled_dir = pl.Path('../compiled_abaqus') 86 | if not compiled_dir.exists(): 87 | os.mkdir(compiled_dir) 88 | 89 | if str(umat).endswith('.for'): 90 | delete_files([model_name+'.dll', model_name+'.obj'], compiled_dir) 91 | os.rename(umat.parent / 'standardU.dll', compiled_dir / (model_name + '.dll')) 92 | os.rename(umat.parent / 'umat-std.obj', compiled_dir / (model_name + '.obj')) 93 | else: 94 | delete_files([model_name+'.so', model_name+'.o'], '../compiled_abaqus/') 95 | os.rename(umat.parent / 'libstandardU.so', compiled_dir / (model_name + '.so')) 96 | os.rename(umat.parent / 'umat-std.o', compiled_dir / (model_name + '.o')) 97 | 98 | # Move umat sources to a folder such that umat can be compiled together with other user 99 | # subroutines if required 100 | src_dir = compiled_dir / model_name 101 | if src_dir.exists(): 102 | shutil.rmtree(src_dir) 103 | 104 | os.rename(umat.parent, src_dir) 105 | 106 | 107 | def create_umat(): # Umat actually not created, but path object to it is. 108 | dir = pl.Path('tmp_build_dir') 109 | if dir.exists(): 110 | shutil.rmtree(str(dir)) 111 | 112 | os.mkdir(str(dir)) 113 | 114 | if sys.platform.startswith('win'): 115 | umat = dir / 'umat.for' 116 | elif sys.platform.startswith('linux'): 117 | umat = dir / 'umat.f' 118 | else: 119 | print('System not recognized') 120 | 121 | return umat 122 | 123 | 124 | def delete_files(files, prepend=''): 125 | prepend = pl.Path(prepend) 126 | for file in files: 127 | if os.path.exists(prepend / file): 128 | os.remove(prepend / file) 129 | 130 | 131 | if __name__ == '__main__': 132 | main(sys.argv) 133 | -------------------------------------------------------------------------------- /scripts/compile_general.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import sys 3 | import os 4 | import shutil 5 | import platform 6 | from pathlib import Path 7 | 8 | if platform.system() == 'Linux': 9 | linux_compiler = 'ifort' 10 | dll_suffix = '.so' 11 | dll_location = '' 12 | cmake_setup = 'FC=' + linux_compiler + ' cmake ../src' 13 | elif platform.system() == 'Windows': 14 | dll_suffix = '.dll' 15 | dll_location = 'Release/' 16 | cmake_setup = 'cmake -G "Visual Studio 12 2013 Win64" ../src' 17 | elif platform.system() == 'Darwin': 18 | print('MAC not supported by this script') 19 | else: 20 | print('Unknown platform (os), not supported by this script') 21 | 22 | all_model_categories = ['GenSmallStrain', 'GenFiniteStrain'] 23 | 24 | output_dir = Path('../compiled/').absolute() 25 | script_dir = Path(os.path.realpath(__file__)).parent 26 | 27 | if not output_dir.exists(): 28 | os.mkdir(output_dir) 29 | 30 | 31 | def main(argv): 32 | # Input argument 1 33 | # Which model category to compile (default is all_model_categories) 34 | # Input arguments 2- 35 | # Sequence of indicies (row nr - 1) of models to compile, see cmake_compile_models.txt or abaqus_compile_files.txt 36 | # if the former doesn't exist. The default is to compile all models in category 37 | 38 | if len(argv) > 1: 39 | model_categories = [argv[1]] 40 | else: 41 | model_categories = all_model_categories 42 | 43 | if len(argv) > 2: 44 | line_numbers = [] 45 | for nr in argv[2:]: 46 | line_numbers.append(int(nr)) 47 | else: 48 | line_numbers = None 49 | 50 | for model_cat in model_categories: 51 | os.chdir(script_dir) 52 | build_model_cat(model_cat, line_numbers) 53 | 54 | 55 | def build_model_cat(model_cat, line_numbers=None): 56 | # Tasks 57 | # For each row in model_cat/src/abaqus_compile_files.txt 58 | # Call routine to build specific model 59 | # If line_numbers is not None, only call build routine at those particular lines 60 | model_cat_folder = Path('../models/' + model_cat) 61 | 62 | models, cmake_set_vars = get_models(model_cat_folder, line_numbers) 63 | 64 | os.chdir(model_cat_folder) 65 | 66 | build_dir = 'build/' 67 | 68 | if os.path.exists(build_dir): 69 | if input('Do you want to clean build? (yes/no)= ') == 'yes': 70 | shutil.rmtree(build_dir) 71 | os.mkdir(build_dir) 72 | else: 73 | os.mkdir(build_dir) 74 | 75 | os.chdir(build_dir) 76 | 77 | os.system(cmake_setup) 78 | for mod, var in zip(models, cmake_set_vars): 79 | print('cmake ' + var + ' .') 80 | os.system('cmake ' + var + ' .') 81 | os.system('cmake --build . --config RELEASE') 82 | shutil.copy(dll_location + mod + dll_suffix, output_dir) 83 | 84 | 85 | def get_models(model_cat_folder, line_numbers): 86 | custom_cmake_specs = model_cat_folder / 'src' / 'cmake_compile_models.txt' 87 | 88 | cmake_var_set = [] 89 | models = [] 90 | if custom_cmake_specs.exists(): 91 | specs = custom_cmake_specs.read_text().splitlines() 92 | if line_numbers is None: 93 | for spec in specs: 94 | models.append(spec.split(':')[0]) 95 | cmake_var_set.append(spec.split(':')[1]) 96 | else: 97 | for nr in line_numbers: 98 | if nr >= len(specs): 99 | print(model_cat_folder.name + ' has only ' + str(len(specs)) + ' specific models') 100 | print('skipping nr ' + str(nr + 1)) 101 | else: 102 | models.append(specs[nr].split(':')[0]) 103 | cmake_var_set.append(specs[nr].split(':')[1]) 104 | else: 105 | lines = (model_cat_folder / 'src' / 'abaqus_compile_files.txt').read_text().splitlines() 106 | if line_numbers is None: 107 | for line in lines: 108 | models.append(line.split(',')[0]) 109 | cmake_var_set.append('-D model=' + models[-1]) 110 | else: 111 | for nr in line_numbers: 112 | if nr >= len(lines): 113 | print(model_cat_folder.name + ' has only ' + str(len(lines)) + ' specific models') 114 | print('skipping nr ' + str(nr+1)) 115 | else: 116 | models.append(lines[nr].split(',')[0]) 117 | cmake_var_set.append('-D model=' + models[-1]) 118 | 119 | return models, cmake_var_set 120 | 121 | 122 | if __name__ == '__main__': 123 | main(sys.argv) # run the main function 124 | --------------------------------------------------------------------------------