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)
initial_conditions => config_load%get('initial_conditions',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)
call grid_damage_spectral_init()

View File

@ -37,7 +37,8 @@ module discretization_grid
size3offset !< (local) size offset in 3rd direction
public :: &
discretization_grid_init
discretization_grid_init, &
discretization_grid_getInitialCondition
contains
@ -316,10 +317,10 @@ end function IPneighborhood
!--------------------------------------------------------------------------------------------------
!> @brief Read initial condition from VTI file.
!--------------------------------------------------------------------------------------------------
function getInitialCondition(label)
function discretization_grid_getInitialCondition(label) result(ic)
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
integer(MPI_INTEGER_KIND) :: err_MPI
@ -328,7 +329,7 @@ function getInitialCondition(label)
displs, sendcounts
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
allocate(ic_global(0)) ! needed for IntelMPI
endif
@ -345,8 +346,8 @@ function getInitialCondition(label)
MPI_DOUBLE,0_MPI_INTEGER_KIND,MPI_COMM_WORLD,err_MPI)
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

View File

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