added "public" (and where possible "protected") statements to functions/subroutines/variables/parameters where needed

added -fmodule-private to compile options for gfortran, i.e. gfortran won't compile anymore if an entity is not explicitly declared as public but used in another module to ensure stronger encapsulation
This commit is contained in:
Martin Diehl 2013-03-28 07:40:30 +00:00
parent b2a2c5f528
commit 745ca5a6a5
7 changed files with 105 additions and 85 deletions

View File

@ -47,6 +47,9 @@ module CPFEM
CPFEM_RESTOREJACOBIAN = 2_pInt**3_pInt, &
CPFEM_COLLECT = 2_pInt**4_pInt, &
CPFEM_EXPLICIT = 2_pInt**5_pInt
public ::CPFEM_general, &
CPFEM_initAll
contains

View File

@ -87,7 +87,11 @@ module DAMASK_spectral_solverAL
err_p !< difference of stress resulting from compatible and incompatible F
logical, private :: ForwardData
integer(pInt), private :: reportIter = 0_pInt
public :: &
AL_init, &
AL_solution, &
AL_destroy
external :: &
VecDestroy, &
DMDestroy, &

View File

@ -55,7 +55,10 @@ module DAMASK_spectral_SolverBasic
real(pReal), private,dimension(3,3,3,3) :: &
C = 0.0_pReal, C_minmaxAvg = 0.0_pReal, & !< average stiffness
C_lastInc = 0.0_pReal !< average stiffness last increment
public :: &
basic_init, &
basic_solution, &
basic_destroy
contains
!--------------------------------------------------------------------------------------------------

View File

@ -72,14 +72,14 @@ module DAMASK_spectral_utilities
!--------------------------------------------------------------------------------------------------
! derived types
type tSolutionState !< return type of solution from spectral solver variants
type, public :: tSolutionState !< return type of solution from spectral solver variants
logical :: converged = .true.
logical :: regrid = .false.
logical :: termIll = .false.
integer(pInt) :: iterationsNeeded = 0_pInt
end type tSolutionState
type tBoundaryCondition !< set of parameters defining a boundary condition
type, public :: tBoundaryCondition !< set of parameters defining a boundary condition
real(pReal), dimension(3,3) :: values = 0.0_pReal
real(pReal), dimension(3,3) :: maskFloat = 0.0_pReal
logical, dimension(3,3) :: maskLogical = .false.

View File

@ -147,7 +147,6 @@ COMPILE_OPTIONS_ifort +=-fpp\
-assume byterecl
ifneq "$(FASTBUILD)" "YES"
COMPILE_OPTIONS_ifort +=$(COMPILE_OPTIONS_ifort)\
-implicitnone\
-diag-enable sc3\
-diag-disable 5268\
-warn declarations\
@ -167,7 +166,7 @@ endif
#-diag-disable: disables warnings, where
# warning ID 5268: the text exceeds right hand column allowed on the line (we have only comments there)
#-warn: enables warnings, where
# declarations: any undeclared names
# declarations: any undeclared names (alternative name: -implicitnone)
# general: warning messages and informational messages are issued by the compiler
# usage: questionable programming practices
# interfaces: checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks
@ -183,6 +182,7 @@ endif
# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132)
# uncalled: Determines whether warnings occur when a statement function is never called
# all:
# -name as_is: case sensitive Fortran!
DEBUG_OPTIONS_ifort :=-g\
-traceback\
@ -209,14 +209,13 @@ DEBUG_OPTIONS_ifort :=-g\
#-heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits
#-check: checks at runtime, where
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
#-fmodule-private add later
# stack:
COMPILE_OPTIONS_gfortran :=-xf95-cpp-input
ifneq "$(FASTBUILD)" "YES"
COMPILE_OPTIONS_gfortran +=$(COMPILE_OPTIONS_gfortran)\
-ffree-line-length-132\
-fimplicit-none\
-fmodule-private\
-Wall\
-Wextra\
-Wcharacter-truncation\
@ -232,6 +231,7 @@ endif
#-ffree-line-length-132: restrict line length to the standard 132 characters
#-fno-range-check: disables checking if result can be represented by variable. Needs to be set to enable DAMASK_NaN
#-fimplicit-none: assume "implicit-none" even if not present in source
#-fmodule-private: assume "private" even if not present in source
#-Wcharacter-truncation: warn if character expressions (strings) are truncated
#-Wunderflow: produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation
#-Wsuggest-attribute=pure:

