new module "discretization"

should replace the part of mesh that is not only needed by
plastic_nonlocal
This commit is contained in:
Martin Diehl 2019-06-06 13:59:16 +02:00
parent 00189554cd
commit a4cce1bf61
3 changed files with 90 additions and 157 deletions

View File

@ -4,14 +4,32 @@
!> @brief needs a good name and description
!--------------------------------------------------------------------------------------------------
module CPFEM2
use prec
use numerics
use debug
use config
use FEsolving
use math
use mesh
use material
use lattice
use IO
use HDF5
use DAMASK_interface
use results
use discretization
use HDF5_utilities
use homogenization
use constitutive
use crystallite
implicit none
private
implicit none
private
public :: &
CPFEM_age, &
CPFEM_initAll, &
CPFEM_results
public :: &
CPFEM_age, &
CPFEM_initAll, &
CPFEM_results
contains
@ -20,38 +38,6 @@ contains
!> @brief call (thread safe) all module initializations
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_initAll()
use prec, only: &
prec_init
use numerics, only: &
numerics_init
use debug, only: &
debug_init
use config, only: &
config_init
use FEsolving, only: &
FE_init
use math, only: &
math_init
use mesh, only: &
mesh_init
use material, only: &
material_init
use HDF5_utilities, only: &
HDF5_utilities_init
use results, only: &
results_init
use lattice, only: &
lattice_init
use constitutive, only: &
constitutive_init
use crystallite, only: &
crystallite_init
use homogenization, only: &
homogenization_init, &
materialpoint_postResults
use IO, only: &
IO_init
use DAMASK_interface
#ifdef FEM
use FEM_Zoo, only: &
FEM_Zoo_init
@ -85,41 +71,6 @@ end subroutine CPFEM_initAll
!> @brief allocate the arrays defined in module CPFEM and initialize them
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_init
use IO, only: &
IO_error
use numerics, only: &
worldrank
use debug, only: &
debug_level, &
debug_CPFEM, &
debug_levelBasic, &
debug_levelExtensive
use FEsolving, only: &
restartRead
use material, only: &
material_phase, &
homogState, &
phase_plasticity, &
plasticState
use config, only: &
material_Nhomogenization
use crystallite, only: &
crystallite_F0, &
crystallite_Fp0, &
crystallite_Lp0, &
crystallite_Fi0, &
crystallite_Li0, &
crystallite_S0
use hdf5
use HDF5_utilities, only: &
HDF5_openFile, &
HDF5_closeFile, &
HDF5_openGroup, &
HDF5_closeGroup, &
HDF5_read
use DAMASK_interface, only: &
getSolverJobName
integer :: ph,homog
character(len=1024) :: rankStr, PlasticItem, HomogItem
@ -172,52 +123,7 @@ end subroutine CPFEM_init
!--------------------------------------------------------------------------------------------------
!> @brief forwards data after successful increment
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_age()
use prec, only: &
pReal
use numerics, only: &
worldrank
use debug, only: &
debug_level, &
debug_CPFEM, &
debug_levelBasic, &
debug_levelExtensive, &
debug_levelSelective
use FEsolving, only: &
restartWrite
use material, only: &
plasticState, &
sourceState, &
homogState, &
thermalState, &
damageState, &
material_phase, &
phase_plasticity, &
phase_Nsources
use config, only: &
material_Nhomogenization
use crystallite, only: &
crystallite_partionedF,&
crystallite_F0, &
crystallite_Fp0, &
crystallite_Fp, &
crystallite_Fi0, &
crystallite_Fi, &
crystallite_Lp0, &
crystallite_Lp, &
crystallite_Li0, &
crystallite_Li, &
crystallite_S0, &
crystallite_S
use HDF5_utilities, only: &
HDF5_openFile, &
HDF5_closeFile, &
HDF5_addGroup, &
HDF5_closeGroup, &
HDF5_write
use hdf5
use DAMASK_interface, only: &
getSolverJobName
subroutine CPFEM_age
integer :: i, ph, homog, mySource
character(len=32) :: rankStr, PlasticItem, HomogItem
@ -289,14 +195,6 @@ end subroutine CPFEM_age
!> @brief triggers writing of the results
!--------------------------------------------------------------------------------------------------
subroutine CPFEM_results(inc,time)
use results
use HDF5_utilities
use homogenization, only: &
homogenization_results
use constitutive, only: &
constitutive_results
use crystallite, only: &
crystallite_results
integer, intent(in) :: inc
real(pReal), intent(in) :: time
@ -306,6 +204,7 @@ subroutine CPFEM_results(inc,time)
call constitutive_results
call crystallite_results
call homogenization_results
call discretization_results
call results_removeLink('current') ! ToDo: put this into closeJobFile
call results_closeJobFile

