[skip ci] polishing

This commit is contained in:
Martin Diehl 2020-06-29 15:09:13 +02:00
parent a40d53d308
commit 640bc7b190
18 changed files with 55 additions and 63 deletions

View File

@ -49,7 +49,7 @@ module CPFEM
iJacoStiffness !< frequency of stiffness update
end type tNumerics
type(tNumerics), private :: num
type(tNumerics), private :: num
public :: &
CPFEM_general, &

View File

@ -36,8 +36,8 @@ end subroutine YAML_init
!--------------------------------------------------------------------------------------------------
recursive function parse_flow(flow_string) result(node)
character(len=*), intent(inout) :: flow_string !< YAML file in flow style
class (tNode), pointer :: node
character(len=*), intent(inout) :: flow_string !< YAML file in flow style
class (tNode), pointer :: node
class (tNode), pointer :: myVal
character(len=pStringLen) :: key

View File

@ -84,7 +84,7 @@ module crystallite
nState, & !< state loop limit
nStress !< stress loop limit
character(len=:), allocatable :: &
integrator !< integrator scheme
integrator !< integration scheme
real(pReal) :: &
subStepMinCryst, & !< minimum (relative) size of sub-step allowed during cutback
subStepSizeCryst, & !< size of first substep when cutback

View File

@ -56,7 +56,6 @@ subroutine damage_local_init
num_generic => numerics_root%get('generic',defaultVal=emptyDict)
num%residualStiffness = num_generic%get_asFloat('residualStiffness', defaultVal=1.0e-6_pReal)
if (num%residualStiffness < 0.0_pReal) call IO_error(301,ext_msg='residualStiffness')
!----------------------------------------------------------------------------------------------
Ninstance = count(damage_type == DAMAGE_local_ID)
allocate(param(Ninstance))
@ -102,7 +101,6 @@ function damage_local_updateState(subdt, ip, el)
real(pReal) :: &
phi, phiDot, dPhiDot_dPhi
homog = material_homogenizationAt(el)
offset = material_homogenizationMemberAt(ip,el)
phi = damageState(homog)%subState0(1,offset)

View File

@ -60,7 +60,6 @@ subroutine damage_nonlocal_init
! read numerics parameter
num_generic => numerics_root%get('generic',defaultVal= emptyDict)
num%charLength = num_generic%get_asFloat('charLength',defaultVal=1.0_pReal)
!------------------------------------------------------------------------------------
Ninstance = count(damage_type == DAMAGE_nonlocal_ID)
allocate(param(Ninstance))

View File

@ -47,6 +47,7 @@ module grid_mech_FEM
end type tNumerics
type(tNumerics), private :: num
!--------------------------------------------------------------------------------------------------
! PETSc data
DM, private :: mech_grid
@ -454,8 +455,6 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,fnorm,reason,dummy,i
divTol, &
BCTol
!------------------------------------------------------------------------------------
err_div = fnorm*sqrt(wgt)*geomSize(1)/scaledGeomSize(1)/detJ
divTol = max(maxval(abs(P_av))*num%eps_div_rtol ,num%eps_div_atol)
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol,num%eps_stress_atol)

View File

@ -28,7 +28,7 @@ module grid_mech_spectral_basic
!--------------------------------------------------------------------------------------------------
! derived types
type(tSolutionParams), private :: params
type(tSolutionParams) :: params
type, private :: tNumerics
logical :: update_gamma !< update gamma operator with current stiffness
@ -44,29 +44,29 @@ module grid_mech_spectral_basic
petsc_options
end type tNumerics
type(tNumerics), private :: num ! numerics parameters. Better name?
type(tNumerics) :: num ! numerics parameters. Better name?
!--------------------------------------------------------------------------------------------------
! PETSc data
DM, private :: da
SNES, private :: snes
Vec, private :: solution_vec
DM :: da
SNES :: snes
Vec :: solution_vec
!--------------------------------------------------------------------------------------------------
! common pointwise data
real(pReal), private, dimension(:,:,:,:,:), allocatable :: &
real(pReal), dimension(:,:,:,:,:), allocatable :: &
F_lastInc, & !< field of previous compatible deformation gradients
Fdot !< field of assumed rate of compatible deformation gradient
!--------------------------------------------------------------------------------------------------
! stress, stiffness and compliance average etc.
real(pReal), private, dimension(3,3) :: &
real(pReal), dimension(3,3) :: &
F_aimDot = 0.0_pReal, & !< assumed rate of average deformation gradient
F_aim = math_I3, & !< current prescribed deformation gradient
F_aim_lastInc = math_I3, & !< previous average deformation gradient
P_av = 0.0_pReal !< average 1st Piola--Kirchhoff stress
character(len=pStringLen), private :: incInfo !< time and increment information
character(len=pStringLen) :: incInfo !< time and increment information
real(pReal), private, dimension(3,3,3,3) :: &
C_volAvg = 0.0_pReal, & !< current volume average stiffness
C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness
@ -74,11 +74,11 @@ module grid_mech_spectral_basic
C_minMaxAvgLastInc = 0.0_pReal, & !< previous (min+max)/2 stiffness
S = 0.0_pReal !< current compliance (filled up with zeros)
real(pReal), private :: &
real(pReal) :: &
err_BC, & !< deviation from stress BC
err_div !< RMS of div of P
integer, private :: &
integer :: &
totalIter = 0 !< total iteration in current increment
public :: &