View File

@ -29,7 +29,7 @@ use prec, only: pReal,pInt
implicit none
!* Lists of states and physical parameters
character(len=*), parameter :: constitutive_dislotwin_label = 'dislotwin'
character(len=*), parameter, public :: constitutive_dislotwin_label = 'dislotwin'
character(len=18), dimension(2), parameter:: constitutive_dislotwin_listBasicSlipStates = (/'rhoEdge ', &
'rhoEdgeDip'/)
character(len=18), dimension(1), parameter:: constitutive_dislotwin_listBasicTwinStates = (/'twinFraction'/)
@ -44,13 +44,16 @@ character(len=18), dimension(4), parameter:: constitutive_dislotwin_listDependen
real(pReal), parameter :: kB = 1.38e-23_pReal ! Boltzmann constant in J/Kelvin
!* Definition of global variables
integer(pInt), dimension(:), allocatable :: constitutive_dislotwin_sizeDotState, & ! number of dotStates
constitutive_dislotwin_sizeState, & ! total number of microstructural state variables
constitutive_dislotwin_sizePostResults ! cumulative size of post results
integer(pInt), dimension(:,:), allocatable, target :: constitutive_dislotwin_sizePostResult ! size of each post result output
character(len=64), dimension(:,:), allocatable, target :: constitutive_dislotwin_output ! name of each post result output
integer(pInt), dimension(:), allocatable, public, protected :: &
constitutive_dislotwin_sizeDotState, & ! number of dotStates
constitutive_dislotwin_sizeState, & ! total number of microstructural state variables
constitutive_dislotwin_sizePostResults ! cumulative size of post results
integer(pInt), dimension(:,:), allocatable, target, public :: &
constitutive_dislotwin_sizePostResult ! size of each post result output
character(len=64), dimension(:,:), allocatable, target, public :: &
constitutive_dislotwin_output ! name of each post result output
integer(pInt), dimension(:), allocatable :: constitutive_dislotwin_Noutput ! number of outputs per instance of this plasticity
character(len=32), dimension(:), allocatable :: constitutive_dislotwin_structureName ! name of the lattice structure
character(len=32), dimension(:), allocatable, public, protected :: constitutive_dislotwin_structureName ! name of the lattice structure
integer(pInt), dimension(:), allocatable :: constitutive_dislotwin_structure, & ! number representing the kind of lattice structure
constitutive_dislotwin_totalNslip, & ! total number of active slip systems for each instance
constitutive_dislotwin_totalNtwin ! total number of active twin systems for each instance
@ -78,50 +81,57 @@ real(pReal), dimension(:), allocatable :: constitutive_dislotwin
constitutive_dislotwin_dSFE_dT, & ! temperature dependance of stacking fault energy
constitutive_dislotwin_aTolRho, & ! absolute tolerance for integration of dislocation density
constitutive_dislotwin_aTolTwinFrac ! absolute tolerance for integration of twin volume fraction
real(pReal), dimension(:,:,:), allocatable :: constitutive_dislotwin_Cslip_66 ! elasticity matrix in Mandel notation for each instance
real(pReal), dimension(:,:,:,:), allocatable :: constitutive_dislotwin_Ctwin_66 ! twin elasticity matrix in Mandel notation for each instance
real(pReal), dimension(:,:,:,:,:), allocatable :: constitutive_dislotwin_Cslip_3333 ! elasticity matrix for each instance
real(pReal), dimension(:,:,:,:,:,:), allocatable :: constitutive_dislotwin_Ctwin_3333 ! twin elasticity matrix for each instance
real(pReal), dimension(:,:), allocatable :: constitutive_dislotwin_rhoEdge0, & ! initial edge dislocation density per slip system for each family and instance
constitutive_dislotwin_rhoEdgeDip0, & ! initial edge dipole density per slip system for each family and instance
constitutive_dislotwin_burgersPerSlipFamily, & ! absolute length of burgers vector [m] for each slip family and instance
constitutive_dislotwin_burgersPerSlipSystem, & ! absolute length of burgers vector [m] for each slip system and instance
constitutive_dislotwin_burgersPerTwinFamily, & ! absolute length of burgers vector [m] for each twin family and instance
constitutive_dislotwin_burgersPerTwinSystem, & ! absolute length of burgers vector [m] for each twin system and instance
constitutive_dislotwin_QedgePerSlipFamily, & ! activation energy for glide [J] for each slip family and instance
constitutive_dislotwin_QedgePerSlipSystem, & ! activation energy for glide [J] for each slip system and instance
constitutive_dislotwin_v0PerSlipFamily, & ! dislocation velocity prefactor [m/s] for each family and instance
constitutive_dislotwin_v0PerSlipSystem, & ! dislocation velocity prefactor [m/s] for each slip system and instance
constitutive_dislotwin_Ndot0PerTwinFamily, & ! twin nucleation rate [1/m³s] for each twin family and instance
constitutive_dislotwin_Ndot0PerTwinSystem, & ! twin nucleation rate [1/m³s] for each twin system and instance
constitutive_dislotwin_twinsizePerTwinFamily, & ! twin thickness [m] for each twin family and instance
constitutive_dislotwin_twinsizePerTwinSystem, & ! twin thickness [m] for each twin system and instance
constitutive_dislotwin_CLambdaSlipPerSlipFamily, & ! Adj. parameter for distance between 2 forest dislocations for each slip family and instance
constitutive_dislotwin_CLambdaSlipPerSlipSystem, & ! Adj. parameter for distance between 2 forest dislocations for each slip system and instance
constitutive_dislotwin_interaction_SlipSlip, & ! coefficients for slip-slip interaction for each interaction type and instance
constitutive_dislotwin_interaction_SlipTwin, & ! coefficients for slip-twin interaction for each interaction type and instance
constitutive_dislotwin_interaction_TwinSlip, & ! coefficients for twin-slip interaction for each interaction type and instance
constitutive_dislotwin_interaction_TwinTwin ! coefficients for twin-twin interaction for each interaction type and instance
real(pReal), dimension(:,:,:), allocatable :: constitutive_dislotwin_interactionMatrix_SlipSlip, & ! interaction matrix of the different slip systems for each instance
constitutive_dislotwin_interactionMatrix_SlipTwin, & ! interaction matrix of slip systems with twin systems for each instance
constitutive_dislotwin_interactionMatrix_TwinSlip, & ! interaction matrix of twin systems with slip systems for each instance
constitutive_dislotwin_interactionMatrix_TwinTwin, & ! interaction matrix of the different twin systems for each instance
constitutive_dislotwin_forestProjectionEdge ! matrix of forest projections of edge dislocations for each instance
real(pReal), dimension(:,:,:), allocatable :: &
constitutive_dislotwin_Cslip_66 ! elasticity matrix in Mandel notation for each instance
real(pReal), dimension(:,:,:,:), allocatable :: &
constitutive_dislotwin_Ctwin_66 ! twin elasticity matrix in Mandel notation for each instance
real(pReal), dimension(:,:,:,:,:), allocatable :: &
constitutive_dislotwin_Cslip_3333 ! elasticity matrix for each instance
real(pReal), dimension(:,:,:,:,:,:), allocatable :: &
constitutive_dislotwin_Ctwin_3333 ! twin elasticity matrix for each instance
real(pReal), dimension(:,:), allocatable :: &
constitutive_dislotwin_rhoEdge0, & ! initial edge dislocation density per slip system for each family and instance
constitutive_dislotwin_rhoEdgeDip0, & ! initial edge dipole density per slip system for each family and instance
constitutive_dislotwin_burgersPerSlipFamily, & ! absolute length of burgers vector [m] for each slip family and instance
constitutive_dislotwin_burgersPerSlipSystem, & ! absolute length of burgers vector [m] for each slip system and instance
constitutive_dislotwin_burgersPerTwinFamily, & ! absolute length of burgers vector [m] for each twin family and instance
constitutive_dislotwin_burgersPerTwinSystem, & ! absolute length of burgers vector [m] for each twin system and instance
constitutive_dislotwin_QedgePerSlipFamily, & ! activation energy for glide [J] for each slip family and instance
constitutive_dislotwin_QedgePerSlipSystem, & ! activation energy for glide [J] for each slip system and instance
constitutive_dislotwin_v0PerSlipFamily, & ! dislocation velocity prefactor [m/s] for each family and instance
constitutive_dislotwin_v0PerSlipSystem, & ! dislocation velocity prefactor [m/s] for each slip system and instance
constitutive_dislotwin_Ndot0PerTwinFamily, & ! twin nucleation rate [1/m³s] for each twin family and instance
constitutive_dislotwin_Ndot0PerTwinSystem, & ! twin nucleation rate [1/m³s] for each twin system and instance
constitutive_dislotwin_twinsizePerTwinFamily, & ! twin thickness [m] for each twin family and instance
constitutive_dislotwin_twinsizePerTwinSystem, & ! twin thickness [m] for each twin system and instance
constitutive_dislotwin_CLambdaSlipPerSlipFamily, & ! Adj. parameter for distance between 2 forest dislocations for each slip family and instance
constitutive_dislotwin_CLambdaSlipPerSlipSystem, & ! Adj. parameter for distance between 2 forest dislocations for each slip system and instance
constitutive_dislotwin_interaction_SlipSlip, & ! coefficients for slip-slip interaction for each interaction type and instance
constitutive_dislotwin_interaction_SlipTwin, & ! coefficients for slip-twin interaction for each interaction type and instance
constitutive_dislotwin_interaction_TwinSlip, & ! coefficients for twin-slip interaction for each interaction type and instance
constitutive_dislotwin_interaction_TwinTwin ! coefficients for twin-twin interaction for each interaction type and instance
real(pReal), dimension(:,:,:), allocatable :: &
constitutive_dislotwin_interactionMatrix_SlipSlip, & ! interaction matrix of the different slip systems for each instance
constitutive_dislotwin_interactionMatrix_SlipTwin, & ! interaction matrix of slip systems with twin systems for each instance
constitutive_dislotwin_interactionMatrix_TwinSlip, & ! interaction matrix of twin systems with slip systems for each instance
constitutive_dislotwin_interactionMatrix_TwinTwin, & ! interaction matrix of the different twin systems for each instance
constitutive_dislotwin_forestProjectionEdge ! matrix of forest projections of edge dislocations for each instance
real(pReal), dimension(:,:,:,:,:), allocatable :: constitutive_dislotwin_sbSv
!****************************************
public :: constitutive_dislotwin_microstructure, &
constitutive_dislotwin_init, &
constitutive_dislotwin_stateInit, &
constitutive_dislotwin_homogenizedC, &
constitutive_dislotwin_LpAndItsTangent, &
constitutive_dislotwin_dotState, &
constitutive_dislotwin_deltaState, &
constitutive_dislotwin_dotTemperature, &
constitutive_dislotwin_postResults, &
constitutive_dislotwin_aTolState
!****************************************
CONTAINS
!****************************************
!* - constitutive_dislotwin_init
!* - constitutive_dislotwin_stateInit
!* - constitutive_dislotwin_relevantState
!* - constitutive_dislotwin_homogenizedC
!* - constitutive_dislotwin_microstructure
!* - constitutive_dislotwin_LpAndItsTangent
!* - constitutive_dislotwin_dotState
!* - constitutive_dislotwin_deltaState
!* - constitutive_dislotwin_dotTemperature
!* - constitutive_dislotwin_postResults
!****************************************
subroutine constitutive_dislotwin_init(file)
!**************************************