53
src/discretization.f90 Normal file
View File

@ -0,0 +1,53 @@
!--------------------------------------------------------------------------------------------------
!> @brief spatial discretization
!--------------------------------------------------------------------------------------------------
module discretization
use, intrinsic :: iso_c_binding
use prec
use results
implicit none
private
integer, public, protected :: &
discretization_nElem, &
discretization_nIP
real(pReal), dimension(:,:), allocatable :: &
discretization_Centers_disp, &
discretization_Nodes_disp
public :: &
discretization_init, &
discretization_results
contains
subroutine discretization_init(nElem,nIP,nNodes)
integer, intent(in) :: &
nElem, &
nIP, &
nNodes
write(6,'(/,a)') ' <<<+- discretization init -+>>>'
discretization_nElem = nElem
discretization_nIP = nIP
allocate(discretization_Centers_disp(3,nIP),source = 0.0_pReal)
allocate(discretization_Nodes_disp( 3,nNodes),source = 0.0_pReal)
end subroutine discretization_init
subroutine discretization_results
call results_writeDataset('current',discretization_Centers_disp,'U','disp','m')
call results_writeDataset('current',discretization_Nodes_disp,'u','disp','m')
end subroutine discretization_results
end module discretization

View File

@ -6,14 +6,24 @@
!> @brief Sets up the mesh for the solvers MSC.Marc, Abaqus and the spectral solver
!--------------------------------------------------------------------------------------------------
module mesh
#include <petsc/finclude/petscsys.h>
use, intrinsic :: iso_c_binding
use prec
use debug
use discretization
use geometry_plastic_nonlocal
use mesh_base
use DAMASK_interface
use PETScsys
use IO
use debug
use numerics
use FEsolving
implicit none
private
integer(pInt), public, protected :: &
mesh_Nnodes
@ -97,7 +107,6 @@ contains
subroutine tMesh_grid_init(self,nodes)
implicit none
class(tMesh_grid) :: self
real(pReal), dimension(:,:), intent(in) :: nodes
@ -111,25 +120,6 @@ end subroutine tMesh_grid_init
!--------------------------------------------------------------------------------------------------
subroutine mesh_init(ip,el)
#include <petsc/finclude/petscsys.h>
use PETScsys
use DAMASK_interface
use IO, only: &
IO_error
use debug, only: &
debug_e, &
debug_i, &
debug_level, &
debug_mesh, &
debug_levelBasic
use numerics, only: &
numerics_unitlength
use FEsolving, only: &
FEsolving_execElem, &
FEsolving_execIP
implicit none
include 'fftw3-mpi.f03'
integer(C_INTPTR_T) :: devNull, local_K, local_K_offset
integer :: ierr, worldsize, j
@ -207,6 +197,7 @@ subroutine mesh_init(ip,el)
theMesh%homogenizationAt = mesh_element(3,:)
theMesh%microstructureAt = mesh_element(4,:)
!!!!!!!!!!!!!!!!!!!!!!!!
call discretization_init(product(grid),product(grid),mesh_Nnodes)
end subroutine mesh_init
@ -217,17 +208,7 @@ end subroutine mesh_init
! supposed to be called only once!
!--------------------------------------------------------------------------------------------------
subroutine mesh_spectral_read_grid()
use IO, only: &
IO_stringPos, &
IO_lc, &
IO_stringValue, &
IO_intValue, &
IO_floatValue, &
IO_error
use DAMASK_interface, only: &
geometryFile
implicit none
character(len=:), allocatable :: rawData
character(len=65536) :: line
integer(pInt), allocatable, dimension(:) :: chunkPos