reordered initialization for spectral method, corrected bug of deformation BC parsing when prescribing velocity gradient resulting in wrong average deformation

This commit is contained in:
Martin Diehl 2012-07-30 15:51:48 +00:00
parent d4163dd16f
commit 991a7bbd2d
2 changed files with 66 additions and 57 deletions

View File

@ -78,6 +78,9 @@ subroutine CPFEM_initAll(Temperature,element,IP)
n = n+1_pInt n = n+1_pInt
if (.not. CPFEM_init_inProgress) then ! yes my thread won! if (.not. CPFEM_init_inProgress) then ! yes my thread won!
CPFEM_init_inProgress = .true. CPFEM_init_inProgress = .true.
#ifdef Spectral
call DAMASK_interface_init() ! Spectral solver is interfacing to commandline
#endif
call prec_init call prec_init
call IO_init call IO_init
call numerics_init call numerics_init
@ -92,7 +95,7 @@ subroutine CPFEM_initAll(Temperature,element,IP)
call homogenization_init(Temperature) call homogenization_init(Temperature)
call CPFEM_init call CPFEM_init
#ifndef Spectral #ifndef Spectral
call DAMASK_interface_init() ! Spectral solver is doing initialization earlier call DAMASK_interface_init() ! Spectral solver init is already done
#endif #endif
CPFEM_init_done = .true. CPFEM_init_done = .true.
CPFEM_init_inProgress = .false. CPFEM_init_inProgress = .false.

View File

@ -170,6 +170,7 @@ program DAMASK_spectral
P_av, & P_av, &
F_aim = math_I3, & F_aim = math_I3, &
F_aim_lastInc = math_I3, & F_aim_lastInc = math_I3, &
Favg = 0.0_pReal, &
mask_stress, & mask_stress, &
mask_defgrad, & mask_defgrad, &
deltaF_aim, & deltaF_aim, &
@ -257,7 +258,11 @@ program DAMASK_spectral
integer :: ierr_psc integer :: ierr_psc
call PetscInitialize(PETSC_NULL_CHARACTER, ierr_psc) call PetscInitialize(PETSC_NULL_CHARACTER, ierr_psc)
#endif #endif
call DAMASK_interface_init
!--------------------------------------------------------------------------------------------------
! initialization of all related DAMASK modules (e.g. mesh.f90 reads in geometry)
call CPFEM_initAll(temperature = 300.0_pReal, element = 1_pInt, IP= 1_pInt)
write(6,'(a)') '' write(6,'(a)') ''
write(6,'(a)') ' <<<+- DAMASK_spectral init -+>>>' write(6,'(a)') ' <<<+- DAMASK_spectral init -+>>>'
write(6,'(a)') ' $Id$' write(6,'(a)') ' $Id$'
@ -364,10 +369,6 @@ program DAMASK_spectral
enddo; enddo enddo; enddo
101 close(myUnit) 101 close(myUnit)
!-------------------------------------------------------------------------------------------------- ToDo: if temperature at CPFEM is treated properly, move this up immediately after interface init
! initialization of all related DAMASK modules (e.g. mesh.f90 reads in geometry)
call CPFEM_initAll(bc(1)%temperature,1_pInt,1_pInt)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! get resolution, dimension, homogenization and variables derived from resolution ! get resolution, dimension, homogenization and variables derived from resolution
res = mesh_spectral_getResolution() res = mesh_spectral_getResolution()
@ -700,6 +701,7 @@ program DAMASK_spectral
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! update local deformation gradient and coordinates ! update local deformation gradient and coordinates
deltaF_aim = math_rotate_backward33(deltaF_aim,bc(loadcase)%rotation) deltaF_aim = math_rotate_backward33(deltaF_aim,bc(loadcase)%rotation)
Favg = 0.0_pReal
do k = 1_pInt, res(3); do j = 1_pInt, res(2); do i = 1_pInt, res(1) do k = 1_pInt, res(3); do j = 1_pInt, res(2); do i = 1_pInt, res(1)
temp33_Real = F(i,j,k,1:3,1:3) temp33_Real = F(i,j,k,1:3,1:3)
F(i,j,k,1:3,1:3) = F(i,j,k,1:3,1:3) & ! decide if guessing along former trajectory or apply homogeneous addon F(i,j,k,1:3,1:3) = F(i,j,k,1:3,1:3) & ! decide if guessing along former trajectory or apply homogeneous addon
@ -707,6 +709,11 @@ program DAMASK_spectral
*timeinc/timeinc_old & *timeinc/timeinc_old &
+ (1.0_pReal-guessmode) * deltaF_aim ! if not guessing, use prescribed average deformation where applicable + (1.0_pReal-guessmode) * deltaF_aim ! if not guessing, use prescribed average deformation where applicable
F_lastInc(i,j,k,1:3,1:3) = temp33_Real F_lastInc(i,j,k,1:3,1:3) = temp33_Real
Favg = Favg + F(i,j,k,1:3,1:3)
enddo; enddo; enddo
deltaF_aim = guessmode *(Favg*wgt -F_aim) ! average correction in case of guessing to
do k = 1_pInt, res(3); do j = 1_pInt, res(2); do i = 1_pInt, res(1)
F(i,j,k,1:3,1:3) = F(i,j,k,1:3,1:3) - deltaF_aim ! correct in case avg of F is not F_aim
enddo; enddo; enddo enddo; enddo; enddo
call deformed_fft(res,geomdim,math_rotate_backward33(F_aim,bc(loadcase)%rotation),& ! calculate current coordinates call deformed_fft(res,geomdim,math_rotate_backward33(F_aim,bc(loadcase)%rotation),& ! calculate current coordinates
1.0_pReal,F_lastInc,coordinates) 1.0_pReal,F_lastInc,coordinates)
@ -1038,7 +1045,6 @@ program DAMASK_spectral
F(i,j,k,1:3,1:3) = F(i,j,k,1:3,1:3) - deltaF_real(i,j,k,1:3,1:3)*wgt ! F(x)^(n+1) = F(x)^(n) + correction; *wgt: correcting for missing normalization F(i,j,k,1:3,1:3) = F(i,j,k,1:3,1:3) - deltaF_real(i,j,k,1:3,1:3)*wgt ! F(x)^(n+1) = F(x)^(n) + correction; *wgt: correcting for missing normalization
enddo; enddo; enddo enddo; enddo; enddo
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! calculate bounds of det(F) and report ! calculate bounds of det(F) and report
if(debugGeneral) then if(debugGeneral) then