use rotation class for consistent handling of rotations

This commit is contained in:
Martin Diehl 2019-12-02 16:37:22 +01:00
parent be099e38c2
commit 83453d10ef
2 changed files with 12 additions and 15 deletions

View File

@ -28,7 +28,6 @@ program DAMASK_spectral
use grid_damage_spectral use grid_damage_spectral
use grid_thermal_spectral use grid_thermal_spectral
use results use results
use rotations
implicit none implicit none
@ -78,7 +77,6 @@ program DAMASK_spectral
character(len=6) :: loadcase_string character(len=6) :: loadcase_string
character(len=1024) :: & character(len=1024) :: &
incInfo incInfo
type(rotation) :: R
type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases
type(tLoadCase) :: newLoadCase type(tLoadCase) :: newLoadCase
type(tSolutionState), allocatable, dimension(:) :: solres type(tSolutionState), allocatable, dimension(:) :: solres
@ -189,6 +187,7 @@ program DAMASK_spectral
newLoadCase%ID(field) = FIELD_DAMAGE_ID newLoadCase%ID(field) = FIELD_DAMAGE_ID
endif damageActive endif damageActive
call newLoadCase%rot%fromEulers(real([0.0,0.0,0.0],pReal))
readIn: do i = 1, chunkPos(1) readIn: do i = 1, chunkPos(1)
select case (IO_lc(IO_stringValue(line,chunkPos,i))) select case (IO_lc(IO_stringValue(line,chunkPos,i)))
case('fdot','dotf','l','f') ! assign values for the deformation BC matrix case('fdot','dotf','l','f') ! assign values for the deformation BC matrix
@ -244,14 +243,13 @@ program DAMASK_spectral
do j = 1, 3 do j = 1, 3
temp_valueVector(j) = IO_floatValue(line,chunkPos,i+k+j) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+k+j)
enddo enddo
call R%fromEulers(temp_valueVector(1:3),degrees=(l==1)) call newLoadCase%rot%fromEulers(temp_valueVector(1:3),degrees=(l==1))
newLoadCase%rotation = R%asMatrix()
case('rotation','rot') ! assign values for the rotation matrix case('rotation','rot') ! assign values for the rotation matrix
temp_valueVector = 0.0_pReal temp_valueVector = 0.0_pReal
do j = 1, 9 do j = 1, 9
temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j)
enddo enddo
newLoadCase%rotation = math_9to33(temp_valueVector) call newLoadCase%rot%fromMatrix(math_9to33(temp_valueVector))
end select end select
enddo readIn enddo readIn
@ -295,14 +293,12 @@ program DAMASK_spectral
endif endif
enddo; write(6,'(/)',advance='no') enddo; write(6,'(/)',advance='no')
enddo enddo
if (any(abs(matmul(newLoadCase%rotation, & if (any(abs(matmul(newLoadCase%rot%asMatrix(), &
transpose(newLoadCase%rotation))-math_I3) > & transpose(newLoadCase%rot%asMatrix()))-math_I3) > &
reshape(spread(tol_math_check,1,9),[ 3,3]))& reshape(spread(tol_math_check,1,9),[ 3,3]))) errorID = 846 ! given rotation matrix contains strain
.or. abs(math_det33(newLoadCase%rotation)) > & if (any(dNeq(newLoadCase%rot%asMatrix(), math_I3))) &
1.0_pReal + tol_math_check) errorID = 846 ! given rotation matrix contains strain
if (any(dNeq(newLoadCase%rotation, math_I3))) &
write(6,'(2x,a,/,3(3(3x,f12.7,1x)/))',advance='no') 'rotation of loadframe:',& write(6,'(2x,a,/,3(3(3x,f12.7,1x)/))',advance='no') 'rotation of loadframe:',&
transpose(newLoadCase%rotation) transpose(newLoadCase%rot%asMatrix())
if (newLoadCase%time < 0.0_pReal) errorID = 834 ! negative time increment if (newLoadCase%time < 0.0_pReal) errorID = 834 ! negative time increment
write(6,'(2x,a,f12.6)') 'time: ', newLoadCase%time write(6,'(2x,a,f12.6)') 'time: ', newLoadCase%time
if (newLoadCase%incs < 1) errorID = 835 ! non-positive incs count if (newLoadCase%incs < 1) errorID = 835 ! non-positive incs count
@ -469,7 +465,7 @@ program DAMASK_spectral
cutBack,guess,timeinc,timeIncOld,remainingLoadCaseTime, & cutBack,guess,timeinc,timeIncOld,remainingLoadCaseTime, &
deformation_BC = loadCases(currentLoadCase)%deformation, & deformation_BC = loadCases(currentLoadCase)%deformation, &
stress_BC = loadCases(currentLoadCase)%stress, & stress_BC = loadCases(currentLoadCase)%stress, &
rotation_BC = loadCases(currentLoadCase)%rotation) rotation_BC = loadCases(currentLoadCase)%rot%asMatrix())
case(FIELD_THERMAL_ID); call grid_thermal_spectral_forward(cutBack) case(FIELD_THERMAL_ID); call grid_thermal_spectral_forward(cutBack)
case(FIELD_DAMAGE_ID); call grid_damage_spectral_forward(cutBack) case(FIELD_DAMAGE_ID); call grid_damage_spectral_forward(cutBack)
@ -488,7 +484,7 @@ program DAMASK_spectral
solres(field) = mech_solution (& solres(field) = mech_solution (&
incInfo,timeinc,timeIncOld, & incInfo,timeinc,timeIncOld, &
stress_BC = loadCases(currentLoadCase)%stress, & stress_BC = loadCases(currentLoadCase)%stress, &
rotation_BC = loadCases(currentLoadCase)%rotation) rotation_BC = loadCases(currentLoadCase)%rot%asMatrix())
case(FIELD_THERMAL_ID) case(FIELD_THERMAL_ID)
solres(field) = grid_thermal_spectral_solution(timeinc,timeIncOld) solres(field) = grid_thermal_spectral_solution(timeinc,timeIncOld)

View File

@ -10,6 +10,7 @@ module spectral_utilities
use prec use prec
use math use math
use rotations
use IO use IO
use mesh_grid use mesh_grid
use numerics use numerics
@ -90,7 +91,7 @@ module spectral_utilities
end type tBoundaryCondition end type tBoundaryCondition
type, public :: tLoadCase type, public :: tLoadCase
real(pReal), dimension (3,3) :: rotation = math_I3 !< rotation of BC type(rotation) :: rot !< rotation of BC
type(tBoundaryCondition) :: stress, & !< stress BC type(tBoundaryCondition) :: stress, & !< stress BC
deformation !< deformation BC (Fdot or L) deformation !< deformation BC (Fdot or L)
real(pReal) :: time = 0.0_pReal !< length of increment real(pReal) :: time = 0.0_pReal !< length of increment