modularize
This commit is contained in:
parent
52190382ac
commit
67228b46a6
|
@ -190,7 +190,8 @@ subroutine grid_mech_spectral_basic_init
|
|||
call MPI_File_close(fileUnit,ierr)
|
||||
endif restartRead2
|
||||
|
||||
call utilities_updateGamma(C_minMaxAvg,.true.)
|
||||
call utilities_updateGamma(C_minMaxAvg)
|
||||
call utilities_saveReferenceStiffness
|
||||
|
||||
end subroutine grid_mech_spectral_basic_init
|
||||
|
||||
|
@ -222,8 +223,11 @@ function grid_mech_spectral_basic_solution(incInfoIn,timeinc,timeinc_old,stress_
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
! update stiffness (and gamma operator)
|
||||
S = utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg)
|
||||
if (num%update_gamma) call utilities_updateGamma(C_minMaxAvg,restartWrite)
|
||||
|
||||
if (num%update_gamma) then
|
||||
call utilities_updateGamma(C_minMaxAvg)
|
||||
if(restartWrite) call utilities_saveReferenceStiffness
|
||||
endif
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! set module wide available data
|
||||
params%stress_mask = stress_BC%maskFloat
|
||||
|
|
|
@ -203,7 +203,8 @@ subroutine grid_mech_spectral_polarisation_init
|
|||
call MPI_File_close(fileUnit,ierr)
|
||||
endif restartRead2
|
||||
|
||||
call utilities_updateGamma(C_minMaxAvg,.true.)
|
||||
call utilities_updateGamma(C_minMaxAvg)
|
||||
call utilities_saveReferenceStiffness
|
||||
C_scale = C_minMaxAvg
|
||||
S_scale = math_invSym3333(C_minMaxAvg)
|
||||
|
||||
|
@ -238,7 +239,8 @@ function grid_mech_spectral_polarisation_solution(incInfoIn,timeinc,timeinc_old,
|
|||
! update stiffness (and gamma operator)
|
||||
S = utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg)
|
||||
if (num%update_gamma) then
|
||||
call utilities_updateGamma(C_minMaxAvg,restartWrite)
|
||||
call utilities_updateGamma(C_minMaxAvg)
|
||||
if(restartWrite) call utilities_saveReferenceStiffness
|
||||
C_scale = C_minMaxAvg
|
||||
S_scale = math_invSym3333(C_minMaxAvg)
|
||||
endif
|
||||
|
|
|
@ -158,12 +158,11 @@ module spectral_utilities
|
|||
utilities_calculateRate, &
|
||||
utilities_forwardField, &
|
||||
utilities_updateCoords, &
|
||||
utilities_saveReferenceStiffness, &
|
||||
FIELD_UNDEFINED_ID, &
|
||||
FIELD_MECH_ID, &
|
||||
FIELD_THERMAL_ID, &
|
||||
FIELD_DAMAGE_ID
|
||||
private :: &
|
||||
utilities_getFreqDerivative
|
||||
|
||||
contains
|
||||
|
||||
|
@ -390,27 +389,18 @@ end subroutine utilities_init
|
|||
!> @details Sets the current reference stiffness to the stiffness given as an argument.
|
||||
!> If the gamma operator is precalculated, it is calculated with this stiffness.
|
||||
!> In case of an on-the-fly calculation, only the reference stiffness is updated.
|
||||
!> Also writes out the current reference stiffness for restart.
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
subroutine utilities_updateGamma(C,saveReference)
|
||||
subroutine utilities_updateGamma(C)
|
||||
|
||||
real(pReal), intent(in), dimension(3,3,3,3) :: C !< input stiffness to store as reference stiffness
|
||||
logical , intent(in) :: saveReference !< save reference stiffness to file for restart
|
||||
complex(pReal), dimension(3,3) :: temp33_complex, xiDyad_cmplx
|
||||
real(pReal), dimension(6,6) :: A, A_inv
|
||||
integer :: &
|
||||
i, j, k, &
|
||||
l, m, n, o, &
|
||||
fileUnit
|
||||
l, m, n, o
|
||||
logical :: err
|
||||
|
||||
C_ref = C
|
||||
if (saveReference .and. worldrank == 0) then
|
||||
write(6,'(/,a)') ' writing reference stiffness to file'
|
||||
flush(6)
|
||||
fileUnit = IO_open_jobFile_binary('C_ref','w')
|
||||
write(fileUnit) C_ref; close(fileUnit)
|
||||
endif
|
||||
|
||||
if(.not. num%memory_efficient) then
|
||||
gamma_hat = cmplx(0.0_pReal,0.0_pReal,pReal) ! for the singular point and any non invertible A
|
||||
|
@ -1130,4 +1120,22 @@ subroutine utilities_updateCoords(F)
|
|||
|
||||
end subroutine utilities_updateCoords
|
||||
|
||||
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
!> @brief Write out the current reference stiffness for restart.
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
subroutine utilities_saveReferenceStiffness
|
||||
|
||||
integer :: &
|
||||
fileUnit
|
||||
|
||||
if (worldrank == 0) then
|
||||
write(6,'(/,a)') ' writing reference stiffness to file'
|
||||
flush(6)
|
||||
fileUnit = IO_open_jobFile_binary('C_ref','w')
|
||||
write(fileUnit) C_ref; close(fileUnit)
|
||||
endif
|
||||
|
||||
end subroutine utilities_saveReferenceStiffness
|
||||
|
||||
end module spectral_utilities
|
||||
|
|
Loading…
Reference in New Issue