View File

@ -44,25 +44,25 @@
! shear_pyra
! shear_pyrca
MODULE constitutive_titanmod
!* Include other modules
use prec, only: pReal,pInt
module constitutive_titanmod
use prec, only: &
pReal, &
pInt
implicit none
!* Lists of states and physical parameters
character(len=*), parameter :: &
character(len=*), parameter, public :: &
constitutive_titanmod_label = 'titanmod'
character(len=18), dimension(3), parameter :: &
constitutive_titanmod_listBasicSlipStates = (/'rho_edge ', &
constitutive_titanmod_listBasicSlipStates = ['rho_edge ', &
'rho_screw ', &
'shear_system'/)
'shear_system']
character(len=18), dimension(1), parameter :: &
constitutive_titanmod_listBasicTwinStates = (/'gdot_twin'/)
constitutive_titanmod_listBasicTwinStates = ['gdot_twin']
character(len=19), dimension(11), parameter :: &
constitutive_titanmod_listDependentSlipStates =(/'segment_edge ', &
constitutive_titanmod_listDependentSlipStates =['segment_edge ', &
'segment_screw ', &
'resistance_edge ', &
'resistance_screw ', &
@ -73,30 +73,30 @@ character(len=19), dimension(11), parameter :: &
'gdot_slip_screw ', &
'stressratio_edge_p ', &
'stressratio_screw_p' &
/)
]
character(len=18), dimension(2), parameter :: &
constitutive_titanmod_listDependentTwinStates =(/'twin_fraction', &
constitutive_titanmod_listDependentTwinStates =['twin_fraction', &
'tau_twin ' &
/)
]
real(pReal), parameter :: kB = 1.38e-23_pReal ! Boltzmann constant in J/Kelvin
!* Definition of global variables
integer(pInt), dimension(:), allocatable :: &
constitutive_titanmod_sizeDotState, & ! number of dotStates
integer(pInt), dimension(:), allocatable, public, protected :: &
constitutive_titanmod_sizeState, & ! total number of microstructural state variables
constitutive_titanmod_sizeDotState, & ! number of dotStates
constitutive_titanmod_sizePostResults ! cumulative size of post results
integer(pInt), dimension(:,:), allocatable, target :: &
integer(pInt), dimension(:,:), allocatable, target, public :: &
constitutive_titanmod_sizePostResult ! size of each post result output
character(len=64), dimension(:,:), allocatable, target :: &
character(len=64), dimension(:,:), allocatable, target, public :: &
constitutive_titanmod_output ! name of each post result output
integer(pInt), dimension(:), allocatable :: &
constitutive_titanmod_Noutput ! number of outputs per instance of this plasticity
character(len=32), dimension(:), allocatable :: &
character(len=32), dimension(:), allocatable, public, protected :: &
constitutive_titanmod_structureName ! name of the lattice structure
integer(pInt), dimension(:), allocatable :: &
@ -212,20 +212,20 @@ real(pReal), dimension(:,:,:),allocatable :: &
constitutive_titanmod_forestProjectionScrew, & ! matrix of forest projections of screw dislocations for each instance
constitutive_titanmod_TwinforestProjectionEdge, & ! matrix of forest projections of edge dislocations in twin system for each instance
constitutive_titanmod_TwinforestProjectionScrew ! matrix of forest projections of screw dislocations in twin system for each instance
CONTAINS
!****************************************
!* - constitutive_titanmod_init
!* - constitutive_titanmod_stateInit
!* - constitutive_titanmod_relevantState
!* - constitutive_titanmod_homogenizedC
!* - constitutive_titanmod_microstructure
!* - constitutive_titanmod_LpAndItsTangent
!* - constitutive_titanmod_dotState
!* - constitutive_titanmod_deltaState
!* - constitutive_titanmod_dotTemperature
!* - constitutive_titanmod_postResults
public :: constitutive_titanmod_microstructure, &
constitutive_titanmod_stateInit, &
constitutive_titanmod_init, &
constitutive_titanmod_LpAndItsTangent, &
constitutive_titanmod_dotState, &
constitutive_titanmod_deltaState, &
constitutive_titanmod_dotTemperature, &
constitutive_titanmod_postResults, &
constitutive_titanmod_homogenizedC, &
constitutive_titanmod_aTolState
!****************************************
CONTAINS
subroutine constitutive_titanmod_init(file)
!**************************************