View File

@ -29,9 +29,9 @@ module grid_mech_spectral_polarisation
!--------------------------------------------------------------------------------------------------
! derived types
type(tSolutionParams), private :: params
type(tSolutionParams) :: params
type, private :: tNumerics
type :: tNumerics
logical :: update_gamma !< update gamma operator with current stiffness
character(len=:), allocatable :: &
petsc_options
@ -46,21 +46,21 @@ module grid_mech_spectral_polarisation
eps_stress_atol, & !< absolute tolerance for fullfillment of stress BC
eps_stress_rtol !< relative tolerance for fullfillment of stress BC
real(pReal) :: &
alpha, & !< polarization scheme parameter 0.0 < alpha < 2.0. alpha = 1.0 ==> AL scheme, alpha = 2.0 ==> accelerated scheme
beta !< polarization scheme parameter 0.0 < beta < 2.0. beta = 1.0 ==> AL scheme, beta = 2.0 ==> accelerated scheme
alpha, & !< polarization scheme parameter 0.0 < alpha < 2.0. alpha = 1.0 ==> AL scheme, alpha = 2.0 ==> accelerated scheme
beta !< polarization scheme parameter 0.0 < beta < 2.0. beta = 1.0 ==> AL scheme, beta = 2.0 ==> accelerated scheme
end type tNumerics
type(tNumerics), private :: num ! numerics parameters. Better name?
type(tNumerics) :: num ! numerics parameters. Better name?
!--------------------------------------------------------------------------------------------------
! PETSc data
DM, private :: da
SNES, private :: snes
Vec, private :: solution_vec
DM :: da
SNES :: snes
Vec :: solution_vec
!--------------------------------------------------------------------------------------------------
! common pointwise data
real(pReal), private, dimension(:,:,:,:,:), allocatable :: &
real(pReal), dimension(:,:,:,:,:), allocatable :: &
F_lastInc, & !< field of previous compatible deformation gradients
F_tau_lastInc, & !< field of previous incompatible deformation gradient
Fdot, & !< field of assumed rate of compatible deformation gradient
@ -68,15 +68,15 @@ module grid_mech_spectral_polarisation
!--------------------------------------------------------------------------------------------------
! stress, stiffness and compliance average etc.
real(pReal), private, dimension(3,3) :: &
real(pReal), dimension(3,3) :: &
F_aimDot = 0.0_pReal, & !< assumed rate of average deformation gradient
F_aim = math_I3, & !< current prescribed deformation gradient
F_aim_lastInc = math_I3, & !< previous average deformation gradient
F_av = 0.0_pReal, & !< average incompatible def grad field
P_av = 0.0_pReal !< average 1st Piola--Kirchhoff stress
character(len=pStringLen), private :: incInfo !< time and increment information
real(pReal), private, dimension(3,3,3,3) :: &
character(len=pStringLen) :: incInfo !< time and increment information
real(pReal), dimension(3,3,3,3) :: &
C_volAvg = 0.0_pReal, & !< current volume average stiffness
C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness
C_minMaxAvg = 0.0_pReal, & !< current (min+max)/2 stiffness
@ -85,12 +85,12 @@ module grid_mech_spectral_polarisation
C_scale = 0.0_pReal, &
S_scale = 0.0_pReal
real(pReal), private :: &
real(pReal) :: &
err_BC, & !< deviation from stress BC
err_curl, & !< RMS of curl of F
err_div !< RMS of div of P
integer, private :: &
integer :: &
totalIter = 0 !< total iteration in current increment
public :: &

View File

