add read-in init phi, correct write-out damage result

This commit is contained in:
Yi Hu 2022-09-14 16:54:58 +02:00 committed by Martin Diehl
parent 7b61051117
commit bb65d58214
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()
PetscInt, dimension(0:worldsize-1) :: localK
integer :: i, j, k, ce
DM :: damage_grid
PetscScalar, dimension(:,:,:), pointer :: phi_PETSc
Vec :: uBound, lBound
integer(MPI_INTEGER_KIND) :: err_MPI
PetscErrorCode :: err_PETSc
@ -110,9 +112,9 @@ subroutine grid_damage_spectral_init()
!--------------------------------------------------------------------------------------------------
! init fields
allocate(phi_current(cells(1),cells(2),cells3), source=1.0_pReal)
allocate(phi_lastInc(cells(1),cells(2),cells3), source=1.0_pReal)
allocate(phi_stagInc(cells(1),cells(2),cells3), source=1.0_pReal)
phi_current = discretization_grid_getInitialCondition('phi')
phi_lastInc = phi_current
phi_stagInc = phi_current
!--------------------------------------------------------------------------------------------------
! initialize solver specific parts of PETSc
@ -164,7 +166,17 @@ subroutine grid_damage_spectral_init()
call DMRestoreGlobalVector(damage_grid,uBound,err_PETSc)
CHKERRQ(err_PETSc)
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)
call updateReference()

View File

@ -168,7 +168,7 @@ module subroutine damage_results(ho,group)
outputsLoop: do o = 1,size(prm%output)
select case(prm%output(o))
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','-')
end select
end do outputsLoop