Merge branch 'damage_read_init_phi' into 'development'

read initial phi for damage field

See merge request damask/DAMASK!628
This commit is contained in:
Martin Diehl 2022-09-21 15:15:20 +00:00
commit eb562ac412
3 changed files with 18 additions and 6 deletions

@ -1 +1 @@
Subproject commit a8bd47ad55125b477e6c03277ee38ce3998a66ca Subproject commit 8c0a24006f355ce8d7602daa77a33348183a2bc7

View File

@ -70,7 +70,9 @@ contains
subroutine grid_damage_spectral_init() subroutine grid_damage_spectral_init()
PetscInt, dimension(0:worldsize-1) :: localK PetscInt, dimension(0:worldsize-1) :: localK
integer :: i, j, k, ce
DM :: damage_grid DM :: damage_grid
PetscScalar, dimension(:,:,:), pointer :: phi_PETSc
Vec :: uBound, lBound Vec :: uBound, lBound
integer(MPI_INTEGER_KIND) :: err_MPI integer(MPI_INTEGER_KIND) :: err_MPI
PetscErrorCode :: err_PETSc PetscErrorCode :: err_PETSc
@ -110,9 +112,9 @@ subroutine grid_damage_spectral_init()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! init fields ! init fields
allocate(phi_current(cells(1),cells(2),cells3), source=1.0_pReal) phi_current = discretization_grid_getInitialCondition('phi')
allocate(phi_lastInc(cells(1),cells(2),cells3), source=1.0_pReal) phi_lastInc = phi_current
allocate(phi_stagInc(cells(1),cells(2),cells3), source=1.0_pReal) phi_stagInc = phi_current
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! initialize solver specific parts of PETSc ! initialize solver specific parts of PETSc
@ -164,7 +166,17 @@ subroutine grid_damage_spectral_init()
call DMRestoreGlobalVector(damage_grid,uBound,err_PETSc) call DMRestoreGlobalVector(damage_grid,uBound,err_PETSc)
CHKERRQ(err_PETSc) CHKERRQ(err_PETSc)
end if end if
call VecSet(solution_vec,1.0_pReal,err_PETSc)
ce = 0
do k = 1, cells3; do j = 1, cells(2); do i = 1, cells(1)
ce = ce + 1
call homogenization_set_phi(phi_current(i,j,k),ce)
end do; end do; end do
call DMDAVecGetArrayF90(damage_grid,solution_vec,phi_PETSc,err_PETSc)
CHKERRQ(err_PETSc)
phi_PETSc = phi_current
call DMDAVecRestoreArrayF90(damage_grid,solution_vec,phi_PETSc,err_PETSc)
CHKERRQ(err_PETSc) CHKERRQ(err_PETSc)
call updateReference() call updateReference()

View File

@ -168,7 +168,7 @@ module subroutine damage_results(ho,group)
outputsLoop: do o = 1,size(prm%output) outputsLoop: do o = 1,size(prm%output)
select case(prm%output(o)) select case(prm%output(o))
case ('phi') case ('phi')
call results_writeDataset(damagestate_h(ho)%state(1,:),group,prm%output(o),& call results_writeDataset(current(ho)%phi,group,prm%output(o),&
'damage indicator','-') 'damage indicator','-')
end select end select
end do outputsLoop end do outputsLoop