Merge remote-tracking branch 'origin/development' into from_fiber-improvements

This commit is contained in:
Martin Diehl 2022-05-08 22:21:53 +02:00
commit d7e7750400
26 changed files with 229 additions and 201 deletions

View File

@ -2,7 +2,7 @@ name: Grid and Mesh Solver
on: [push]
env:
PETSC_VERSION: '3.17.0'
PETSC_VERSION: '3.17.1'
HOMEBREW_NO_ANALYTICS: 'ON' # Make Homebrew installation a little quicker
HOMEBREW_NO_AUTO_UPDATE: 'ON'
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 'ON'

View File

@ -32,6 +32,13 @@ jobs:
export VERSION=$(cat VERSION)
echo ${VERSION%-*} > VERSION
- name: Strip git hash (Windows)
if: runner.os == 'Windows'
run: |
$VERSION = Get-Content VERSION -first 1
$VERSION,$_ = $VERSION -Split '-g',2,"simplematch"
$VERSION | Out-File VERSION
- name: Install and run unit tests (Unix)
if: runner.os != 'Windows'
run: |

View File

@ -164,8 +164,8 @@ setup_Marc:
- cd $(mktemp -d)
- cp ${CI_PROJECT_DIR}/examples/Marc/* .
- python3 -c "import damask;damask.solver.Marc().submit_job('r-value','texture',True,'h')"
- mkdir ${TESTROOT}/src
- mv ${CI_PROJECT_DIR}/src/DAMASK_Marc.marc ${TESTROOT}/src
- mkdir -p ${TESTROOT}/src/Marc
- mv ${CI_PROJECT_DIR}/src/Marc/DAMASK_Marc.marc ${TESTROOT}/src/Marc
###################################################################################################

View File

@ -41,7 +41,7 @@ message("\nBuilding ${CMAKE_PROJECT_NAME} ${DAMASK_VERSION}\n")
add_definitions(-DPETSC)
add_definitions(-DDAMASKVERSION="${DAMASK_VERSION}")
add_definitions(-DCMAKE_SYSTEM="${CMAKE_SYSTEM}")
if(PETSC_VERSION VERSION_GREATER_EQUAL 3.17.0)
if(PETSC_VERSION VERSION_EQUAL 3.17.0)
add_definitions("-DCHKERRQ=PetscCall")
endif()

View File

@ -1 +1 @@
3.0.0-alpha6-266-g5776891b7
3.0.0-alpha6-291-g7d18ed307

View File

@ -1,5 +1,5 @@
phase: [basic, extensive, selective]
CPFEM: [basic, extensive, selective]
materialpoint: [basic, extensive, selective]
# options for selective debugging
element: 1

View File

@ -56,15 +56,15 @@
+
+# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3
+DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD"
+DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD"
+DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD"

View File

@ -56,15 +56,15 @@
+
+# DAMASK compiler calls
+DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD"
+DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD"
+DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.2 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD"

View File

@ -55,15 +55,15 @@
+
+# DAMASK compiler calls
+DFORTLOWMP="$FCOMP -c -O0 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD"
+DFORTRANMP="$FCOMP -c -O1 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD"
+DFORTHIGHMP="$FCOMP -c -O3 -qno-offload -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2020 -DDAMASKVERSION=$DAMASKVERSION \
+ -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMARC4DAMASK=2021.3.1 -DDAMASKVERSION=$DAMASKVERSION \
+ -qopenmp -qopenmp-threadprivate=compat\
+ $MUMPS_INCLUDE $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS -I$KDTREE2_MOD -I$MARC_MOD"
+

View File

@ -1 +0,0 @@
../README

1
python/README.md Symbolic link
View File

@ -0,0 +1 @@
../README.md

View File

@ -64,7 +64,7 @@ class Marc:
Defaults to ''.
"""
usersub = (self.damask_root/'src/DAMASK_Marc').with_suffix('.f90' if compile else '.marc')
usersub = (self.damask_root/'src/Marc/DAMASK_Marc').with_suffix('.f90' if compile else '.marc')
if not usersub.is_file():
raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found')

View File

@ -15,7 +15,7 @@ classifiers =
Operating System :: OS Independent
[options]
packages = damask
packages = find:
include_package_data = true
python_requires = >= 3.8
install_requires =

View File

@ -6,12 +6,6 @@ endif()
file(GLOB damask-sources CONFIGURE_DEPENDS *.f90 *.c)
# probably we should have a subfolder for MSC.Marc
list(FILTER damask-sources EXCLUDE REGEX ".*CPFEM.f90")
list(FILTER damask-sources EXCLUDE REGEX ".*DAMASK_Marc.*.f90")
list(FILTER damask-sources EXCLUDE REGEX ".*commercialFEM_fileList.*.f90")
if(PROJECT_NAME STREQUAL "damask-grid")
set(executable-name "DAMASK_grid")
file(GLOB solver-sources CONFIGURE_DEPENDS grid/*.f90)

View File

@ -15,7 +15,7 @@
#define MARC4DAMASK Marc4DAMASK
#endif
#include "prec.f90"
#include "../prec.f90"
module DAMASK_interface
use prec
@ -46,7 +46,7 @@ subroutine DAMASK_interface_init
integer :: ierr
character(len=pPathLen) :: wd
print'(/,1x,a)', '<<<+- DAMASK_marc init -+>>>'
print'(/,1x,a)', '<<<+- DAMASK_Marc init -+>>>'
print*, 'Roters et al., Computational Materials Science 158:420478, 2019'
print*, 'https://doi.org/10.1016/j.commatsci.2018.04.030'
@ -139,8 +139,55 @@ end function solverIsSymmetric
end module DAMASK_interface
#include "commercialFEM_fileList.f90"
#include "../parallelization.f90"
#include "../constants.f90"
#include "../IO.f90"
#include "../YAML_types.f90"
#include "../YAML_parse.f90"
#include "../HDF5_utilities.f90"
#include "../results.f90"
#include "../config.f90"
#include "../LAPACK_interface.f90"
#include "../math.f90"
#include "../rotations.f90"
#include "../polynomials.f90"
#include "../lattice.f90"
#include "../element.f90"
#include "../geometry_plastic_nonlocal.f90"
#include "../discretization.f90"
#include "discretization_Marc.f90"
#include "../material.f90"
#include "../phase.f90"
#include "../phase_mechanical.f90"
#include "../phase_mechanical_elastic.f90"
#include "../phase_mechanical_plastic.f90"
#include "../phase_mechanical_plastic_none.f90"
#include "../phase_mechanical_plastic_isotropic.f90"
#include "../phase_mechanical_plastic_phenopowerlaw.f90"
#include "../phase_mechanical_plastic_kinehardening.f90"
#include "../phase_mechanical_plastic_dislotwin.f90"
#include "../phase_mechanical_plastic_dislotungsten.f90"
#include "../phase_mechanical_plastic_nonlocal.f90"
#include "../phase_mechanical_eigen.f90"
#include "../phase_mechanical_eigen_cleavageopening.f90"
#include "../phase_mechanical_eigen_thermalexpansion.f90"
#include "../phase_thermal.f90"
#include "../phase_thermal_dissipation.f90"
#include "../phase_thermal_externalheat.f90"
#include "../phase_damage.f90"
#include "../phase_damage_isobrittle.f90"
#include "../phase_damage_anisobrittle.f90"
#include "../homogenization.f90"
#include "../homogenization_mechanical.f90"
#include "../homogenization_mechanical_pass.f90"
#include "../homogenization_mechanical_isostrain.f90"
#include "../homogenization_mechanical_RGC.f90"
#include "../homogenization_thermal.f90"
#include "../homogenization_thermal_pass.f90"
#include "../homogenization_thermal_isotemperature.f90"
#include "../homogenization_damage.f90"
#include "../homogenization_damage_pass.f90"
#include "materialpoint_Marc.f90"
!--------------------------------------------------------------------------------------------------
!> @brief This is the MSC.Marc user subroutine for defining material behavior
@ -158,9 +205,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
use DAMASK_interface
use config
use YAML_types
use discretization_marc
use discretization_Marc
use homogenization
use CPFEM
use materialpoint_Marc
implicit none
include "omp_lib.h" ! the openMP function library
@ -214,8 +261,8 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
! Marc common blocks are in fixed format so they have to be reformated to free format (f90)
! Beware of changes in newer Marc versions
#include QUOTE(PASTE(./Marc/include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl
#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment)
#include QUOTE(PASTE(include/concom,MARC4DAMASK)) ! concom is needed for inc, lovl
#include QUOTE(PASTE(include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment)
logical :: cutBack
real(pReal), dimension(6) :: stress
@ -232,7 +279,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
logical, save :: &
lastIncConverged = .false., & !< needs description
outdatedByNewInc = .false., & !< needs description
CPFEM_init_done = .false., & !< remember whether init has been done already
materialpoint_init_done = .false., & !< remember whether init has been done already
debug_basic = .true.
class(tNode), pointer :: &
debug_Marc ! pointer to Marc debug options
@ -255,9 +302,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
defaultNumThreadsInt = omp_get_num_threads() ! remember number of threads set by Marc
call omp_set_num_threads(1_pI32) ! no openMP
if (.not. CPFEM_init_done) then
CPFEM_init_done = .true.
call CPFEM_initAll
if (.not. materialpoint_init_done) then
materialpoint_init_done = .true.
call materialpoint_initAll
debug_Marc => config_debug%get('Marc',defaultVal=emptyList)
debug_basic = debug_Marc%contains('basic')
endif
@ -265,9 +312,9 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
computationMode = 0 ! save initialization value, since it does not result in any calculation
if (lovl == 4 ) then ! jacobian requested by marc
if (timinc < theDelta .and. theInc == inc .and. lastLovl /= lovl) & ! first after cutback
computationMode = CPFEM_RESTOREJACOBIAN
computationMode = materialpoint_RESTOREJACOBIAN
elseif (lovl == 6) then ! stress requested by marc
computationMode = CPFEM_CALCRESULTS
computationMode = materialpoint_CALCRESULTS
if (cptim > theTime .or. inc /= theInc) then ! reached "convergence"
terminallyIll = .false.
cycleCounter = -1 ! first calc step increments this to cycle = 0
@ -300,11 +347,11 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
!call mesh_build_ipCoordinates() ! update ip coordinates
endif
if (outdatedByNewInc) then
computationMode = ior(computationMode,CPFEM_AGERESULTS)
computationMode = ior(computationMode,materialpoint_AGERESULTS)
outdatedByNewInc = .false.
endif
if (lastIncConverged) then
computationMode = ior(computationMode,CPFEM_BACKUPJACOBIAN)
computationMode = ior(computationMode,materialpoint_BACKUPJACOBIAN)
lastIncConverged = .false.
endif
@ -315,7 +362,7 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, &
endif
lastLovl = lovl
call CPFEM_general(computationMode,ffn,ffn1,t(1),timinc,m(1),nn,stress,ddsdde)
call materialpoint_general(computationMode,ffn,ffn1,t(1),timinc,m(1),nn,stress,ddsdde)
d = ddsdde(1:ngens,1:ngens)
s = stress(1:ndi+nshear)
@ -333,7 +380,7 @@ end subroutine hypela2
subroutine flux(f,ts,n,time)
use prec
use homogenization
use discretization_marc
use discretization_Marc
implicit none
real(pReal), dimension(6), intent(in) :: &
@ -359,15 +406,15 @@ subroutine flux(f,ts,n,time)
!--------------------------------------------------------------------------------------------------
subroutine uedinc(inc,incsub)
use prec
use CPFEM
use discretization_marc
use materialpoint_Marc
use discretization_Marc
implicit none
integer, intent(in) :: inc, incsub
integer :: n, nqncomp, nqdatatype
integer, save :: inc_written
real(pReal), allocatable, dimension(:,:) :: d_n
#include QUOTE(PASTE(./Marc/include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment)
#include QUOTE(PASTE(include/creeps,MARC4DAMASK)) ! creeps is needed for timinc (time increment)
if (inc > inc_written) then
@ -379,8 +426,8 @@ subroutine uedinc(inc,incsub)
endif
enddo
call discretization_marc_UpdateNodeAndIpCoords(d_n)
call CPFEM_results(inc,cptim)
call discretization_Marc_UpdateNodeAndIpCoords(d_n)
call materialpoint_results(inc,cptim)
inc_written = inc
endif

View File

@ -136,7 +136,7 @@ end subroutine discretization_Marc_updateNodeAndIpCoords
!--------------------------------------------------------------------------------------------------
!> @brief Calculate and set current nodal and IP positions (including cell nodes)
!--------------------------------------------------------------------------------------------------
function discretization_marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell)
function discretization_Marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell)
integer, intent(in) :: IP_FEM, elem_FEM
integer :: cell
@ -147,7 +147,7 @@ function discretization_marc_FEM2DAMASK_cell(IP_FEM,elem_FEM) result(cell)
cell = (discretization_Marc_FEM2DAMASK_elem(elem_FEM)-1)*discretization_nIPs + IP_FEM
end function discretization_marc_FEM2DAMASK_cell
end function discretization_Marc_FEM2DAMASK_cell
!--------------------------------------------------------------------------------------------------
@ -1212,5 +1212,4 @@ logical function containsRange(str,chunkPos)
end function containsRange
end module discretization_Marc

View File

@ -1,9 +1,9 @@
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief CPFEM engine
!> @brief materialpoint engine
!--------------------------------------------------------------------------------------------------
module CPFEM
module materialpoint_Marc
use DAMASK_interface
use prec
use IO
@ -21,30 +21,30 @@ module CPFEM
use homogenization
use discretization
use discretization_marc
use discretization_Marc
implicit none
private
real(pReal), dimension (:,:,:), allocatable, private :: &
CPFEM_cs !< Cauchy stress
materialpoint_cs !< Cauchy stress
real(pReal), dimension (:,:,:,:), allocatable, private :: &
CPFEM_dcsdE !< Cauchy stress tangent
materialpoint_dcsdE !< Cauchy stress tangent
real(pReal), dimension (:,:,:,:), allocatable, private :: &
CPFEM_dcsdE_knownGood !< known good tangent
materialpoint_dcsdE_knownGood !< known good tangent
integer, public :: &
cycleCounter = 0 !< needs description
integer, parameter, public :: &
CPFEM_CALCRESULTS = 2**0, &
CPFEM_AGERESULTS = 2**1, &
CPFEM_BACKUPJACOBIAN = 2**2, &
CPFEM_RESTOREJACOBIAN = 2**3
materialpoint_CALCRESULTS = 2**0, &
materialpoint_AGERESULTS = 2**1, &
materialpoint_BACKUPJACOBIAN = 2**2, &
materialpoint_RESTOREJACOBIAN = 2**3
type, private :: tNumerics
integer :: &
iJacoStiffness !< frequency of stiffness update
iJacoStiffness !< frequency of stiffness update
end type tNumerics
type(tNumerics), private :: num
@ -59,12 +59,12 @@ module CPFEM
ip
end type tDebugOptions
type(tDebugOptions), private :: debugCPFEM
type(tDebugOptions), private :: debugmaterialpoint
public :: &
CPFEM_general, &
CPFEM_initAll, &
CPFEM_results
materialpoint_general, &
materialpoint_initAll, &
materialpoint_results
contains
@ -72,7 +72,7 @@ contains
!--------------------------------------------------------------------------------------------------
!> @brief Initialize all modules.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_initAll
subroutine materialpoint_initAll
call DAMASK_interface_init
call prec_init
@ -86,54 +86,54 @@ subroutine CPFEM_initAll
call rotations_init
call polynomials_init
call lattice_init
call discretization_marc_init
call discretization_Marc_init
call material_init(.false.)
call phase_init
call homogenization_init
call CPFEM_init
call materialpoint_init
call config_deallocate
end subroutine CPFEM_initAll
end subroutine materialpoint_initAll
!--------------------------------------------------------------------------------------------------
!> @brief allocate the arrays defined in module CPFEM and initialize them
!> @brief allocate the arrays defined in module materialpoint and initialize them
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_init
subroutine materialpoint_init
class(tNode), pointer :: &
debug_CPFEM
debug_materialpoint
print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT)
print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT)
allocate(CPFEM_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(CPFEM_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(CPFEM_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(materialpoint_cs( 6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(materialpoint_dcsdE( 6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
allocate(materialpoint_dcsdE_knownGood(6,6,discretization_nIPs,discretization_Nelems), source= 0.0_pReal)
!------------------------------------------------------------------------------
! read debug options
debug_CPFEM => config_debug%get('CPFEM',defaultVal=emptyList)
debugCPFEM%basic = debug_CPFEM%contains('basic')
debugCPFEM%extensive = debug_CPFEM%contains('extensive')
debugCPFEM%selective = debug_CPFEM%contains('selective')
debugCPFEM%element = config_debug%get_asInt('element',defaultVal = 1)
debugCPFEM%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1)
debug_materialpoint => config_debug%get('materialpoint',defaultVal=emptyList)
debugmaterialpoint%basic = debug_materialpoint%contains('basic')
debugmaterialpoint%extensive = debug_materialpoint%contains('extensive')
debugmaterialpoint%selective = debug_materialpoint%contains('selective')
debugmaterialpoint%element = config_debug%get_asInt('element',defaultVal = 1)
debugmaterialpoint%ip = config_debug%get_asInt('integrationpoint',defaultVal = 1)
if(debugCPFEM%basic) then
print'(a32,1x,6(i8,1x))', 'CPFEM_cs: ', shape(CPFEM_cs)
print'(a32,1x,6(i8,1x))', 'CPFEM_dcsdE: ', shape(CPFEM_dcsdE)
print'(a32,1x,6(i8,1x),/)', 'CPFEM_dcsdE_knownGood: ', shape(CPFEM_dcsdE_knownGood)
if(debugmaterialpoint%basic) then
print'(a32,1x,6(i8,1x))', 'materialpoint_cs: ', shape(materialpoint_cs)
print'(a32,1x,6(i8,1x))', 'materialpoint_dcsdE: ', shape(materialpoint_dcsdE)
print'(a32,1x,6(i8,1x),/)', 'materialpoint_dcsdE_knownGood: ', shape(materialpoint_dcsdE_knownGood)
flush(IO_STDOUT)
endif
end subroutine CPFEM_init
end subroutine materialpoint_init
!--------------------------------------------------------------------------------------------------
!> @brief perform initialization at first call, update variables and call the actual material model
!> @brief Update variables and call the material model.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian)
subroutine materialpoint_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian)
integer, intent(in) :: elFE, & !< FE element number
ip !< integration point number
@ -161,7 +161,7 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS
elCP = discretization_Marc_FEM2DAMASK_elem(elFE)
ce = discretization_Marc_FEM2DAMASK_cell(ip,elFE)
if (debugCPFEM%basic .and. elCP == debugCPFEM%element .and. ip == debugCPFEM%ip) then
if (debugmaterialpoint%basic .and. elCP == debugmaterialpoint%element .and. ip == debugmaterialpoint%ip) then
print'(/,a)', '#############################################'
print'(a1,a22,1x,i8,a13)', '#','element', elCP, '#'
print'(a1,a22,1x,i8,a13)', '#','ip', ip, '#'
@ -172,26 +172,26 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS
print'(a,/)', '#############################################'; flush (6)
endif
if (iand(mode, CPFEM_BACKUPJACOBIAN) /= 0) &
CPFEM_dcsde_knownGood = CPFEM_dcsde
if (iand(mode, CPFEM_RESTOREJACOBIAN) /= 0) &
CPFEM_dcsde = CPFEM_dcsde_knownGood
if (iand(mode, materialpoint_BACKUPJACOBIAN) /= 0) &
materialpoint_dcsde_knownGood = materialpoint_dcsde
if (iand(mode, materialpoint_RESTOREJACOBIAN) /= 0) &
materialpoint_dcsde = materialpoint_dcsde_knownGood
if (iand(mode, CPFEM_AGERESULTS) /= 0) call CPFEM_forward
if (iand(mode, materialpoint_AGERESULTS) /= 0) call materialpoint_forward
homogenization_F0(1:3,1:3,ce) = ffn
homogenization_F(1:3,1:3,ce) = ffn1
if (iand(mode, CPFEM_CALCRESULTS) /= 0) then
if (iand(mode, materialpoint_CALCRESULTS) /= 0) then
validCalculation: if (terminallyIll) then
call random_number(rnd)
if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal
CPFEM_cs(1:6,ip,elCP) = ODD_STRESS * rnd
CPFEM_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6)
materialpoint_cs(1:6,ip,elCP) = ODD_STRESS * rnd
materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6)
else validCalculation
if (debugCPFEM%extensive) print'(a,i8,1x,i2)', '<< CPFEM >> calculation for elFE ip ',elFE,ip
if (debugmaterialpoint%extensive) print'(a,i8,1x,i2)', '<< materialpoint >> calculation for elFE ip ',elFE,ip
call homogenization_mechanical_response(dt,(elCP-1)*discretization_nIPs + ip,(elCP-1)*discretization_nIPs + ip)
if (.not. terminallyIll) &
call homogenization_mechanical_response2(dt,[ip,ip],[elCP,elCP])
@ -200,15 +200,15 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS
call random_number(rnd)
if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal
CPFEM_cs(1:6,ip,elCP) = ODD_STRESS * rnd
CPFEM_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6)
materialpoint_cs(1:6,ip,elCP) = ODD_STRESS * rnd
materialpoint_dcsde(1:6,1:6,ip,elCP) = ODD_JACOBIAN * math_eye(6)
else terminalIllness
! translate from P to sigma
Kirchhoff = matmul(homogenization_P(1:3,1:3,ce), transpose(homogenization_F(1:3,1:3,ce)))
J_inverse = 1.0_pReal / math_det33(homogenization_F(1:3,1:3,ce))
CPFEM_cs(1:6,ip,elCP) = math_sym33to6(J_inverse * Kirchhoff,weighted=.false.)
materialpoint_cs(1:6,ip,elCP) = math_sym33to6(J_inverse * Kirchhoff,weighted=.false.)
! translate from dP/dF to dCS/dE
H = 0.0_pReal
@ -224,45 +224,45 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS
forall(i=1:3, j=1:3,k=1:3,l=1:3) &
H_sym(i,j,k,l) = 0.25_pReal * (H(i,j,k,l) + H(j,i,k,l) + H(i,j,l,k) + H(j,i,l,k))
CPFEM_dcsde(1:6,1:6,ip,elCP) = math_sym3333to66(J_inverse * H_sym,weighted=.false.)
materialpoint_dcsde(1:6,1:6,ip,elCP) = math_sym3333to66(J_inverse * H_sym,weighted=.false.)
endif terminalIllness
endif validCalculation
if (debugCPFEM%extensive &
.and. ((debugCPFEM%element == elCP .and. debugCPFEM%ip == ip) .or. .not. debugCPFEM%selective)) then
if (debugmaterialpoint%extensive &
.and. ((debugmaterialpoint%element == elCP .and. debugmaterialpoint%ip == ip) .or. .not. debugmaterialpoint%selective)) then
print'(a,i8,1x,i2,/,12x,6(f10.3,1x)/)', &
'<< CPFEM >> stress/MPa at elFE ip ', elFE, ip, CPFEM_cs(1:6,ip,elCP)*1.0e-6_pReal
'<< materialpoint >> stress/MPa at elFE ip ', elFE, ip, materialpoint_cs(1:6,ip,elCP)*1.0e-6_pReal
print'(a,i8,1x,i2,/,6(12x,6(f10.3,1x)/))', &
'<< CPFEM >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(CPFEM_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal
'<< materialpoint >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(materialpoint_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal
flush(IO_STDOUT)
endif
endif
if (all(abs(CPFEM_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip)
if (all(abs(materialpoint_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip)
cauchyStress = CPFEM_cs (1:6, ip,elCP)
jacobian = CPFEM_dcsdE(1:6,1:6,ip,elCP)
cauchyStress = materialpoint_cs (1:6, ip,elCP)
jacobian = materialpoint_dcsdE(1:6,1:6,ip,elCP)
end subroutine CPFEM_general
end subroutine materialpoint_general
!--------------------------------------------------------------------------------------------------
!> @brief Forward data for new time increment.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_forward
subroutine materialpoint_forward
call homogenization_forward
call phase_forward
end subroutine CPFEM_forward
end subroutine materialpoint_forward
!--------------------------------------------------------------------------------------------------
!> @brief Trigger writing of results.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_results(inc,time)
subroutine materialpoint_results(inc,time)
integer, intent(in) :: inc
real(pReal), intent(in) :: time
@ -275,6 +275,6 @@ subroutine CPFEM_results(inc,time)
call results_finalizeIncrement
call results_closeJobFile
end subroutine CPFEM_results
end subroutine materialpoint_results
end module CPFEM
end module materialpoint_Marc

View File

@ -1,54 +0,0 @@
!--------------------------------------------------------------------------------------------------
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief all DAMASK files without solver
!> @details List of files needed by MSC.Marc
!--------------------------------------------------------------------------------------------------
#include "parallelization.f90"
#include "constants.f90"
#include "IO.f90"
#include "YAML_types.f90"
#include "YAML_parse.f90"
#include "HDF5_utilities.f90"
#include "results.f90"
#include "config.f90"
#include "LAPACK_interface.f90"
#include "math.f90"
#include "rotations.f90"
#include "polynomials.f90"
#include "lattice.f90"
#include "element.f90"
#include "geometry_plastic_nonlocal.f90"
#include "discretization.f90"
#include "Marc/discretization_Marc.f90"
#include "material.f90"
#include "phase.f90"
#include "phase_mechanical.f90"
#include "phase_mechanical_elastic.f90"
#include "phase_mechanical_plastic.f90"
#include "phase_mechanical_plastic_none.f90"
#include "phase_mechanical_plastic_isotropic.f90"
#include "phase_mechanical_plastic_phenopowerlaw.f90"
#include "phase_mechanical_plastic_kinehardening.f90"
#include "phase_mechanical_plastic_dislotwin.f90"
#include "phase_mechanical_plastic_dislotungsten.f90"
#include "phase_mechanical_plastic_nonlocal.f90"
#include "phase_mechanical_eigen.f90"
#include "phase_mechanical_eigen_cleavageopening.f90"
#include "phase_mechanical_eigen_thermalexpansion.f90"
#include "phase_thermal.f90"
#include "phase_thermal_dissipation.f90"
#include "phase_thermal_externalheat.f90"
#include "phase_damage.f90"
#include "phase_damage_isobrittle.f90"
#include "phase_damage_anisobrittle.f90"
#include "homogenization.f90"
#include "homogenization_mechanical.f90"
#include "homogenization_mechanical_pass.f90"
#include "homogenization_mechanical_isostrain.f90"
#include "homogenization_mechanical_RGC.f90"
#include "homogenization_thermal.f90"
#include "homogenization_thermal_pass.f90"
#include "homogenization_thermal_isotemperature.f90"
#include "homogenization_damage.f90"
#include "homogenization_damage_pass.f90"
#include "CPFEM.f90"

View File

@ -20,7 +20,7 @@ program DAMASK_grid
use IO
use config
use math
use CPFEM2
use materialpoint
use material
use spectral_utilities
use grid_mechanical_spectral_basic
@ -117,7 +117,7 @@ program DAMASK_grid
!--------------------------------------------------------------------------------------------------
! init DAMASK (all modules)
call CPFEM_initAll
call materialpoint_initAll()
print'(/,1x,a)', '<<<+- DAMASK_grid init -+>>>'; flush(IO_STDOUT)
print'(/,1x,a)', 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019'
@ -327,7 +327,7 @@ program DAMASK_grid
writeUndeformed: if (CLI_restartInc < 1) then
print'(/,1x,a)', '... writing initial configuration to file .................................'
flush(IO_STDOUT)
call CPFEM_results(0,0.0_pReal)
call materialpoint_results(0,0.0_pReal)
endif writeUndeformed
loadCaseLooping: do l = 1, size(loadCases)
@ -387,7 +387,7 @@ program DAMASK_grid
case(FIELD_DAMAGE_ID); call grid_damage_spectral_forward(cutBack)
end select
enddo
if (.not. cutBack) call CPFEM_forward
if (.not. cutBack) call materialpoint_forward
!--------------------------------------------------------------------------------------------------
! solve fields
@ -454,7 +454,7 @@ program DAMASK_grid
if (mod(inc,loadCases(l)%f_out) == 0 .or. signal) then
print'(/,1x,a)', '... writing results to file ...............................................'
flush(IO_STDOUT)
call CPFEM_results(totalIncsCounter,t)
call materialpoint_results(totalIncsCounter,t)
endif
if (signal) call signals_setSIGUSR1(.false.)
call MPI_Allreduce(signals_SIGUSR2,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
@ -468,7 +468,7 @@ program DAMASK_grid
call grid_thermal_spectral_restartWrite
end select
end do
call CPFEM_restartWrite
call materialpoint_restartWrite
endif
if (signal) call signals_setSIGUSR2(.false.)
call MPI_Allreduce(signals_SIGTERM,signal,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)

View File

@ -1966,8 +1966,8 @@ end function buildCoordinateSystem
!--------------------------------------------------------------------------------------------------
!> @brief Helper function to define transformation systems
! Needed to calculate Schmid matrix and rotated stiffness matrices.
! @details: use c/a for cF -> cI transformation
! use a_cX for cF -> hP transformation
! @details: use c/a for cF -> hP transformation
! use a_cX for cF -> cI transformation
!--------------------------------------------------------------------------------------------------
subroutine buildTransformationSystem(Q,S,Ntrans,cOverA,a_cF,a_cI)

View File

@ -3,7 +3,7 @@
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief needs a good name and description
!--------------------------------------------------------------------------------------------------
module CPFEM2
module materialpoint
use parallelization
use signals
use CLI
@ -40,7 +40,7 @@ contains
!--------------------------------------------------------------------------------------------------
!> @brief Initialize all modules.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_initAll
subroutine materialpoint_initAll
call parallelization_init
call CLI_init ! Spectral and FEM interface to commandline
@ -69,21 +69,21 @@ subroutine CPFEM_initAll
call material_init(restart=CLI_restartInc>0)
call phase_init
call homogenization_init
call CPFEM_init
call materialpoint_init
call config_deallocate
end subroutine CPFEM_initAll
end subroutine materialpoint_initAll
!--------------------------------------------------------------------------------------------------
!> @brief Read restart information if needed.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_init
subroutine materialpoint_init
integer(HID_T) :: fileHandle
print'(/,1x,a)', '<<<+- CPFEM init -+>>>'; flush(IO_STDOUT)
print'(/,1x,a)', '<<<+- materialpoint init -+>>>'; flush(IO_STDOUT)
if (CLI_restartInc > 0) then
@ -97,13 +97,13 @@ subroutine CPFEM_init
call HDF5_closeFile(fileHandle)
endif
end subroutine CPFEM_init
end subroutine materialpoint_init
!--------------------------------------------------------------------------------------------------
!> @brief Write restart information.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_restartWrite
subroutine materialpoint_restartWrite
integer(HID_T) :: fileHandle
@ -117,24 +117,24 @@ subroutine CPFEM_restartWrite
call HDF5_closeFile(fileHandle)
end subroutine CPFEM_restartWrite
end subroutine materialpoint_restartWrite
!--------------------------------------------------------------------------------------------------
!> @brief Forward data for new time increment.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_forward
subroutine materialpoint_forward
call homogenization_forward
call phase_forward
end subroutine CPFEM_forward
end subroutine materialpoint_forward
!--------------------------------------------------------------------------------------------------
!> @brief Trigger writing of results.
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_results(inc,time)
subroutine materialpoint_results(inc,time)
integer, intent(in) :: inc
real(pReal), intent(in) :: time
@ -147,6 +147,6 @@ subroutine CPFEM_results(inc,time)
call results_finalizeIncrement
call results_closeJobFile
end subroutine CPFEM_results
end subroutine materialpoint_results
end module CPFEM2
end module materialpoint

View File

@ -127,8 +127,10 @@ pure recursive subroutine math_sort(a, istart, iend, sortDim)
integer, dimension(:,:), intent(inout) :: a
integer, intent(in),optional :: istart,iend, sortDim
integer :: ipivot,s,e,d
if (present(istart)) then
s = istart
else
@ -164,9 +166,11 @@ pure recursive subroutine math_sort(a, istart, iend, sortDim)
integer, dimension(:,:), intent(inout) :: a
integer, intent(out) :: p ! Pivot element
integer, intent(in) :: istart,iend,sort
integer, dimension(size(a,1)) :: tmp
integer, dimension(size(a,1)) :: tmp
integer :: i,j
do
! find the first element on the right side less than or equal to the pivot point
do j = iend, istart, -1
@ -204,8 +208,10 @@ pure function math_expand(what,how)
real(pReal), dimension(:), intent(in) :: what
integer, dimension(:), intent(in) :: how
real(pReal), dimension(sum(how)) :: math_expand
integer :: i
if (sum(how) == 0) return
do i = 1, size(how)
@ -221,9 +227,11 @@ end function math_expand
pure function math_range(N)
integer, intent(in) :: N !< length of range
integer :: i
integer, dimension(N) :: math_range
integer :: i
math_range = [(i,i=1,N)]
end function math_range
@ -235,9 +243,11 @@ end function math_range
pure function math_eye(d)
integer, intent(in) :: d !< tensor dimension
integer :: i
real(pReal), dimension(d,d) :: math_eye
integer :: i
math_eye = 0.0_pReal
do i=1,d
math_eye(i,i) = 1.0_pReal
@ -302,6 +312,7 @@ real(pReal) pure function math_delta(i,j)
integer, intent (in) :: i,j
math_delta = merge(0.0_pReal, 1.0_pReal, i /= j)
end function math_delta
@ -315,6 +326,7 @@ pure function math_cross(A,B)
real(pReal), dimension(3), intent(in) :: A,B
real(pReal), dimension(3) :: math_cross
math_cross = [ A(2)*B(3) -A(3)*B(2), &
A(3)*B(1) -A(1)*B(3), &
A(1)*B(2) -A(2)*B(1) ]
@ -329,6 +341,7 @@ pure function math_outer(A,B)
real(pReal), dimension(:), intent(in) :: A,B
real(pReal), dimension(size(A,1),size(B,1)) :: math_outer
integer :: i,j
@ -351,6 +364,7 @@ real(pReal) pure function math_inner(A,B)
real(pReal), dimension(:), intent(in) :: A
real(pReal), dimension(size(A,1)), intent(in) :: B
math_inner = sum(A*B)
end function math_inner
@ -363,6 +377,7 @@ real(pReal) pure function math_tensordot(A,B)
real(pReal), dimension(3,3), intent(in) :: A,B
math_tensordot = sum(A*B)
end function math_tensordot
@ -376,6 +391,7 @@ pure function math_mul3333xx33(A,B)
real(pReal), dimension(3,3,3,3), intent(in) :: A
real(pReal), dimension(3,3), intent(in) :: B
real(pReal), dimension(3,3) :: math_mul3333xx33
integer :: i,j
@ -395,11 +411,12 @@ end function math_mul3333xx33
!--------------------------------------------------------------------------------------------------
pure function math_mul3333xx3333(A,B)
integer :: i,j,k,l
real(pReal), dimension(3,3,3,3), intent(in) :: A
real(pReal), dimension(3,3,3,3), intent(in) :: B
real(pReal), dimension(3,3,3,3) :: math_mul3333xx3333
integer :: i,j,k,l
#ifndef __INTEL_COMPILER
do concurrent(i=1:3, j=1:3, k=1:3, l=1:3)
@ -424,6 +441,7 @@ pure function math_exp33(A,n)
real(pReal) :: invFac
integer :: n_,i
if (present(n)) then
n_ = n
else
@ -456,6 +474,7 @@ pure function math_inv33(A)
real(pReal) :: DetA
logical :: error
call math_invert33(math_inv33,DetA,error,A)
if (error) math_inv33 = 0.0_pReal
@ -474,6 +493,7 @@ pure subroutine math_invert33(InvA, DetA, error, A)
logical, intent(out) :: error
real(pReal), dimension(3,3), intent(in) :: A
InvA(1,1) = A(2,2) * A(3,3) - A(2,3) * A(3,2)
InvA(2,1) = -A(2,1) * A(3,3) + A(2,3) * A(3,1)
InvA(3,1) = A(2,1) * A(3,2) - A(2,2) * A(3,1)
@ -504,7 +524,7 @@ end subroutine math_invert33
!--------------------------------------------------------------------------------------------------
pure function math_invSym3333(A)
real(pReal),dimension(3,3,3,3) :: math_invSym3333
real(pReal),dimension(3,3,3,3) :: math_invSym3333
real(pReal),dimension(3,3,3,3),intent(in) :: A
@ -513,6 +533,7 @@ pure function math_invSym3333(A)
real(pReal), dimension(6*6) :: work
integer :: ierr_i, ierr_f
temp66 = math_sym3333to66(A)
call dgetrf(6,6,temp66,6,ipiv6,ierr_i)
call dgetri(6,temp66,6,ipiv6,work,size(work,1),ierr_f)
@ -538,6 +559,7 @@ pure subroutine math_invert(InvA, error, A)
real(pReal), dimension(size(A,1)**2) :: work
integer :: ierr
invA = A
call dgetrf(size(A,1),size(A,1),invA,size(A,1),ipiv,ierr)
error = (ierr /= 0)
@ -555,6 +577,7 @@ pure function math_symmetric33(m)
real(pReal), dimension(3,3) :: math_symmetric33
real(pReal), dimension(3,3), intent(in) :: m
math_symmetric33 = 0.5_pReal * (m + transpose(m))
end function math_symmetric33
@ -568,6 +591,7 @@ pure function math_skew33(m)
real(pReal), dimension(3,3) :: math_skew33
real(pReal), dimension(3,3), intent(in) :: m
math_skew33 = m - math_symmetric33(m)
end function math_skew33
@ -581,6 +605,7 @@ pure function math_spherical33(m)
real(pReal), dimension(3,3) :: math_spherical33
real(pReal), dimension(3,3), intent(in) :: m
math_spherical33 = math_I3 * math_trace33(m)/3.0_pReal
end function math_spherical33
@ -594,6 +619,7 @@ pure function math_deviatoric33(m)
real(pReal), dimension(3,3) :: math_deviatoric33
real(pReal), dimension(3,3), intent(in) :: m
math_deviatoric33 = m - math_spherical33(m)
end function math_deviatoric33
@ -606,6 +632,7 @@ real(pReal) pure function math_trace33(m)
real(pReal), dimension(3,3), intent(in) :: m
math_trace33 = m(1,1) + m(2,2) + m(3,3)
end function math_trace33
@ -618,6 +645,7 @@ real(pReal) pure function math_det33(m)
real(pReal), dimension(3,3), intent(in) :: m
math_det33 = m(1,1)* (m(2,2)*m(3,3)-m(2,3)*m(3,2)) &
- m(1,2)* (m(2,1)*m(3,3)-m(2,3)*m(3,1)) &
+ m(1,3)* (m(2,1)*m(3,2)-m(2,2)*m(3,1))
@ -632,6 +660,7 @@ real(pReal) pure function math_detSym33(m)
real(pReal), dimension(3,3), intent(in) :: m
math_detSym33 = -(m(1,1)*m(2,3)**2 + m(2,2)*m(1,3)**2 + m(3,3)*m(1,2)**2) &
+ m(1,1)*m(2,2)*m(3,3) + 2.0_pReal * m(1,2)*m(1,3)*m(2,3)
@ -761,6 +790,7 @@ pure function math_99to3333(m99)
integer :: i,j
#ifndef __INTEL_COMPILER
do concurrent(i=1:9, j=1:9)
math_99to3333(MAPPLAIN(1,i),MAPPLAIN(2,i),MAPPLAIN(1,j),MAPPLAIN(2,j)) = m99(i,j)
@ -1012,6 +1042,7 @@ pure subroutine math_eigh33(w,v,m)
real(pReal) :: T, U, norm, threshold
logical :: error
w = math_eigvalsh33(m)
v(1:3,2) = [ m(1, 2) * m(2, 3) - m(1, 3) * m(2, 2), &
@ -1066,6 +1097,7 @@ pure function math_rotationalPart(F) result(R)
I_F ! first two invariants of F
real(pReal) :: x,Phi
C = matmul(transpose(F),F)
I_C = math_invariantsSym33(C)
I_F = [math_trace33(F), 0.5*(math_trace33(F)**2 - math_trace33(matmul(F,F)))]
@ -1105,6 +1137,7 @@ pure function math_eigvalsh(m)
integer :: ierr
real(pReal), dimension(size(m,1)**2) :: work
m_= m ! copy matrix to input (will be destroyed)
call dsyev('N','U',size(m,1),m_,size(m,1),math_eigvalsh,work,size(work,1),ierr)
if (ierr /= 0) math_eigvalsh = IEEE_value(1.0_pReal,IEEE_quiet_NaN)
@ -1126,6 +1159,7 @@ pure function math_eigvalsh33(m)
real(pReal) :: P, Q, rho, phi
real(pReal), parameter :: TOL=1.e-14_pReal
I = math_invariantsSym33(m) ! invariants are coefficients in characteristic polynomial apart for the sign of c0 and c2 in http://arxiv.org/abs/physics/0610206
P = I(2)-I(1)**2/3.0_pReal ! different from http://arxiv.org/abs/physics/0610206 (this formulation was in DAMASK)
@ -1157,6 +1191,7 @@ pure function math_invariantsSym33(m)
real(pReal), dimension(3,3), intent(in) :: m
real(pReal), dimension(3) :: math_invariantsSym33
math_invariantsSym33(1) = math_trace33(m)
math_invariantsSym33(2) = m(1,1)*m(2,2) + m(1,1)*m(3,3) + m(2,2)*m(3,3) &
-(m(1,2)**2 + m(1,3)**2 + m(2,3)**2)

View File

@ -14,7 +14,7 @@ program DAMASK_mesh
use parallelization
use IO
use math
use CPFEM2
use materialpoint
use config
use discretization_mesh
use FEM_Utilities
@ -85,7 +85,7 @@ program DAMASK_mesh
!--------------------------------------------------------------------------------------------------
! init DAMASK (all modules)
call CPFEM_initAll
call materialpoint_initAll()
print'(/,1x,a)', '<<<+- DAMASK_mesh init -+>>>'; flush(IO_STDOUT)
!---------------------------------------------------------------------
@ -239,7 +239,7 @@ program DAMASK_mesh
print'(/,1x,a)', '... writing initial configuration to file .................................'
flush(IO_STDOUT)
call CPFEM_results(0,0.0_pReal)
call materialpoint_results(0,0.0_pReal)
loadCaseLooping: do currentLoadCase = 1, size(loadCases)
time0 = time ! load case start time
@ -325,7 +325,7 @@ program DAMASK_mesh
if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0) then ! at output frequency
print'(/,1x,a)', '... writing results to file ...............................................'
call FEM_mechanical_updateCoords
call CPFEM_results(totalIncsCounter,time)
call materialpoint_results(totalIncsCounter,time)
end if