first modification. compile succeeded
This commit is contained in:
parent
a23207a6fe
commit
a65e4bdad4
|
@ -364,8 +364,8 @@ program DAMASK_spectral
|
||||||
select case (loadCases(1)%ID(field))
|
select case (loadCases(1)%ID(field))
|
||||||
case(FIELD_MECH_ID)
|
case(FIELD_MECH_ID)
|
||||||
select case (spectral_solver)
|
select case (spectral_solver)
|
||||||
case (DAMASK_spectral_SolverBasicPETSc_label)
|
case (DAMASK_spectral_SolverPETSc_label)
|
||||||
call basicPETSc_init
|
call PETSc_init
|
||||||
|
|
||||||
case (DAMASK_spectral_SolverPolarisation_label)
|
case (DAMASK_spectral_SolverPolarisation_label)
|
||||||
if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0) &
|
if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0) &
|
||||||
|
@ -523,8 +523,8 @@ program DAMASK_spectral
|
||||||
select case(loadCases(currentLoadCase)%ID(field))
|
select case(loadCases(currentLoadCase)%ID(field))
|
||||||
case(FIELD_MECH_ID)
|
case(FIELD_MECH_ID)
|
||||||
select case (spectral_solver)
|
select case (spectral_solver)
|
||||||
case (DAMASK_spectral_SolverBasicPETSc_label)
|
case (DAMASK_spectral_SolverPETSc_label)
|
||||||
call BasicPETSc_forward (&
|
call PETSc_forward (&
|
||||||
guess,timeinc,timeIncOld,remainingLoadCaseTime, &
|
guess,timeinc,timeIncOld,remainingLoadCaseTime, &
|
||||||
deformation_BC = loadCases(currentLoadCase)%deformation, &
|
deformation_BC = loadCases(currentLoadCase)%deformation, &
|
||||||
stress_BC = loadCases(currentLoadCase)%stress, &
|
stress_BC = loadCases(currentLoadCase)%stress, &
|
||||||
|
@ -552,8 +552,8 @@ program DAMASK_spectral
|
||||||
select case(loadCases(currentLoadCase)%ID(field))
|
select case(loadCases(currentLoadCase)%ID(field))
|
||||||
case(FIELD_MECH_ID)
|
case(FIELD_MECH_ID)
|
||||||
select case (spectral_solver)
|
select case (spectral_solver)
|
||||||
case (DAMASK_spectral_SolverBasicPETSc_label)
|
case (DAMASK_spectral_SolverPETSc_label)
|
||||||
solres(field) = BasicPETSC_solution (&
|
solres(field) = PETSc_solution (&
|
||||||
incInfo,timeinc,timeIncOld, &
|
incInfo,timeinc,timeIncOld, &
|
||||||
stress_BC = loadCases(currentLoadCase)%stress, &
|
stress_BC = loadCases(currentLoadCase)%stress, &
|
||||||
rotation_BC = loadCases(currentLoadCase)%rotation)
|
rotation_BC = loadCases(currentLoadCase)%rotation)
|
||||||
|
@ -685,7 +685,7 @@ subroutine quit(stop_id)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pInt
|
pInt
|
||||||
use spectral_mech_Basic, only: &
|
use spectral_mech_Basic, only: &
|
||||||
BasicPETSC_destroy
|
PETSc_destroy
|
||||||
use spectral_mech_Polarisation, only: &
|
use spectral_mech_Polarisation, only: &
|
||||||
Polarisation_destroy
|
Polarisation_destroy
|
||||||
use spectral_damage, only: &
|
use spectral_damage, only: &
|
||||||
|
@ -708,7 +708,7 @@ subroutine quit(stop_id)
|
||||||
PETScFinalize, &
|
PETScFinalize, &
|
||||||
MPI_finalize
|
MPI_finalize
|
||||||
|
|
||||||
call BasicPETSC_destroy()
|
call PETSc_destroy()
|
||||||
call Polarisation_destroy()
|
call Polarisation_destroy()
|
||||||
call spectral_damage_destroy()
|
call spectral_damage_destroy()
|
||||||
call spectral_thermal_destroy()
|
call spectral_thermal_destroy()
|
||||||
|
|
|
@ -111,7 +111,7 @@ module numerics
|
||||||
character(len=64), private :: &
|
character(len=64), private :: &
|
||||||
fftw_plan_mode = 'FFTW_PATIENT' !< reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
|
fftw_plan_mode = 'FFTW_PATIENT' !< reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
|
||||||
character(len=64), protected, public :: &
|
character(len=64), protected, public :: &
|
||||||
spectral_solver = 'basicpetsc' , & !< spectral solution method
|
spectral_solver = 'petsc' , & !< spectral solution method
|
||||||
spectral_derivative = 'continuous' !< spectral spatial derivative method
|
spectral_derivative = 'continuous' !< spectral spatial derivative method
|
||||||
character(len=1024), protected, public :: &
|
character(len=1024), protected, public :: &
|
||||||
petsc_defaultOptions = '-mech_snes_type ngmres &
|
petsc_defaultOptions = '-mech_snes_type ngmres &
|
||||||
|
|
|
@ -19,7 +19,7 @@ module spectral_mech_basic
|
||||||
#include <petsc/finclude/petsc.h90>
|
#include <petsc/finclude/petsc.h90>
|
||||||
|
|
||||||
character (len=*), parameter, public :: &
|
character (len=*), parameter, public :: &
|
||||||
DAMASK_spectral_SolverBasicPETSC_label = 'basicpetsc'
|
DAMASK_spectral_SolverPETSC_label = 'petsc'
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! derived types
|
! derived types
|
||||||
|
@ -62,10 +62,10 @@ module spectral_mech_basic
|
||||||
real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal
|
real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal
|
||||||
|
|
||||||
public :: &
|
public :: &
|
||||||
basicPETSc_init, &
|
PETSc_init, &
|
||||||
basicPETSc_solution, &
|
PETSc_solution, &
|
||||||
BasicPETSc_forward, &
|
PETSc_forward, &
|
||||||
basicPETSc_destroy
|
PETSc_destroy
|
||||||
external :: &
|
external :: &
|
||||||
PETScFinalize, &
|
PETScFinalize, &
|
||||||
MPI_Abort, &
|
MPI_Abort, &
|
||||||
|
@ -77,7 +77,7 @@ contains
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief allocates all necessary fields and fills them with data, potentially from restart info
|
!> @brief allocates all necessary fields and fills them with data, potentially from restart info
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine basicPETSc_init
|
subroutine PETSc_init
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
use, intrinsic :: iso_fortran_env, only: &
|
||||||
compiler_version, &
|
compiler_version, &
|
||||||
|
@ -134,7 +134,7 @@ subroutine basicPETSc_init
|
||||||
SNESSetConvergenceTest, &
|
SNESSetConvergenceTest, &
|
||||||
SNESSetFromOptions
|
SNESSetFromOptions
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverBasicPETSc init -+>>>'
|
write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverPETSc init -+>>>'
|
||||||
write(6,'(/,a)') ' Shanthraj et al., International Journal of Plasticity, 66:31–45, 2015'
|
write(6,'(/,a)') ' Shanthraj et al., International Journal of Plasticity, 66:31–45, 2015'
|
||||||
write(6,'(/,a)') ' https://doi.org/10.1016/j.ijplas.2014.02.006'
|
write(6,'(/,a)') ' https://doi.org/10.1016/j.ijplas.2014.02.006'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
|
@ -164,9 +164,9 @@ subroutine basicPETSc_init
|
||||||
CHKERRQ(ierr)
|
CHKERRQ(ierr)
|
||||||
call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da
|
call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da
|
||||||
call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) ! global solution vector (grid x 9, i.e. every def grad tensor)
|
call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) ! global solution vector (grid x 9, i.e. every def grad tensor)
|
||||||
call DMDASNESSetFunctionLocal(da,INSERT_VALUES,BasicPETSC_formResidual,PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector
|
call DMDASNESSetFunctionLocal(da,INSERT_VALUES,PETSC_formResidual,PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector
|
||||||
CHKERRQ(ierr)
|
CHKERRQ(ierr)
|
||||||
call SNESSetConvergenceTest(snes,BasicPETSC_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged"
|
call SNESSetConvergenceTest(snes,PETSC_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged"
|
||||||
CHKERRQ(ierr)
|
CHKERRQ(ierr)
|
||||||
call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments
|
call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments
|
||||||
|
|
||||||
|
@ -218,12 +218,12 @@ subroutine basicPETSc_init
|
||||||
|
|
||||||
call Utilities_updateGamma(C_minMaxAvg,.true.)
|
call Utilities_updateGamma(C_minMaxAvg,.true.)
|
||||||
|
|
||||||
end subroutine basicPETSc_init
|
end subroutine PETSc_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief solution for the Basic PETSC scheme with internal iterations
|
!> @brief solution for the PETSC scheme with internal iterations
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
type(tSolutionState) function basicPETSc_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC)
|
type(tSolutionState) function PETSc_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC)
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_error
|
IO_error
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
|
@ -282,19 +282,19 @@ type(tSolutionState) function basicPETSc_solution(incInfoIn,timeinc,timeinc_old,
|
||||||
! check convergence
|
! check convergence
|
||||||
call SNESGetConvergedReason(snes,reason,ierr); CHKERRQ(ierr)
|
call SNESGetConvergedReason(snes,reason,ierr); CHKERRQ(ierr)
|
||||||
|
|
||||||
BasicPETSc_solution%converged = reason > 0
|
PETSc_solution%converged = reason > 0
|
||||||
basicPETSC_solution%iterationsNeeded = totalIter
|
PETSC_solution%iterationsNeeded = totalIter
|
||||||
basicPETSc_solution%termIll = terminallyIll
|
PETSc_solution%termIll = terminallyIll
|
||||||
terminallyIll = .false.
|
terminallyIll = .false.
|
||||||
if (reason == -4) call IO_error(893_pInt) ! MPI error
|
if (reason == -4) call IO_error(893_pInt) ! MPI error
|
||||||
|
|
||||||
end function BasicPETSc_solution
|
end function PETSc_solution
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief forms the basic residual vector
|
!> @brief forms the residual vector
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr)
|
subroutine PETSC_formResidual(in,x_scal,f_scal,dummy,ierr)
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
itmax, &
|
itmax, &
|
||||||
itmin
|
itmin
|
||||||
|
@ -381,13 +381,13 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr)
|
||||||
! constructing residual
|
! constructing residual
|
||||||
f_scal = tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) ! Gamma*P gives correction towards div(P) = 0, so needs to be zero, too
|
f_scal = tensorField_real(1:3,1:3,1:grid(1),1:grid(2),1:grid3) ! Gamma*P gives correction towards div(P) = 0, so needs to be zero, too
|
||||||
|
|
||||||
end subroutine BasicPETSc_formResidual
|
end subroutine PETSc_formResidual
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief convergence check
|
!> @brief convergence check
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
subroutine PETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr)
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
itmax, &
|
itmax, &
|
||||||
itmin, &
|
itmin, &
|
||||||
|
@ -436,14 +436,14 @@ subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,du
|
||||||
write(6,'(/,a)') ' ==========================================================================='
|
write(6,'(/,a)') ' ==========================================================================='
|
||||||
flush(6)
|
flush(6)
|
||||||
|
|
||||||
end subroutine BasicPETSc_converged
|
end subroutine PETSc_converged
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief forwarding routine
|
!> @brief forwarding routine
|
||||||
!> @details find new boundary conditions and best F estimate for end of current timestep
|
!> @details find new boundary conditions and best F estimate for end of current timestep
|
||||||
!> possibly writing restart information, triggering of state increment in DAMASK, and updating of IPcoordinates
|
!> possibly writing restart information, triggering of state increment in DAMASK, and updating of IPcoordinates
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC)
|
subroutine PETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC)
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_mul33x33 ,&
|
math_mul33x33 ,&
|
||||||
math_rotate_backward33
|
math_rotate_backward33
|
||||||
|
@ -549,12 +549,12 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation
|
||||||
math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid3])
|
math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid3])
|
||||||
call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr)
|
call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr)
|
||||||
|
|
||||||
end subroutine BasicPETSc_forward
|
end subroutine PETSc_forward
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief destroy routine
|
!> @brief destroy routine
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine BasicPETSc_destroy()
|
subroutine PETSc_destroy()
|
||||||
use spectral_utilities, only: &
|
use spectral_utilities, only: &
|
||||||
Utilities_destroy
|
Utilities_destroy
|
||||||
|
|
||||||
|
@ -570,6 +570,6 @@ subroutine BasicPETSc_destroy()
|
||||||
call SNESDestroy(snes,ierr); CHKERRQ(ierr)
|
call SNESDestroy(snes,ierr); CHKERRQ(ierr)
|
||||||
call DMDestroy(da,ierr); CHKERRQ(ierr)
|
call DMDestroy(da,ierr); CHKERRQ(ierr)
|
||||||
|
|
||||||
end subroutine BasicPETSc_destroy
|
end subroutine PETSc_destroy
|
||||||
|
|
||||||
end module spectral_mech_basic
|
end module spectral_mech_basic
|
||||||
|
|
Loading…
Reference in New Issue