standard name
This commit is contained in:
parent
7c159366d5
commit
9b698e78c1
|
@ -64,7 +64,7 @@ contains
|
|||
subroutine grid_thermal_spectral_init
|
||||
|
||||
PetscInt, dimension(0:worldsize-1) :: localK
|
||||
integer :: i, j, k, cell
|
||||
integer :: i, j, k, ce
|
||||
DM :: thermal_grid
|
||||
PetscScalar, dimension(:,:,:), pointer :: x_scal
|
||||
PetscErrorCode :: ierr
|
||||
|
@ -128,10 +128,10 @@ subroutine grid_thermal_spectral_init
|
|||
allocate(T_current(grid(1),grid(2),grid3), source=0.0_pReal)
|
||||
allocate(T_lastInc(grid(1),grid(2),grid3), source=0.0_pReal)
|
||||
allocate(T_stagInc(grid(1),grid(2),grid3), source=0.0_pReal)
|
||||
cell = 0
|
||||
ce = 0
|
||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
||||
cell = cell + 1
|
||||
T_current(i,j,k) = temperature(material_homogenizationAt(cell))%p(material_homogenizationMemberAt(1,cell))
|
||||
ce = ce + 1
|
||||
T_current(i,j,k) = temperature(material_homogenizationAt(ce))%p(material_homogenizationMemberAt(1,ce))
|
||||
T_lastInc(i,j,k) = T_current(i,j,k)
|
||||
T_stagInc(i,j,k) = T_current(i,j,k)
|
||||
enddo; enddo; enddo
|
||||
|
@ -151,7 +151,7 @@ function grid_thermal_spectral_solution(timeinc) result(solution)
|
|||
|
||||
real(pReal), intent(in) :: &
|
||||
timeinc !< increment in time for current solution
|
||||
integer :: i, j, k, cell
|
||||
integer :: i, j, k, ce
|
||||
type(tSolutionState) :: solution
|
||||
PetscInt :: devNull
|
||||
PetscReal :: T_min, T_max, stagNorm, solnNorm
|
||||
|
@ -184,12 +184,12 @@ function grid_thermal_spectral_solution(timeinc) result(solution)
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! updating thermal state
|
||||
cell = 0
|
||||
ce = 0
|
||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
||||
cell = cell + 1
|
||||
ce = ce + 1
|
||||
call thermal_conduction_putTemperatureAndItsRate(T_current(i,j,k), &
|
||||
(T_current(i,j,k)-T_lastInc(i,j,k))/params%timeinc, &
|
||||
1,cell)
|
||||
1,ce)
|
||||
enddo; enddo; enddo
|
||||
|
||||
call VecMin(solution_vec,devNull,T_min,ierr); CHKERRQ(ierr)
|
||||
|
@ -209,7 +209,7 @@ end function grid_thermal_spectral_solution
|
|||
subroutine grid_thermal_spectral_forward(cutBack)
|
||||
|
||||
logical, intent(in) :: cutBack
|
||||
integer :: i, j, k, cell
|
||||
integer :: i, j, k, ce
|
||||
DM :: dm_local
|
||||
PetscScalar, dimension(:,:,:), pointer :: x_scal
|
||||
PetscErrorCode :: ierr
|
||||
|
@ -220,17 +220,17 @@ subroutine grid_thermal_spectral_forward(cutBack)
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! reverting thermal field state
|
||||
cell = 0
|
||||
ce = 0
|
||||
call SNESGetDM(thermal_snes,dm_local,ierr); CHKERRQ(ierr)
|
||||
call DMDAVecGetArrayF90(dm_local,solution_vec,x_scal,ierr); CHKERRQ(ierr) !< get the data out of PETSc to work with
|
||||
x_scal(xstart:xend,ystart:yend,zstart:zend) = T_current
|
||||
call DMDAVecRestoreArrayF90(dm_local,solution_vec,x_scal,ierr); CHKERRQ(ierr)
|
||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
||||
cell = cell + 1
|
||||
ce = ce + 1
|
||||
call thermal_conduction_putTemperatureAndItsRate(T_current(i,j,k), &
|
||||
(T_current(i,j,k) - &
|
||||
T_lastInc(i,j,k))/params%timeinc, &
|
||||
1,cell)
|
||||
1,ce)
|
||||
enddo; enddo; enddo
|
||||
else
|
||||
T_lastInc = T_current
|
||||
|
@ -255,7 +255,7 @@ subroutine formResidual(in,x_scal,f_scal,dummy,ierr)
|
|||
f_scal
|
||||
PetscObject :: dummy
|
||||
PetscErrorCode :: ierr
|
||||
integer :: i, j, k, cell
|
||||
integer :: i, j, k, ce
|
||||
real(pReal) :: Tdot
|
||||
|
||||
T_current = x_scal
|
||||
|
@ -266,22 +266,22 @@ subroutine formResidual(in,x_scal,f_scal,dummy,ierr)
|
|||
call utilities_FFTscalarForward
|
||||
call utilities_fourierScalarGradient !< calculate gradient of temperature field
|
||||
call utilities_FFTvectorBackward
|
||||
cell = 0
|
||||
ce = 0
|
||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
||||
cell = cell + 1
|
||||
vectorField_real(1:3,i,j,k) = matmul(thermal_conduction_getConductivity(1,cell) - K_ref, &
|
||||
ce = ce + 1
|
||||
vectorField_real(1:3,i,j,k) = matmul(thermal_conduction_getConductivity(1,ce) - K_ref, &
|
||||
vectorField_real(1:3,i,j,k))
|
||||
enddo; enddo; enddo
|
||||
call utilities_FFTvectorForward
|
||||
call utilities_fourierVectorDivergence !< calculate temperature divergence in fourier field
|
||||
call utilities_FFTscalarBackward
|
||||
cell = 0
|
||||
ce = 0
|
||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
||||
cell = cell + 1
|
||||
call thermal_conduction_getSource(Tdot, T_current(i,j,k), 1, cell)
|
||||
ce = ce + 1
|
||||
call thermal_conduction_getSource(Tdot, T_current(i,j,k), 1, ce)
|
||||
scalarField_real(i,j,k) = params%timeinc*(scalarField_real(i,j,k) + Tdot) &
|
||||
+ thermal_conduction_getMassDensity (1,cell)* &
|
||||
thermal_conduction_getSpecificHeat(1,cell)*(T_lastInc(i,j,k) - &
|
||||
+ thermal_conduction_getMassDensity (1,ce)* &
|
||||
thermal_conduction_getSpecificHeat(1,ce)*(T_lastInc(i,j,k) - &
|
||||
T_current(i,j,k))&
|
||||
+ mu_ref*T_current(i,j,k)
|
||||
enddo; enddo; enddo
|
||||
|
@ -304,15 +304,15 @@ end subroutine formResidual
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine updateReference
|
||||
|
||||
integer :: i,j,k,cell,ierr
|
||||
integer :: i,j,k,ce,ierr
|
||||
|
||||
cell = 0
|
||||
ce = 0
|
||||
K_ref = 0.0_pReal
|
||||
mu_ref = 0.0_pReal
|
||||
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
|
||||
cell = cell + 1
|
||||
K_ref = K_ref + thermal_conduction_getConductivity(1,cell)
|
||||
mu_ref = mu_ref + thermal_conduction_getMassDensity(1,cell)* thermal_conduction_getSpecificHeat(1,cell)
|
||||
ce = ce + 1
|
||||
K_ref = K_ref + thermal_conduction_getConductivity(1,ce)
|
||||
mu_ref = mu_ref + thermal_conduction_getMassDensity(1,ce)* thermal_conduction_getSpecificHeat(1,ce)
|
||||
enddo; enddo; enddo
|
||||
K_ref = K_ref*wgt
|
||||
call MPI_Allreduce(MPI_IN_PLACE,K_ref,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr)
|
||||
|
|
Loading…
Reference in New Issue