specify initial temperature per point

This commit is contained in:
Martin Diehl 2022-03-09 21:29:40 +01:00
parent da5ba82299
commit 790ca57ea0
3 changed files with 12 additions and 13 deletions

View File

@ -308,7 +308,7 @@ program DAMASK_grid
case (FIELD_THERMAL_ID) case (FIELD_THERMAL_ID)
initial_conditions => config_load%get('initial_conditions',defaultVal=emptyDict) initial_conditions => config_load%get('initial_conditions',defaultVal=emptyDict)
thermal => initial_conditions%get('thermal',defaultVal=emptyDict) thermal => initial_conditions%get('thermal',defaultVal=emptyDict)
call grid_thermal_spectral_init(thermal%get_asFloat('T')) call grid_thermal_spectral_init()
case (FIELD_DAMAGE_ID) case (FIELD_DAMAGE_ID)
call grid_damage_spectral_init() call grid_damage_spectral_init()

View File

@ -37,7 +37,8 @@ module discretization_grid
size3offset !< (local) size offset in 3rd direction size3offset !< (local) size offset in 3rd direction
public :: & public :: &
discretization_grid_init discretization_grid_init, &
discretization_grid_getInitialCondition
contains contains
@ -316,10 +317,10 @@ end function IPneighborhood
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Read initial condition from VTI file. !> @brief Read initial condition from VTI file.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function getInitialCondition(label) function discretization_grid_getInitialCondition(label) result(ic)
character(len=*), intent(in) :: label character(len=*), intent(in) :: label
real(pReal), dimension(cells(1),cells(2),cells3) :: getInitialCondition real(pReal), dimension(cells(1),cells(2),cells3) :: ic
real(pReal), dimension(:), allocatable :: ic_global, ic_local real(pReal), dimension(:), allocatable :: ic_global, ic_local
integer(MPI_INTEGER_KIND) :: err_MPI integer(MPI_INTEGER_KIND) :: err_MPI
@ -328,7 +329,7 @@ function getInitialCondition(label)
displs, sendcounts displs, sendcounts
if (worldrank == 0) then if (worldrank == 0) then
ic_global = VTI_read_Real(IO_read(interface_geomFile),label) ic_global = VTI_readDataset_real(IO_read(interface_geomFile),label)
else else
allocate(ic_global(0)) ! needed for IntelMPI allocate(ic_global(0)) ! needed for IntelMPI
endif endif
@ -345,8 +346,8 @@ function getInitialCondition(label)
MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI) MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI)
if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error' if (err_MPI /= 0_MPI_INTEGER_KIND) error stop 'MPI error'
getInitialCondition = reshape(ic_local,[cells(1),cells(2),cells3]) ic = reshape(ic_local,[cells(1),cells(2),cells3])
end function getInitialCondition end function discretization_grid_getInitialCondition
end module discretization_grid end module discretization_grid

View File

@ -65,9 +65,7 @@ contains
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief allocates all neccessary fields and fills them with data !> @brief allocates all neccessary fields and fills them with data
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine grid_thermal_spectral_init(T_0) subroutine grid_thermal_spectral_init()
real(pReal), intent(in) :: T_0
PetscInt, dimension(0:worldsize-1) :: localK PetscInt, dimension(0:worldsize-1) :: localK
integer :: i, j, k, ce integer :: i, j, k, ce
@ -105,9 +103,9 @@ subroutine grid_thermal_spectral_init(T_0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! init fields ! init fields
allocate(T_current(cells(1),cells(2),cells3), source=T_0) T_current = discretization_grid_getInitialCondition('T')
allocate(T_lastInc(cells(1),cells(2),cells3), source=T_0) T_lastInc = T_current
allocate(T_stagInc(cells(1),cells(2),cells3), source=T_0) T_stagInc = T_current
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! initialize solver specific parts of PETSc ! initialize solver specific parts of PETSc