simplifying
This commit is contained in:
parent
f25f7ad01e
commit
96243a4ac8
|
@ -31,10 +31,6 @@ program DAMASK_grid
|
|||
! variables related to information from load case and geom file
|
||||
real(pReal), dimension(9) :: temp_valueVector = 0.0_pReal !< temporarily from loadcase file when reading in tensors (initialize to 0.0)
|
||||
logical, dimension(9) :: temp_maskVector = .false. !< temporarily from loadcase file when reading in tensors
|
||||
integer :: &
|
||||
N_t = 0, & !< # of time indicators found in load case file
|
||||
N_n = 0, & !< # of increment specifiers found in load case file
|
||||
N_def = 0 !< # of rate of deformation specifiers found in load case file
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! loop variables, convergence etc.
|
||||
|
@ -59,7 +55,7 @@ program DAMASK_grid
|
|||
cutBackLevel = 0, & !< cut back level \f$ t = \frac{t_{inc}}{2^l} \f$
|
||||
stepFraction = 0 !< fraction of current time interval
|
||||
integer :: &
|
||||
currentLoadcase = 0, & !< current load case
|
||||
l = 0, & !< current load case
|
||||
inc, & !< current increment in current load case
|
||||
totalIncsCounter = 0, & !< total # of increments
|
||||
statUnit = 0, & !< file unit for statistics output
|
||||
|
@ -72,7 +68,6 @@ program DAMASK_grid
|
|||
maxCutBack, & !< max number of cut backs
|
||||
stagItMax !< max number of field level staggered iterations
|
||||
type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases
|
||||
type(tLoadCase) :: newLoadCase
|
||||
type(tSolutionState), allocatable, dimension(:) :: solres
|
||||
procedure(grid_mech_spectral_basic_init), pointer :: &
|
||||
mech_init
|
||||
|
@ -113,7 +108,6 @@ program DAMASK_grid
|
|||
if (any(thermal_type == THERMAL_conduction_ID )) nActiveFields = nActiveFields + 1
|
||||
if (any(damage_type == DAMAGE_nonlocal_ID )) nActiveFields = nActiveFields + 1
|
||||
allocate(solres(nActiveFields))
|
||||
allocate(newLoadCase%ID(nActiveFields))
|
||||
|
||||
!-------------------------------------------------------------------------------------------------
|
||||
! reading field paramters from numerics file and do sanity checks
|
||||
|
@ -167,51 +161,37 @@ program DAMASK_grid
|
|||
load_steps => config_load%get('step')
|
||||
allocate(loadCases(load_steps%length)) ! array of load cases
|
||||
|
||||
do currentLoadCase = 1, load_steps%length
|
||||
load_step => load_steps%get(currentLoadCase)
|
||||
step_mech => load_step%get('mech')
|
||||
step_discretization => load_step%get('discretization')
|
||||
do m = 1, step_mech%length
|
||||
select case (step_mech%getKey(m))
|
||||
case('L','dot_F','F')
|
||||
N_def = N_def + 1
|
||||
end select
|
||||
enddo
|
||||
if(step_discretization%contains('t')) N_t = N_t + 1
|
||||
if(step_discretization%contains('N')) N_n = N_n + 1
|
||||
if ((N_def /= N_n) .or. (N_n /= N_t) .or. N_n < 1) & ! sanity check
|
||||
call IO_error(error_ID=837,el=currentLoadCase,ext_msg = trim(interface_loadFile)) ! error message for incomplete loadcase
|
||||
do l = 1, load_steps%length
|
||||
|
||||
newLoadCase%stress%myType='P'
|
||||
allocate(loadCases(l)%ID(nActiveFields))
|
||||
field = 1
|
||||
newLoadCase%ID(field) = FIELD_MECH_ID ! mechanical active by default
|
||||
loadCases(l)%ID(field) = FIELD_MECH_ID ! mechanical active by default
|
||||
thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then
|
||||
field = field + 1
|
||||
newLoadCase%ID(field) = FIELD_THERMAL_ID
|
||||
loadCases(l)%ID(field) = FIELD_THERMAL_ID
|
||||
endif thermalActive
|
||||
damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then
|
||||
field = field + 1
|
||||
newLoadCase%ID(field) = FIELD_DAMAGE_ID
|
||||
loadCases(l)%ID(field) = FIELD_DAMAGE_ID
|
||||
endif damageActive
|
||||
|
||||
load_step => load_steps%get(l)
|
||||
|
||||
step_mech => load_step%get('mech')
|
||||
loadCases(l)%stress%myType='P'
|
||||
readMech: do m = 1, step_mech%length
|
||||
select case (step_mech%getKey(m))
|
||||
case('dot_F','L','F') ! assign values for the deformation BC matrix
|
||||
loadCases(l)%deformation%myType = step_mech%getKey(m)
|
||||
temp_valueVector = 0.0_pReal
|
||||
if (step_mech%getKey(m) == 'dot_F') then ! in case of dot_F, set type to dot_F
|
||||
newLoadCase%deformation%myType = 'dot_F'
|
||||
else if (step_mech%getKey(m) == 'F') then
|
||||
newLoadCase%deformation%myType = 'F'
|
||||
else
|
||||
newLoadCase%deformation%myType = 'L'
|
||||
endif
|
||||
|
||||
step_deformation => step_mech%get(m)
|
||||
do j = 1, 9
|
||||
temp_maskVector(j) = step_deformation%get_asString(j) /= 'x' ! true if not a 'x'
|
||||
if (temp_maskVector(j)) temp_valueVector(j) = step_deformation%get_asFloat(j) ! read value where applicable
|
||||
enddo
|
||||
newLoadCase%deformation%mask = transpose(reshape(temp_maskVector,[ 3,3])) ! mask in 3x3 notation
|
||||
newLoadCase%deformation%values = math_9to33(temp_valueVector) ! values in 3x3 notation
|
||||
loadCases(l)%deformation%mask = transpose(reshape(temp_maskVector,[ 3,3])) ! mask in 3x3 notation
|
||||
loadCases(l)%deformation%values = math_9to33(temp_valueVector) ! values in 3x3 notation
|
||||
case('P')
|
||||
temp_valueVector = 0.0_pReal
|
||||
step_stress => step_mech%get(m)
|
||||
|
@ -219,80 +199,76 @@ program DAMASK_grid
|
|||
temp_maskVector(j) = step_stress%get_asString(j) /= 'x' ! true if not a 'x'
|
||||
if (temp_maskVector(j)) temp_valueVector(j) = step_stress%get_asFloat(j) ! read value where applicable
|
||||
enddo
|
||||
newLoadCase%stress%mask = transpose(reshape(temp_maskVector,[ 3,3]))
|
||||
newLoadCase%stress%values = math_9to33(temp_valueVector)
|
||||
loadCases(l)%stress%mask = transpose(reshape(temp_maskVector,[ 3,3]))
|
||||
loadCases(l)%stress%values = math_9to33(temp_valueVector)
|
||||
end select
|
||||
call newLoadCase%rot%fromAxisAngle(step_mech%get_asFloats('R', &
|
||||
call loadCases(l)%rot%fromAxisAngle(step_mech%get_asFloats('R', &
|
||||
defaultVal = real([0.0,0.0,1.0,0.0],pReal)),degrees=.true.)
|
||||
|
||||
enddo readMech
|
||||
if (.not. allocated(loadCases(l)%deformation%myType)) call IO_error(error_ID=837,ext_msg = 'L/F/dot_F missing')
|
||||
|
||||
!--------------------------------------------------------------------------------------------------------
|
||||
! Read discretization parameters
|
||||
!--------------------------------------------------------------------------------------------------------
|
||||
newLoadCase%time = step_discretization%get_asFloat('t')
|
||||
newLoadCase%incs = step_discretization%get_asFloat('N')
|
||||
newLoadCase%logscale = step_discretization%get_asBool ('log_timestep', defaultVal= .false.)
|
||||
newLoadCase%outputfrequency = step_discretization%get_asInt ('f_out', defaultVal=1)
|
||||
newLoadCase%restartfrequency = step_discretization%get_asInt ('f_restart', defaultVal=huge(0))
|
||||
step_discretization => load_step%get('discretization')
|
||||
if(.not. step_discretization%contains('t')) call IO_error(error_ID=837,ext_msg = 't missing')
|
||||
if(.not. step_discretization%contains('N')) call IO_error(error_ID=837,ext_msg = 'N missing')
|
||||
loadCases(l)%time = step_discretization%get_asFloat('t')
|
||||
loadCases(l)%incs = step_discretization%get_asFloat('N')
|
||||
loadCases(l)%logscale = step_discretization%get_asBool ('log_timestep', defaultVal= .false.)
|
||||
loadCases(l)%outputfrequency = step_discretization%get_asInt ('f_out', defaultVal=1)
|
||||
loadCases(l)%restartfrequency = step_discretization%get_asInt ('f_restart', defaultVal=huge(0))
|
||||
|
||||
newLoadCase%followFormerTrajectory = .not. (load_step%get_asBool('drop_guessing',defaultVal=.false.) .or. &
|
||||
merge(.false.,.true.,currentLoadCase > 1)) ! do not continue to predict deformation along former trajectory
|
||||
loadCases(l)%followFormerTrajectory = .not. (load_step%get_asBool('drop_guessing',defaultVal=.false.) .or. &
|
||||
merge(.false.,.true.,l > 1)) ! do not continue to predict deformation along former trajectory
|
||||
|
||||
reportAndCheck: if (worldrank == 0) then
|
||||
write (loadcase_string, '(i0)' ) currentLoadCase
|
||||
print'(/,a,i0)', ' load case: ', currentLoadCase
|
||||
if (.not. newLoadCase%followFormerTrajectory) &
|
||||
write (loadcase_string, '(i0)' ) l
|
||||
print'(/,a,i0)', ' load case: ', l
|
||||
if (.not. loadCases(l)%followFormerTrajectory) &
|
||||
print*, ' drop guessing along trajectory'
|
||||
if (newLoadCase%deformation%myType == 'L') then
|
||||
if (loadCases(l)%deformation%myType == 'L') then
|
||||
do j = 1, 3
|
||||
if (any(newLoadCase%deformation%mask(j,1:3) .eqv. .true.) .and. &
|
||||
any(newLoadCase%deformation%mask(j,1:3) .eqv. .false.)) errorID = 832 ! each row should be either fully or not at all defined
|
||||
if (any(loadCases(l)%deformation%mask(j,1:3) .eqv. .true.) .and. &
|
||||
any(loadCases(l)%deformation%mask(j,1:3) .eqv. .false.)) errorID = 832 ! each row should be either fully or not at all defined
|
||||
enddo
|
||||
print*, ' velocity gradient:'
|
||||
else if (newLoadCase%deformation%myType == 'F') then
|
||||
else if (loadCases(l)%deformation%myType == 'F') then
|
||||
print*, ' deformation gradient at end of load case:'
|
||||
else
|
||||
else if (loadCases(l)%deformation%myType == 'dot_F') then
|
||||
print*, ' deformation gradient rate:'
|
||||
endif
|
||||
do i = 1, 3; do j = 1, 3
|
||||
if(newLoadCase%deformation%mask(i,j)) then
|
||||
write(IO_STDOUT,'(2x,f12.7)',advance='no') newLoadCase%deformation%values(i,j)
|
||||
if(loadCases(l)%deformation%mask(i,j)) then
|
||||
write(IO_STDOUT,'(2x,f12.7)',advance='no') loadCases(l)%deformation%values(i,j)
|
||||
else
|
||||
write(IO_STDOUT,'(2x,12a)',advance='no') ' * '
|
||||
write(IO_STDOUT,'(2x,12a)',advance='no') ' x '
|
||||
endif
|
||||
enddo; write(IO_STDOUT,'(/)',advance='no')
|
||||
enddo
|
||||
if (any(newLoadCase%stress%mask .eqv. newLoadCase%deformation%mask)) errorID = 831 ! exclusive or masking only
|
||||
if (any(newLoadCase%stress%mask .and. transpose(newLoadCase%stress%mask) .and. (math_I3<1))) &
|
||||
if (any(loadCases(l)%stress%mask .eqv. loadCases(l)%deformation%mask)) errorID = 831 ! exclusive or masking only
|
||||
if (any(loadCases(l)%stress%mask .and. transpose(loadCases(l)%stress%mask) .and. (math_I3<1))) &
|
||||
errorID = 838 ! no rotation is allowed by stress BC
|
||||
print*, ' stress / GPa:'
|
||||
do i = 1, 3; do j = 1, 3
|
||||
if(newLoadCase%stress%mask(i,j)) then
|
||||
write(IO_STDOUT,'(2x,f12.7)',advance='no') newLoadCase%stress%values(i,j)*1e-9_pReal
|
||||
if(loadCases(l)%stress%mask(i,j)) then
|
||||
write(IO_STDOUT,'(2x,f12.7)',advance='no') loadCases(l)%stress%values(i,j)*1e-9_pReal
|
||||
else
|
||||
write(IO_STDOUT,'(2x,12a)',advance='no') ' * '
|
||||
write(IO_STDOUT,'(2x,12a)',advance='no') ' x '
|
||||
endif
|
||||
enddo; write(IO_STDOUT,'(/)',advance='no')
|
||||
enddo
|
||||
if (any(abs(matmul(newLoadCase%rot%asMatrix(), &
|
||||
transpose(newLoadCase%rot%asMatrix()))-math_I3) > &
|
||||
reshape(spread(tol_math_check,1,9),[ 3,3]))) errorID = 846 ! given rotation matrix contains strain
|
||||
if (any(dNeq(newLoadCase%rot%asMatrix(), math_I3))) &
|
||||
if (any(dNeq(loadCases(l)%rot%asMatrix(), math_I3))) &
|
||||
write(IO_STDOUT,'(2x,a,/,3(3(3x,f12.7,1x)/))',advance='no') 'rotation of loadframe:',&
|
||||
transpose(newLoadCase%rot%asMatrix())
|
||||
if (newLoadCase%time < 0.0_pReal) errorID = 834 ! negative time increment
|
||||
print'(a,f0.3)', ' time: ', newLoadCase%time
|
||||
if (newLoadCase%incs < 1) errorID = 835 ! non-positive incs count
|
||||
print'(a,i0)', ' increments: ', newLoadCase%incs
|
||||
if (newLoadCase%outputfrequency < 1) errorID = 836 ! non-positive result frequency
|
||||
print'(a,i0)', ' output frequency: ', newLoadCase%outputfrequency
|
||||
if (newLoadCase%restartfrequency < 1) errorID = 839 ! non-positive restart frequency
|
||||
if (newLoadCase%restartfrequency < huge(0)) &
|
||||
print'(a,i0)', ' restart frequency: ', newLoadCase%restartfrequency
|
||||
transpose(loadCases(l)%rot%asMatrix())
|
||||
if (loadCases(l)%time < 0.0_pReal) errorID = 834 ! negative time increment
|
||||
print'(a,f0.3)', ' time: ', loadCases(l)%time
|
||||
if (loadCases(l)%incs < 1) errorID = 835 ! non-positive incs count
|
||||
print'(a,i0)', ' increments: ', loadCases(l)%incs
|
||||
if (loadCases(l)%outputfrequency < 1) errorID = 836 ! non-positive result frequency
|
||||
print'(a,i0)', ' output frequency: ', loadCases(l)%outputfrequency
|
||||
if (loadCases(l)%restartfrequency < 1) errorID = 839 ! non-positive restart frequency
|
||||
if (loadCases(l)%restartfrequency < huge(0)) &
|
||||
print'(a,i0)', ' restart frequency: ', loadCases(l)%restartfrequency
|
||||
if (errorID > 0) call IO_error(error_ID = errorID, ext_msg = loadcase_string) ! exit with error message
|
||||
endif reportAndCheck
|
||||
loadCases(currentLoadCase) = newLoadCase ! load case is ok, append it
|
||||
enddo
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -331,27 +307,27 @@ program DAMASK_grid
|
|||
call CPFEM_results(0,0.0_pReal)
|
||||
endif writeUndeformed
|
||||
|
||||
loadCaseLooping: do currentLoadCase = 1, size(loadCases)
|
||||
loadCaseLooping: do l = 1, size(loadCases)
|
||||
time0 = time ! load case start time
|
||||
guess = loadCases(currentLoadCase)%followFormerTrajectory ! change of load case? homogeneous guess for the first inc
|
||||
guess = loadCases(l)%followFormerTrajectory ! change of load case? homogeneous guess for the first inc
|
||||
|
||||
incLooping: do inc = 1, loadCases(currentLoadCase)%incs
|
||||
incLooping: do inc = 1, loadCases(l)%incs
|
||||
totalIncsCounter = totalIncsCounter + 1
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! forwarding time
|
||||
timeIncOld = timeinc ! last timeinc that brought former inc to an end
|
||||
if (.not. loadCases(currentLoadCase)%logscale) then ! linear scale
|
||||
timeinc = loadCases(currentLoadCase)%time/real(loadCases(currentLoadCase)%incs,pReal)
|
||||
if (.not. loadCases(l)%logscale) then ! linear scale
|
||||
timeinc = loadCases(l)%time/real(loadCases(l)%incs,pReal)
|
||||
else
|
||||
if (currentLoadCase == 1) then ! 1st load case of logarithmic scale
|
||||
if (l == 1) then ! 1st load case of logarithmic scale
|
||||
timeinc = loadCases(1)%time*(2.0_pReal**real(max(inc-1,1)-loadCases(1)%incs ,pReal)) ! assume 1st inc is equal to 2nd
|
||||
else ! not-1st load case of logarithmic scale
|
||||
timeinc = time0 * &
|
||||
( (1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( inc ,pReal)/&
|
||||
real(loadCases(currentLoadCase)%incs ,pReal))&
|
||||
-(1.0_pReal + loadCases(currentLoadCase)%time/time0 )**(real( inc-1 ,pReal)/&
|
||||
real(loadCases(currentLoadCase)%incs ,pReal)))
|
||||
( (1.0_pReal + loadCases(l)%time/time0 )**(real( inc ,pReal)/&
|
||||
real(loadCases(l)%incs ,pReal))&
|
||||
-(1.0_pReal + loadCases(l)%time/time0 )**(real( inc-1 ,pReal)/&
|
||||
real(loadCases(l)%incs ,pReal)))
|
||||
endif
|
||||
endif
|
||||
timeinc = timeinc * real(subStepFactor,pReal)**real(-cutBackLevel,pReal) ! depending on cut back level, decrease time step
|
||||
|
@ -363,7 +339,7 @@ program DAMASK_grid
|
|||
stepFraction = 0 ! fraction scaled by stepFactor**cutLevel
|
||||
|
||||
subStepLooping: do while (stepFraction < subStepFactor**cutBackLevel)
|
||||
remainingLoadCaseTime = loadCases(currentLoadCase)%time+time0 - time
|
||||
remainingLoadCaseTime = loadCases(l)%time+time0 - time
|
||||
time = time + timeinc ! forward target time
|
||||
stepFraction = stepFraction + 1 ! count step
|
||||
|
||||
|
@ -372,9 +348,9 @@ program DAMASK_grid
|
|||
print'(/,a)', ' ###########################################################################'
|
||||
print'(1x,a,es12.5,6(a,i0))', &
|
||||
'Time', time, &
|
||||
's: Increment ', inc,'/',loadCases(currentLoadCase)%incs,&
|
||||
's: Increment ', inc,'/',loadCases(l)%incs,&
|
||||
'-', stepFraction,'/',subStepFactor**cutBackLevel,&
|
||||
' of load case ', currentLoadCase,'/',size(loadCases)
|
||||
' of load case ', l,'/',size(loadCases)
|
||||
write(incInfo,'(4(a,i0))') &
|
||||
'Increment ',totalIncsCounter,'/',sum(loadCases%incs),&
|
||||
'-', stepFraction,'/',subStepFactor**cutBackLevel
|
||||
|
@ -383,13 +359,13 @@ program DAMASK_grid
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
! forward fields
|
||||
do field = 1, nActiveFields
|
||||
select case(loadCases(currentLoadCase)%ID(field))
|
||||
select case(loadCases(l)%ID(field))
|
||||
case(FIELD_MECH_ID)
|
||||
call mech_forward (&
|
||||
cutBack,guess,timeinc,timeIncOld,remainingLoadCaseTime, &
|
||||
deformation_BC = loadCases(currentLoadCase)%deformation, &
|
||||
stress_BC = loadCases(currentLoadCase)%stress, &
|
||||
rotation_BC = loadCases(currentLoadCase)%rot)
|
||||
deformation_BC = loadCases(l)%deformation, &
|
||||
stress_BC = loadCases(l)%stress, &
|
||||
rotation_BC = loadCases(l)%rot)
|
||||
|
||||
case(FIELD_THERMAL_ID); call grid_thermal_spectral_forward(cutBack)
|
||||
case(FIELD_DAMAGE_ID); call grid_damage_spectral_forward(cutBack)
|
||||
|
@ -403,7 +379,7 @@ program DAMASK_grid
|
|||
stagIterate = .true.
|
||||
do while (stagIterate)
|
||||
do field = 1, nActiveFields
|
||||
select case(loadCases(currentLoadCase)%ID(field))
|
||||
select case(loadCases(l)%ID(field))
|
||||
case(FIELD_MECH_ID)
|
||||
solres(field) = mech_solution(incInfo)
|
||||
case(FIELD_THERMAL_ID)
|
||||
|
@ -458,12 +434,12 @@ program DAMASK_grid
|
|||
print'(/,a,i0,a)', ' increment ', totalIncsCounter, ' NOT converged'
|
||||
endif; flush(IO_STDOUT)
|
||||
|
||||
if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0) then ! at output frequency
|
||||
if (mod(inc,loadCases(l)%outputFrequency) == 0) then ! at output frequency
|
||||
print'(1/,a)', ' ... writing results to file ......................................'
|
||||
flush(IO_STDOUT)
|
||||
call CPFEM_results(totalIncsCounter,time)
|
||||
endif
|
||||
if (mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0) then
|
||||
if (mod(inc,loadCases(l)%restartFrequency) == 0) then
|
||||
call mech_restartWrite
|
||||
call CPFEM_restartWrite
|
||||
endif
|
||||
|
|
|
@ -82,15 +82,15 @@ module spectral_utilities
|
|||
end type tSolutionState
|
||||
|
||||
type, public :: tBoundaryCondition !< set of parameters defining a boundary condition
|
||||
real(pReal), dimension(3,3) :: values = 0.0_pReal
|
||||
logical, dimension(3,3) :: mask = .false.
|
||||
character(len=pStringLen) :: myType = 'None'
|
||||
real(pReal), dimension(3,3) :: values = 0.0_pReal
|
||||
logical, dimension(3,3) :: mask = .false.
|
||||
character(len=:), allocatable :: myType
|
||||
end type tBoundaryCondition
|
||||
|
||||
type, public :: tLoadCase
|
||||
type(rotation) :: rot !< rotation of BC
|
||||
type(tBoundaryCondition) :: stress, & !< stress BC
|
||||
deformation !< deformation BC (dot_F or L)
|
||||
deformation !< deformation BC (dot_F, F, or L)
|
||||
real(pReal) :: time !< length of increment
|
||||
integer :: incs, & !< number of increments
|
||||
outputfrequency, & !< frequency of result writes
|
||||
|
|
Loading…
Reference in New Issue