From de3fc70a02b32034b2be312d7a86ccab5e089773 Mon Sep 17 00:00:00 2001
From: Pratheek Shanthraj
Date: Fri, 20 Dec 2013 10:49:14 +0000
Subject: [PATCH] moved restart writing to the forwarding routine
---
code/DAMASK_spectral_solverAL.f90 | 83 ++++++++++-----------
code/DAMASK_spectral_solverBasicPETSc.f90 | 70 ++++++++---------
code/DAMASK_spectral_solverPolarisation.f90 | 83 ++++++++++-----------
3 files changed, 110 insertions(+), 126 deletions(-)
diff --git a/code/DAMASK_spectral_solverAL.f90 b/code/DAMASK_spectral_solverAL.f90
index ad541925f..176049221 100644
--- a/code/DAMASK_spectral_solverAL.f90
+++ b/code/DAMASK_spectral_solverAL.f90
@@ -279,11 +279,7 @@ type(tSolutionState) function &
update_gamma
use math, only: &
math_invSym3333
- use IO, only: &
- IO_write_jobRealFile
use DAMASK_spectral_Utilities, only: &
- grid, &
- geomSize, &
tBoundaryCondition, &
Utilities_maskedCompliance, &
Utilities_updateGamma
@@ -292,8 +288,6 @@ type(tSolutionState) function &
terminallyIll
implicit none
-#include
-#include
!--------------------------------------------------------------------------------------------------
! input data for solution
@@ -314,48 +308,10 @@ type(tSolutionState) function &
!--------------------------------------------------------------------------------------------------
! PETSc Data
- PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_lambda
PetscErrorCode :: ierr
SNESConvergedReason :: reason
incInfo = incInfoIn
-
-!--------------------------------------------------------------------------------------------------
-! restart information for spectral solver
- call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr)
- F => xx_psc(0:8,:,:,:)
- F_lambda => xx_psc(9:17,:,:,:)
- if (restartWrite) then
- write(6,'(/,a)') ' writing converged results for restart'
- flush(6)
- call IO_write_jobRealFile(777,'F',size(F)) ! writing deformation gradient field to file
- write (777,rec=1) F
- close (777)
- call IO_write_jobRealFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
- write (777,rec=1) F_lastInc
- close (777)
- call IO_write_jobRealFile(777,'F_lastInc2',size(F_lastInc2)) ! writing F_lastInc field to file
- write (777,rec=1) F_lastInc2
- close (777)
- call IO_write_jobRealFile(777,'F_lambda',size(F_lambda)) ! writing deformation gradient field to file
- write (777,rec=1) F_lambda
- close (777)
- call IO_write_jobRealFile(777,'F_lambda_lastInc',size(F_lambda_lastInc)) ! writing F_lastInc field to file
- write (777,rec=1) F_lambda_lastInc
- close (777)
- call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot))
- write (777,rec=1) F_aimDot
- close(777)
- call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg))
- write (777,rec=1) C_volAvg
- close(777)
- call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
- write (777,rec=1) C_volAvgLastInc
- close(777)
- endif
- call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr)
-
- AL_solution%converged =.false.
!--------------------------------------------------------------------------------------------------
! update stiffness (and gamma operator)
@@ -367,6 +323,10 @@ type(tSolutionState) function &
endif
ForwardData = .True.
+ AL_solution%converged =.false.
+
+!--------------------------------------------------------------------------------------------------
+! set module wide availabe data
mask_stress = P_BC%maskFloat
params%P_BC = P_BC%values
params%rotation_BC = rotation_BC
@@ -652,6 +612,10 @@ subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_
use mesh, only: &
mesh_ipCoordinates,&
mesh_deformedCoordsFFT
+ use IO, only: &
+ IO_write_JobRealFile
+ use FEsolving, only: &
+ restartWrite
implicit none
#include
@@ -675,6 +639,37 @@ subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_
call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr)
F => xx_psc(0:8,:,:,:)
F_lambda => xx_psc(9:17,:,:,:)
+ if (restartWrite) then
+ write(6,'(/,a)') ' writing converged results for restart'
+ flush(6)
+ call IO_write_jobRealFile(777,'F',size(F)) ! writing deformation gradient field to file
+ write (777,rec=1) F
+ close (777)
+ call IO_write_jobRealFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lastInc
+ close (777)
+ call IO_write_jobRealFile(777,'F_lastInc2',size(F_lastInc2)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lastInc2
+ close (777)
+ call IO_write_jobRealFile(777,'F_lambda',size(F_lambda)) ! writing deformation gradient field to file
+ write (777,rec=1) F_lambda
+ close (777)
+ call IO_write_jobRealFile(777,'F_lambda_lastInc',size(F_lambda_lastInc)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lambda_lastInc
+ close (777)
+ call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot))
+ write (777,rec=1) F_aimDot
+ close(777)
+ call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg))
+ write (777,rec=1) C_volAvg
+ close(777)
+ call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
+ write (777,rec=1) C_volAvgLastInc
+ close(777)
+ endif
+ mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
+ F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
+
if (cutBack) then
F_aim = F_aim_lastInc
F_lambda= reshape(F_lambda_lastInc,[9,grid(1),grid(2),grid(3)])
diff --git a/code/DAMASK_spectral_solverBasicPETSc.f90 b/code/DAMASK_spectral_solverBasicPETSc.f90
index ca4d39e01..c7cd77cc2 100644
--- a/code/DAMASK_spectral_solverBasicPETSc.f90
+++ b/code/DAMASK_spectral_solverBasicPETSc.f90
@@ -250,10 +250,7 @@ type(tSolutionState) function basicPETSc_solution( &
use numerics, only: &
update_gamma, &
itmax
- use IO, only: &
- IO_write_JobRealFile
use DAMASK_spectral_Utilities, only: &
- grid, &
tBoundaryCondition, &
Utilities_maskedCompliance, &
Utilities_updateGamma
@@ -262,8 +259,6 @@ type(tSolutionState) function basicPETSc_solution( &
terminallyIll
implicit none
-#include
-#include
!--------------------------------------------------------------------------------------------------
! input data for solution
@@ -284,47 +279,18 @@ type(tSolutionState) function basicPETSc_solution( &
!--------------------------------------------------------------------------------------------------
! PETSc Data
- PetscScalar, pointer :: F(:,:,:,:)
PetscErrorCode :: ierr
SNESConvergedReason :: reason
incInfo = incInfoIn
-!--------------------------------------------------------------------------------------------------
-! restart information for spectral solver
- call DMDAVecGetArrayF90(da,solution_vec,F,ierr)
- if (restartWrite) then
- write(6,'(/,a)') ' writing converged results for restart'
- flush(6)
- call IO_write_jobRealFile(777,'F',size(F)) ! writing deformation gradient field to file
- write (777,rec=1) F
- close (777)
- call IO_write_jobRealFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
- write (777,rec=1) F_lastInc
- close (777)
- call IO_write_jobRealFile(777,'F_lastInc2',size(F_lastInc2)) ! writing F_lastInc field to file
- write (777,rec=1) F_lastInc2
- close (777)
- call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot))
- write (777,rec=1) F_aimDot
- close(777)
- call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg))
- write (777,rec=1) C_volAvg
- close(777)
- call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
- write (777,rec=1) C_volAvgLastInc
- close(777)
- endif
- call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr)
-
- BasicPETSc_solution%converged =.false.
-
!--------------------------------------------------------------------------------------------------
! update stiffness (and gamma operator)
S = Utilities_maskedCompliance(rotation_BC,P_BC%maskLogical,C_volAvg)
if (update_gamma) call Utilities_updateGamma(C_minmaxAvg,restartWrite)
ForwardData = .True.
-
+ BasicPETSc_solution%converged =.false.
+
!--------------------------------------------------------------------------------------------------
! set module wide availabe data
mask_stress = P_BC%maskFloat
@@ -582,6 +548,10 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,r
use mesh, only: &
mesh_ipCoordinates,&
mesh_deformedCoordsFFT
+ use IO, only: &
+ IO_write_JobRealFile
+ use FEsolving, only: &
+ restartWrite
implicit none
#include
@@ -598,9 +568,33 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,r
PetscScalar, pointer :: F(:,:,:,:)
PetscErrorCode :: ierr
-!--------------------------------------------------------------------------------------------------
-! update coordinates and rate and forward last inc
call DMDAVecGetArrayF90(da,solution_vec,F,ierr)
+!--------------------------------------------------------------------------------------------------
+! restart information for spectral solver
+ if (restartWrite) then
+ write(6,'(/,a)') ' writing converged results for restart'
+ flush(6)
+ call IO_write_jobRealFile(777,'F',size(F)) ! writing deformation gradient field to file
+ write (777,rec=1) F
+ close (777)
+ call IO_write_jobRealFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lastInc
+ close (777)
+ call IO_write_jobRealFile(777,'F_lastInc2',size(F_lastInc2)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lastInc2
+ close (777)
+ call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot))
+ write (777,rec=1) F_aimDot
+ close(777)
+ call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg))
+ write (777,rec=1) C_volAvg
+ close(777)
+ call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
+ write (777,rec=1) C_volAvgLastInc
+ close(777)
+ endif
+ mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
+ F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
if (cutBack) then
F_aim = F_aim_lastInc
F = reshape(F_lastInc, [9,grid(1),grid(2),grid(3)])
diff --git a/code/DAMASK_spectral_solverPolarisation.f90 b/code/DAMASK_spectral_solverPolarisation.f90
index 98e150902..a755b51a8 100644
--- a/code/DAMASK_spectral_solverPolarisation.f90
+++ b/code/DAMASK_spectral_solverPolarisation.f90
@@ -279,11 +279,7 @@ type(tSolutionState) function &
update_gamma
use math, only: &
math_invSym3333
- use IO, only: &
- IO_write_jobRealFile
use DAMASK_spectral_Utilities, only: &
- grid, &
- geomSize, &
tBoundaryCondition, &
Utilities_maskedCompliance, &
Utilities_updateGamma
@@ -292,8 +288,6 @@ type(tSolutionState) function &
terminallyIll
implicit none
-#include
-#include
!--------------------------------------------------------------------------------------------------
! input data for solution
@@ -314,47 +308,10 @@ type(tSolutionState) function &
!--------------------------------------------------------------------------------------------------
! PETSc Data
- PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_tau
PetscErrorCode :: ierr
SNESConvergedReason :: reason
incInfo = incInfoIn
-
-!--------------------------------------------------------------------------------------------------
-! restart information for spectral solver
- call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr)
- F => xx_psc(0:8,:,:,:)
- F_tau => xx_psc(9:17,:,:,:)
- if (restartWrite) then
- write(6,'(/,a)') ' writing converged results for restart'
- flush(6)
- call IO_write_jobRealFile(777,'F',size(F)) ! writing deformation gradient field to file
- write (777,rec=1) F
- close (777)
- call IO_write_jobRealFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
- write (777,rec=1) F_lastInc
- close (777)
- call IO_write_jobRealFile(777,'F_lastInc2',size(F_lastInc2)) ! writing F_lastInc field to file
- write (777,rec=1) F_lastInc2
- close (777)
- call IO_write_jobRealFile(777,'F_tau',size(F_tau)) ! writing deformation gradient field to file
- write (777,rec=1) F_tau
- close (777)
- call IO_write_jobRealFile(777,'F_tau_lastInc',size(F_tau_lastInc)) ! writing F_lastInc field to file
- write (777,rec=1) F_tau_lastInc
- close (777)
- call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot))
- write (777,rec=1) F_aimDot
- close(777)
- call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg))
- write (777,rec=1) C_volAvg
- close(777)
- call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
- write (777,rec=1) C_volAvgLastInc
- close(777)
- endif
- call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr)
- Polarisation_solution%converged =.false.
!--------------------------------------------------------------------------------------------------
! update stiffness (and gamma operator)
@@ -364,7 +321,10 @@ type(tSolutionState) function &
C_scale = C_minMaxAvg
S_scale = math_invSym3333(C_minMaxAvg)
endif
-
+ Polarisation_solution%converged =.false.
+
+!--------------------------------------------------------------------------------------------------
+! set module wide availabe data
ForwardData = .True.
mask_stress = P_BC%maskFloat
params%P_BC = P_BC%values
@@ -650,6 +610,10 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC
use mesh, only: &
mesh_ipCoordinates,&
mesh_deformedCoordsFFT
+ use IO, only: &
+ IO_write_JobRealFile
+ use FEsolving, only: &
+ restartWrite
implicit none
#include
@@ -673,6 +637,37 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC
call DMDAVecGetArrayF90(da,solution_vec,xx_psc,ierr)
F => xx_psc(0:8,:,:,:)
F_tau => xx_psc(9:17,:,:,:)
+ if (restartWrite) then
+ write(6,'(/,a)') ' writing converged results for restart'
+ flush(6)
+ call IO_write_jobRealFile(777,'F',size(F)) ! writing deformation gradient field to file
+ write (777,rec=1) F
+ close (777)
+ call IO_write_jobRealFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lastInc
+ close (777)
+ call IO_write_jobRealFile(777,'F_lastInc2',size(F_lastInc2)) ! writing F_lastInc field to file
+ write (777,rec=1) F_lastInc2
+ close (777)
+ call IO_write_jobRealFile(777,'F_tau',size(F_tau)) ! writing deformation gradient field to file
+ write (777,rec=1) F_tau
+ close (777)
+ call IO_write_jobRealFile(777,'F_tau_lastInc',size(F_tau_lastInc)) ! writing F_lastInc field to file
+ write (777,rec=1) F_tau_lastInc
+ close (777)
+ call IO_write_jobRealFile(777,'F_aimDot',size(F_aimDot))
+ write (777,rec=1) F_aimDot
+ close(777)
+ call IO_write_jobRealFile(777,'C_volAvg',size(C_volAvg))
+ write (777,rec=1) C_volAvg
+ close(777)
+ call IO_write_jobRealFile(777,'C_volAvgLastInc',size(C_volAvgLastInc))
+ write (777,rec=1) C_volAvgLastInc
+ close(777)
+ endif
+ mesh_ipCoordinates = reshape(mesh_deformedCoordsFFT(geomSize,reshape(&
+ F,[3,3,grid(1),grid(2),grid(3)])),[3,1,product(grid)])
+
if (cutBack) then
F_aim = F_aim_lastInc
F_tau= reshape(F_tau_lastInc,[9,grid(1),grid(2),grid(3)])