@ -24,9 +24,9 @@ module grid_thermal_spectral
!--------------------------------------------------------------------------------------------------
! derived types
type(tSolutionParams), private :: params
type(tSolutionParams) :: params
type, private :: tNumerics
type :: tNumerics
real(pReal) :: &
eps_thermal_atol, & !< absolute tolerance for thermal equilibrium
eps_thermal_rtol !< relative tolerance for thermal equilibrium
@ -34,30 +34,28 @@ module grid_thermal_spectral
petsc_options
end type tNumerics
type(tNumerics), private :: num
type(tNumerics) :: num
!--------------------------------------------------------------------------------------------------
! PETSc data
SNES, private :: thermal_snes
Vec, private :: solution_vec
PetscInt, private :: xstart, xend, ystart, yend, zstart, zend
real(pReal), private, dimension(:,:,:), allocatable :: &
SNES :: thermal_snes
Vec :: solution_vec
PetscInt :: xstart, xend, ystart, yend, zstart, zend
real(pReal), dimension(:,:,:), allocatable :: &
T_current, & !< field of current temperature
T_lastInc, & !< field of previous temperature
T_stagInc !< field of staggered temperature
!--------------------------------------------------------------------------------------------------
! reference diffusion tensor, mobility etc.
integer, private :: totalIter = 0 !< total iteration in current increment
real(pReal), dimension(3,3), private :: K_ref
real(pReal), private :: mu_ref
integer :: totalIter = 0 !< total iteration in current increment
real(pReal), dimension(3,3) :: K_ref
real(pReal) :: mu_ref
public :: &
grid_thermal_spectral_init, &
grid_thermal_spectral_solution, &
grid_thermal_spectral_forward
private :: &
formResidual
contains
@ -94,7 +92,8 @@ subroutine grid_thermal_spectral_init
! set default and user defined options for PETSc
call PETScOptionsInsertString(PETSC_NULL_OPTIONS,'-thermal_snes_type ngmres',ierr)
CHKERRQ(ierr)
call PETScOptionsInsertString(PETSC_NULL_OPTIONS,num%petsc_options,ierr)
call PETScOptionsInsertString(PETSC_NULL_OPTIONS,&
num_grid%get_asString('petsc_options',defaultVal=''),ierr)
CHKERRQ(ierr)
!--------------------------------------------------------------------------------------------------
@ -168,7 +167,7 @@ function grid_thermal_spectral_solution(timeinc,timeinc_old) result(solution)
SNESConvergedReason :: reason
!-------------------------------------------------------------------
! reading numerical parameter and do sanity check
! reading numerical parameter and do sanity check !TODO: MD: Not Here
num_grid => numerics_root%get('grid',defaultVal=emptyDict)
itmax = num_grid%get_asInt('itmax',defaultVal=250)
if (itmax <= 1) call IO_error(301,ext_msg='itmax')

View File

@ -218,13 +218,13 @@ subroutine spectral_utilities_init
' add more using the PETSc_Options keyword in numerics.config '; flush(6)
num_grid => numerics_root%get('grid',defaultVal=emptyDict)
num%petsc_options = num_grid%get_asString('petsc_options',defaultVal='')
call PETScOptionsClear(PETSC_NULL_OPTIONS,ierr)
CHKERRQ(ierr)
if(debugPETSc) call PETScOptionsInsertString(PETSC_NULL_OPTIONS,trim(PETSCDEBUG),ierr)
CHKERRQ(ierr)
call PETScOptionsInsertString(PETSC_NULL_OPTIONS,num%petsc_options,ierr)
call PETScOptionsInsertString(PETSC_NULL_OPTIONS,&
num_grid%get_asString('petsc_options',defaultVal=''),ierr)
CHKERRQ(ierr)
grid1Red = grid(1)/2 + 1

View File

@ -174,7 +174,6 @@ subroutine homogenization_init
num%subStepSizeHomog = num_homogGeneric%get_asFloat('subStepSize', defaultVal=0.25_pReal)
num%stepIncreaseHomog = num_homogGeneric%get_asFloat('stepIncrease', defaultVal=1.5_pReal)
if (num%nMPstate < 1) call IO_error(301,ext_msg='nMPstate')
if (num%subStepMinHomog <= 0.0_pReal) call IO_error(301,ext_msg='subStepMinHomog')
if (num%subStepSizeHomog <= 0.0_pReal) call IO_error(301,ext_msg='subStepSizeHomog')

View File

@ -122,7 +122,6 @@ module subroutine mech_RGC_init(num_homogMech)
num%volDiscrMod = num_RGC%get_asFloat('voldiscrepancymod', defaultVal=1.0e+12_pReal)
num%volDiscrPow = num_RGC%get_asFloat('dicrepancypower', defaultVal=5.0_pReal)
if (num%atol <= 0.0_pReal) call IO_error(301,ext_msg='absTol_RGC')
if (num%rtol <= 0.0_pReal) call IO_error(301,ext_msg='relTol_RGC')
if (num%absMax <= 0.0_pReal) call IO_error(301,ext_msg='absMax_RGC')

View File

@ -85,7 +85,7 @@ module math
module procedure math_identity2nd
end interface math_eye
! ToDo: Since random seed is needed only once, I would simplify here
!---------------------------------------------------------------------------------------------------
private :: &
selfTest

View File

@ -96,6 +96,7 @@ module FEM_utilities
contains
!ToDo: use functions in variable call
!--------------------------------------------------------------------------------------------------
!> @brief allocates all neccessary fields, sets debug flags
!--------------------------------------------------------------------------------------------------

View File

@ -83,7 +83,6 @@ subroutine discretization_mesh_init(restart)
num_mesh
integer :: integrationOrder !< order of quadrature rule required
write(6,'(/,a)') ' <<<+- mesh init -+>>>'
num_mesh => numerics_root%get('mesh',defaultVal=emptyDict)

View File

@ -294,7 +294,6 @@ type(tSolutionState) function FEM_mech_solution( &
character(len=*), intent(in) :: &
incInfoIn
PetscErrorCode :: ierr
SNESConvergedReason :: reason