Checkpoint V5.11 shell redesign baseline
This commit is contained in:
@@ -1,32 +1,16 @@
|
||||
program euler_column_buckling_benchmark
|
||||
use fem_precision
|
||||
use fem_error
|
||||
use fem_geometric_stiffness
|
||||
use fem_buckling_solver
|
||||
use fem_buckling_column
|
||||
implicit none
|
||||
|
||||
integer, parameter :: MAX_MODE = 3
|
||||
real(rk) :: young
|
||||
real(rk) :: inertia
|
||||
real(rk) :: length
|
||||
real(rk) :: kfactor
|
||||
real(rk) :: exact
|
||||
real(rk) :: rel_error
|
||||
real(rk) :: mode_norm
|
||||
real(rk), allocatable :: kfull(:,:)
|
||||
real(rk), allocatable :: kgfull(:,:)
|
||||
real(rk), allocatable :: kred(:,:)
|
||||
real(rk), allocatable :: kgred(:,:)
|
||||
real(rk), allocatable :: modes(:,:)
|
||||
real(rk), allocatable :: full_mode(:)
|
||||
real(rk) :: factors(MAX_MODE)
|
||||
real(rk) :: residuals(MAX_MODE)
|
||||
real(rk) :: factors(BUCKLING_COLUMN_MAX_MODE)
|
||||
real(rk) :: residuals(BUCKLING_COLUMN_MAX_MODE)
|
||||
character(len=512) :: input_file
|
||||
character(len=512) :: out_dir
|
||||
character(len=512) :: path
|
||||
integer :: elem_count
|
||||
integer :: ndof
|
||||
integer :: nfree
|
||||
integer :: ierr
|
||||
integer :: argc
|
||||
|
||||
@@ -41,39 +25,8 @@ program euler_column_buckling_benchmark
|
||||
|
||||
call getarg(1, input_file)
|
||||
call getarg(2, out_dir)
|
||||
call read_column_input(trim(input_file), young, inertia, length, elem_count, &
|
||||
kfactor, ierr)
|
||||
call exit_if_error(ierr)
|
||||
|
||||
ndof = 2 * (elem_count + 1)
|
||||
nfree = ndof - 2
|
||||
allocate(kfull(ndof,ndof), kgfull(ndof,ndof), kred(nfree,nfree), &
|
||||
kgred(nfree,nfree), modes(nfree,MAX_MODE), full_mode(ndof), &
|
||||
stat=ierr)
|
||||
if (ierr .ne. 0) then
|
||||
call error_set(FEM_ERR_INTERNAL, 'failed to allocate Euler buckling arrays', ierr)
|
||||
call exit_if_error(ierr)
|
||||
end if
|
||||
|
||||
call assemble_column(young, inertia, length, elem_count, kfull, kgfull, ierr)
|
||||
call exit_if_error(ierr)
|
||||
call reduce_pinned_column(kfull, kgfull, elem_count, kred, kgred, ierr)
|
||||
call exit_if_error(ierr)
|
||||
call buckling_dense_solve(nfree, kred, kgred, MAX_MODE, factors, modes, &
|
||||
residuals, ierr)
|
||||
call exit_if_error(ierr)
|
||||
call buckling_euler_column_load(young, inertia, length, kfactor, exact, ierr)
|
||||
call exit_if_error(ierr)
|
||||
rel_error = abs(factors(1) - exact) / exact
|
||||
mode_norm = dot_product(modes(:,1), matmul(kgred, modes(:,1)))
|
||||
call expand_pinned_mode(elem_count, modes(:,1), full_mode)
|
||||
|
||||
path = join_path(out_dir, 'buckling_summary.csv')
|
||||
call write_summary(trim(path), elem_count, young, inertia, length, kfactor, &
|
||||
exact, factors, residuals, rel_error, mode_norm, ierr)
|
||||
call exit_if_error(ierr)
|
||||
path = join_path(out_dir, 'buckling_mode_1.csv')
|
||||
call write_mode(trim(path), length, elem_count, full_mode, ierr)
|
||||
call buckling_column_run_file(trim(input_file), trim(out_dir), factors, &
|
||||
residuals, exact, rel_error, mode_norm, ierr)
|
||||
call exit_if_error(ierr)
|
||||
|
||||
write(*,'(A,ES12.5,A,ES12.5,A,ES12.5)') 'Euler column Pcr=', exact, &
|
||||
@@ -81,313 +34,18 @@ program euler_column_buckling_benchmark
|
||||
|
||||
contains
|
||||
|
||||
subroutine read_column_input(filename, young, inertia, length, elem_count, &
|
||||
kfactor, ierr)
|
||||
character(len=*), intent(in) :: filename
|
||||
real(rk), intent(out) :: young
|
||||
real(rk), intent(out) :: inertia
|
||||
real(rk), intent(out) :: length
|
||||
integer, intent(out) :: elem_count
|
||||
real(rk), intent(out) :: kfactor
|
||||
integer, intent(out) :: ierr
|
||||
character(len=512) :: line
|
||||
character(len=512) :: upper
|
||||
integer :: unit
|
||||
integer :: ios
|
||||
logical :: want_data
|
||||
|
||||
young = 210.0e9_rk
|
||||
inertia = 8.0e-6_rk
|
||||
length = 3.0_rk
|
||||
elem_count = 8
|
||||
kfactor = ONE
|
||||
want_data = .false.
|
||||
unit = 94
|
||||
open(unit=unit, file=trim(filename), status='old', action='read', iostat=ios)
|
||||
if (ios .ne. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'failed to open Euler buckling input', ierr)
|
||||
return
|
||||
end if
|
||||
|
||||
do
|
||||
read(unit,'(A)',iostat=ios) line
|
||||
if (ios .lt. 0) exit
|
||||
if (ios .gt. 0) then
|
||||
close(unit)
|
||||
call error_set(FEM_ERR_INPUT, 'failed to read Euler buckling input', ierr)
|
||||
return
|
||||
end if
|
||||
if (len_trim(line) .eq. 0) cycle
|
||||
if (len_trim(line) .ge. 2) then
|
||||
if (line(1:2) .eq. '**') cycle
|
||||
end if
|
||||
call uppercase(line, upper)
|
||||
if (upper(1:1) .eq. '*') then
|
||||
want_data = index(upper, '*BUCKLING COLUMN') .eq. 1
|
||||
else if (want_data) then
|
||||
read(line,*,iostat=ios) young, inertia, length, elem_count, kfactor
|
||||
close(unit)
|
||||
if (ios .ne. 0) then
|
||||
call error_set(FEM_ERR_INPUT, 'failed to parse Euler buckling data', ierr)
|
||||
return
|
||||
end if
|
||||
call validate_input(young, inertia, length, elem_count, kfactor, ierr)
|
||||
return
|
||||
end if
|
||||
end do
|
||||
close(unit)
|
||||
call validate_input(young, inertia, length, elem_count, kfactor, ierr)
|
||||
end subroutine read_column_input
|
||||
|
||||
subroutine validate_input(young, inertia, length, elem_count, kfactor, ierr)
|
||||
real(rk), intent(in) :: young
|
||||
real(rk), intent(in) :: inertia
|
||||
real(rk), intent(in) :: length
|
||||
integer, intent(in) :: elem_count
|
||||
real(rk), intent(in) :: kfactor
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
if (young .le. ZERO .or. inertia .le. ZERO .or. length .le. ZERO .or. &
|
||||
kfactor .le. ZERO .or. elem_count .lt. 2) then
|
||||
call error_set(FEM_ERR_INPUT, 'invalid Euler buckling benchmark data', ierr)
|
||||
return
|
||||
end if
|
||||
if (elem_count .gt. 64) then
|
||||
call error_set(FEM_ERR_INPUT, 'Euler buckling element count is too large', ierr)
|
||||
return
|
||||
end if
|
||||
call error_clear(ierr)
|
||||
end subroutine validate_input
|
||||
|
||||
subroutine assemble_column(young, inertia, length, elem_count, kfull, kgfull, ierr)
|
||||
real(rk), intent(in) :: young
|
||||
real(rk), intent(in) :: inertia
|
||||
real(rk), intent(in) :: length
|
||||
integer, intent(in) :: elem_count
|
||||
real(rk), intent(out) :: kfull(:,:)
|
||||
real(rk), intent(out) :: kgfull(:,:)
|
||||
integer, intent(out) :: ierr
|
||||
real(rk) :: le
|
||||
real(rk) :: ke(4,4)
|
||||
real(rk) :: kg(4,4)
|
||||
integer :: elem
|
||||
integer :: ids(4)
|
||||
|
||||
kfull = ZERO
|
||||
kgfull = ZERO
|
||||
le = length / real(elem_count, rk)
|
||||
do elem = 1, elem_count
|
||||
call beam_bending_stiffness(young, inertia, le, ke)
|
||||
call geom_beam2d_column_stiffness(le, ONE, kg, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
ids = (/ 2 * elem - 1, 2 * elem, 2 * elem + 1, 2 * elem + 2 /)
|
||||
call add_local4(kfull, ids, ke)
|
||||
call add_local4(kgfull, ids, kg)
|
||||
end do
|
||||
call error_clear(ierr)
|
||||
end subroutine assemble_column
|
||||
|
||||
subroutine beam_bending_stiffness(young, inertia, le, ke)
|
||||
real(rk), intent(in) :: young
|
||||
real(rk), intent(in) :: inertia
|
||||
real(rk), intent(in) :: le
|
||||
real(rk), intent(out) :: ke(4,4)
|
||||
real(rk) :: c
|
||||
real(rk) :: l2
|
||||
|
||||
c = young * inertia / (le * le * le)
|
||||
l2 = le * le
|
||||
ke(1,:) = (/ 12.0_rk, 6.0_rk * le, -12.0_rk, 6.0_rk * le /)
|
||||
ke(2,:) = (/ 6.0_rk * le, 4.0_rk * l2, -6.0_rk * le, 2.0_rk * l2 /)
|
||||
ke(3,:) = (/ -12.0_rk, -6.0_rk * le, 12.0_rk, -6.0_rk * le /)
|
||||
ke(4,:) = (/ 6.0_rk * le, 2.0_rk * l2, -6.0_rk * le, 4.0_rk * l2 /)
|
||||
ke = c * ke
|
||||
end subroutine beam_bending_stiffness
|
||||
|
||||
subroutine add_local4(global, ids, local)
|
||||
real(rk), intent(inout) :: global(:,:)
|
||||
integer, intent(in) :: ids(4)
|
||||
real(rk), intent(in) :: local(4,4)
|
||||
integer :: i
|
||||
integer :: j
|
||||
|
||||
do i = 1, 4
|
||||
do j = 1, 4
|
||||
global(ids(i),ids(j)) = global(ids(i),ids(j)) + local(i,j)
|
||||
end do
|
||||
end do
|
||||
end subroutine add_local4
|
||||
|
||||
subroutine reduce_pinned_column(kfull, kgfull, elem_count, kred, kgred, ierr)
|
||||
real(rk), intent(in) :: kfull(:,:)
|
||||
real(rk), intent(in) :: kgfull(:,:)
|
||||
integer, intent(in) :: elem_count
|
||||
real(rk), intent(out) :: kred(:,:)
|
||||
real(rk), intent(out) :: kgred(:,:)
|
||||
integer, intent(out) :: ierr
|
||||
integer :: ndof
|
||||
integer :: i
|
||||
integer :: j
|
||||
integer :: ii
|
||||
integer :: jj
|
||||
integer, allocatable :: free_ids(:)
|
||||
|
||||
ndof = 2 * (elem_count + 1)
|
||||
allocate(free_ids(ndof - 2), stat=ierr)
|
||||
if (ierr .ne. 0) then
|
||||
call error_set(FEM_ERR_INTERNAL, 'failed to allocate Euler free id map', ierr)
|
||||
return
|
||||
end if
|
||||
ii = 0
|
||||
do i = 1, ndof
|
||||
if (i .ne. 1 .and. i .ne. ndof - 1) then
|
||||
ii = ii + 1
|
||||
free_ids(ii) = i
|
||||
end if
|
||||
end do
|
||||
do i = 1, ii
|
||||
do j = 1, ii
|
||||
jj = free_ids(j)
|
||||
kred(i,j) = kfull(free_ids(i),jj)
|
||||
kgred(i,j) = kgfull(free_ids(i),jj)
|
||||
end do
|
||||
end do
|
||||
deallocate(free_ids)
|
||||
call error_clear(ierr)
|
||||
end subroutine reduce_pinned_column
|
||||
|
||||
subroutine expand_pinned_mode(elem_count, reduced, full)
|
||||
integer, intent(in) :: elem_count
|
||||
real(rk), intent(in) :: reduced(:)
|
||||
real(rk), intent(out) :: full(:)
|
||||
integer :: ndof
|
||||
integer :: i
|
||||
integer :: ii
|
||||
|
||||
ndof = 2 * (elem_count + 1)
|
||||
full = ZERO
|
||||
ii = 0
|
||||
do i = 1, ndof
|
||||
if (i .ne. 1 .and. i .ne. ndof - 1) then
|
||||
ii = ii + 1
|
||||
full(i) = reduced(ii)
|
||||
end if
|
||||
end do
|
||||
end subroutine expand_pinned_mode
|
||||
|
||||
subroutine write_summary(filename, elem_count, young, inertia, length, &
|
||||
kfactor, exact, factors, residuals, rel_error, &
|
||||
mode_norm, ierr)
|
||||
character(len=*), intent(in) :: filename
|
||||
integer, intent(in) :: elem_count
|
||||
real(rk), intent(in) :: young
|
||||
real(rk), intent(in) :: inertia
|
||||
real(rk), intent(in) :: length
|
||||
real(rk), intent(in) :: kfactor
|
||||
real(rk), intent(in) :: exact
|
||||
real(rk), intent(in) :: factors(MAX_MODE)
|
||||
real(rk), intent(in) :: residuals(MAX_MODE)
|
||||
real(rk), intent(in) :: rel_error
|
||||
real(rk), intent(in) :: mode_norm
|
||||
integer, intent(out) :: ierr
|
||||
integer :: unit
|
||||
integer :: ios
|
||||
|
||||
unit = 95
|
||||
open(unit=unit, file=trim(filename), status='replace', action='write', &
|
||||
iostat=ios)
|
||||
if (ios .ne. 0) then
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to open Euler buckling summary', ierr)
|
||||
return
|
||||
end if
|
||||
write(unit,'(A)') 'key,value'
|
||||
write(unit,'(A,I0)') 'element_count,', elem_count
|
||||
write(unit,'(A,ES16.8)') 'young,', young
|
||||
write(unit,'(A,ES16.8)') 'inertia,', inertia
|
||||
write(unit,'(A,ES16.8)') 'length,', length
|
||||
write(unit,'(A,ES16.8)') 'kfactor,', kfactor
|
||||
write(unit,'(A,ES16.8)') 'euler_pcr,', exact
|
||||
write(unit,'(A,ES16.8)') 'mode_1_factor,', factors(1)
|
||||
write(unit,'(A,ES16.8)') 'mode_2_factor,', factors(2)
|
||||
write(unit,'(A,ES16.8)') 'mode_3_factor,', factors(3)
|
||||
write(unit,'(A,ES16.8)') 'mode_1_residual,', residuals(1)
|
||||
write(unit,'(A,ES16.8)') 'relative_error,', rel_error
|
||||
write(unit,'(A,ES16.8)') 'kg_mode_norm,', mode_norm
|
||||
close(unit)
|
||||
call error_clear(ierr)
|
||||
end subroutine write_summary
|
||||
|
||||
subroutine write_mode(filename, length, elem_count, full_mode, ierr)
|
||||
character(len=*), intent(in) :: filename
|
||||
real(rk), intent(in) :: length
|
||||
integer, intent(in) :: elem_count
|
||||
real(rk), intent(in) :: full_mode(:)
|
||||
integer, intent(out) :: ierr
|
||||
integer :: unit
|
||||
integer :: ios
|
||||
integer :: node
|
||||
real(rk) :: x
|
||||
|
||||
unit = 96
|
||||
open(unit=unit, file=trim(filename), status='replace', action='write', &
|
||||
iostat=ios)
|
||||
if (ios .ne. 0) then
|
||||
call error_set(FEM_ERR_OUTPUT, 'failed to open Euler buckling mode', ierr)
|
||||
return
|
||||
end if
|
||||
write(unit,'(A)') 'node,x,w,theta'
|
||||
do node = 1, elem_count + 1
|
||||
x = length * real(node - 1, rk) / real(elem_count, rk)
|
||||
write(unit,'(I0,",",ES16.8,",",ES16.8,",",ES16.8)') node, x, &
|
||||
full_mode(2 * node - 1), full_mode(2 * node)
|
||||
end do
|
||||
close(unit)
|
||||
call error_clear(ierr)
|
||||
end subroutine write_mode
|
||||
|
||||
function join_path(dir, name) result(path)
|
||||
character(len=*), intent(in) :: dir
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=512) :: path
|
||||
integer :: n
|
||||
|
||||
n = len_trim(dir)
|
||||
if (n .le. 0) then
|
||||
path = trim(name)
|
||||
else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then
|
||||
path = trim(dir)//trim(name)
|
||||
else
|
||||
path = trim(dir)//'/'//trim(name)
|
||||
end if
|
||||
end function join_path
|
||||
|
||||
subroutine uppercase(line, upper)
|
||||
character(len=*), intent(in) :: line
|
||||
character(len=*), intent(out) :: upper
|
||||
integer :: i
|
||||
integer :: code
|
||||
|
||||
upper = line
|
||||
do i = 1, len_trim(upper)
|
||||
code = iachar(upper(i:i))
|
||||
if (code .ge. iachar('a') .and. code .le. iachar('z')) then
|
||||
upper(i:i) = achar(code - iachar('a') + iachar('A'))
|
||||
end if
|
||||
end do
|
||||
end subroutine uppercase
|
||||
|
||||
subroutine exit_if_error(ierr)
|
||||
integer, intent(in) :: ierr
|
||||
subroutine exit_if_error(ierr_in)
|
||||
integer, intent(in) :: ierr_in
|
||||
integer :: code
|
||||
integer :: ierr2
|
||||
character(len=256) :: msg
|
||||
|
||||
if (ierr .eq. FEM_SUCCESS) return
|
||||
if (ierr_in .eq. FEM_SUCCESS) return
|
||||
call fem_get_last_error(code, msg, ierr2)
|
||||
if (ierr2 .eq. FEM_SUCCESS) then
|
||||
write(*,'(A,I0,2A)') 'Error ', code, ': ', trim(msg)
|
||||
else
|
||||
write(*,'(A,I0)') 'Error: ', ierr
|
||||
write(*,'(A,I0)') 'Error: ', ierr_in
|
||||
end if
|
||||
stop 1
|
||||
end subroutine exit_if_error
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,318 @@
|
||||
module sr_benchmark_cli
|
||||
use fem_precision
|
||||
use fem_control, only: LSOLVER_CG, LSOLVER_BICGSTAB, LSOLVER_GMRES, &
|
||||
LPRECOND_NONE, LPRECOND_JACOBI, LPRECOND_GAUSS_SEIDEL, LPRECOND_ILU0
|
||||
use fem_strength_reduction_driver, only: SR_SEARCH_MAX_RECORDS
|
||||
implicit none
|
||||
|
||||
private
|
||||
|
||||
real(rk), parameter :: NL_DEFAULT_TOL = 1.0e-5_rk
|
||||
real(rk), parameter :: NL_DEFAULT_SR_TOL = 2.0e-2_rk
|
||||
integer, parameter :: MATERIAL_CASE_COUNT = 2
|
||||
|
||||
type nonlinear_chain_options
|
||||
logical :: enabled = .false.
|
||||
logical :: allow_cutback = .true.
|
||||
logical :: line_search = .true.
|
||||
integer :: material_case = 2
|
||||
integer :: max_trials = 10
|
||||
integer :: max_increments = 100
|
||||
integer :: max_newton = 80
|
||||
integer :: linear_iter_limit = 5000
|
||||
integer :: linear_solver_method = LSOLVER_BICGSTAB
|
||||
integer :: linear_precond_method = LPRECOND_JACOBI
|
||||
real(rk) :: alpha = 45.0_rk
|
||||
real(rk) :: tolerance = NL_DEFAULT_SR_TOL
|
||||
real(rk) :: solver_tol = NL_DEFAULT_TOL
|
||||
real(rk) :: displacement_limit = ZERO
|
||||
real(rk) :: plastic_limit = 0.95_rk
|
||||
logical :: write_cloud = .false.
|
||||
integer :: cloud_step = 1525
|
||||
real(rk) :: cloud_factor = ZERO
|
||||
end type nonlinear_chain_options
|
||||
|
||||
public :: nonlinear_chain_options
|
||||
public :: write_usage
|
||||
public :: nonlinear_options_default
|
||||
public :: parse_optional_arguments
|
||||
public :: MATERIAL_CASE_COUNT
|
||||
|
||||
intrinsic getarg
|
||||
|
||||
contains
|
||||
|
||||
subroutine write_usage()
|
||||
write(*,'(A)') 'Usage: strength_reduction_benchmark INPUT.inp OUTPUT_DIR [options]'
|
||||
write(*,'(A)') 'Options:'
|
||||
write(*,'(A)') ' --nonlinear-chain run real nonlinear FE SR trial chain'
|
||||
write(*,'(A)') ' --nl-material-case N nonlinear material case, 1 or 2'
|
||||
write(*,'(A)') ' --nl-alpha VALUE nonlinear slope angle metadata'
|
||||
write(*,'(A)') ' --nl-max-trials N nonlinear SR search trial limit'
|
||||
write(*,'(A)') ' --nl-increments N static nonlinear load increments per trial; default 100'
|
||||
write(*,'(A)') ' --nl-max-newton N Newton iterations per increment; default 80'
|
||||
write(*,'(A)') ' --nl-linear-iter N Krylov iteration cap per Newton correction'
|
||||
write(*,'(A)') ' --nl-linear-solver NAME cg, bicgstab, or gmres; default bicgstab'
|
||||
write(*,'(A)') ' --nl-preconditioner NAME none, jacobi, gs, or ilu0; default jacobi'
|
||||
write(*,'(A)') ' --nl-tol VALUE Newton force tolerance'
|
||||
write(*,'(A)') ' --nl-sr-tol VALUE FOS bracket tolerance'
|
||||
write(*,'(A)') ' --nl-disp-limit VALUE displacement stop criterion'
|
||||
write(*,'(A)') ' --nl-plastic-limit VALUE plastic integration point fraction limit'
|
||||
write(*,'(A)') ' --nl-write-cloud run one target-FOS nonlinear trial and write VTK'
|
||||
write(*,'(A)') ' --nl-cloud-factor VALUE target cloud strength factor; default PDF FOS'
|
||||
write(*,'(A)') ' --nl-cloud-step N VTK step id for target cloud; default 1525'
|
||||
write(*,'(A)') ' --nl-no-cutback disable nonlinear load-step cutback'
|
||||
write(*,'(A)') ' --nl-no-line-search disable nonlinear line search'
|
||||
end subroutine write_usage
|
||||
|
||||
subroutine nonlinear_options_default(nl)
|
||||
type(nonlinear_chain_options), intent(out) :: nl
|
||||
|
||||
nl%enabled = .false.
|
||||
nl%allow_cutback = .true.
|
||||
nl%line_search = .true.
|
||||
nl%material_case = 2
|
||||
nl%max_trials = 10
|
||||
nl%max_increments = 100
|
||||
nl%max_newton = 80
|
||||
nl%linear_iter_limit = 5000
|
||||
nl%linear_solver_method = LSOLVER_BICGSTAB
|
||||
nl%linear_precond_method = LPRECOND_JACOBI
|
||||
nl%alpha = 45.0_rk
|
||||
nl%tolerance = NL_DEFAULT_SR_TOL
|
||||
nl%solver_tol = NL_DEFAULT_TOL
|
||||
nl%displacement_limit = ZERO
|
||||
nl%plastic_limit = 0.95_rk
|
||||
nl%write_cloud = .false.
|
||||
nl%cloud_step = 1525
|
||||
nl%cloud_factor = ZERO
|
||||
end subroutine nonlinear_options_default
|
||||
|
||||
subroutine parse_optional_arguments(argc, nl)
|
||||
integer, intent(in) :: argc
|
||||
type(nonlinear_chain_options), intent(inout) :: nl
|
||||
|
||||
character(len=512) :: arg
|
||||
character(len=512) :: value
|
||||
integer :: i
|
||||
|
||||
i = 3
|
||||
do while (i .le. argc)
|
||||
call getarg(i, arg)
|
||||
call parse_one_option(argc, i, arg, value, nl)
|
||||
end do
|
||||
|
||||
call validate_nonlinear_options(nl)
|
||||
end subroutine parse_optional_arguments
|
||||
|
||||
subroutine parse_one_option(argc, i, arg, value, nl)
|
||||
integer, intent(in) :: argc
|
||||
integer, intent(inout) :: i
|
||||
character(len=*), intent(in) :: arg
|
||||
character(len=*), intent(out) :: value
|
||||
type(nonlinear_chain_options), intent(inout) :: nl
|
||||
|
||||
select case (trim(arg))
|
||||
case ('--help', '-h')
|
||||
call write_usage()
|
||||
stop 0
|
||||
case ('--nonlinear-chain')
|
||||
nl%enabled = .true.
|
||||
i = i + 1
|
||||
case ('--nl-no-cutback')
|
||||
nl%allow_cutback = .false.
|
||||
i = i + 1
|
||||
case ('--nl-no-line-search')
|
||||
nl%line_search = .false.
|
||||
i = i + 1
|
||||
case ('--nl-material-case')
|
||||
call read_option_int(argc, i, arg, value, nl%material_case)
|
||||
case ('--nl-alpha')
|
||||
call read_option_real(argc, i, arg, value, nl%alpha)
|
||||
case ('--nl-max-trials')
|
||||
call read_option_int(argc, i, arg, value, nl%max_trials)
|
||||
case ('--nl-increments')
|
||||
call read_option_int(argc, i, arg, value, nl%max_increments)
|
||||
case ('--nl-max-newton')
|
||||
call read_option_int(argc, i, arg, value, nl%max_newton)
|
||||
case ('--nl-linear-iter')
|
||||
call read_option_int(argc, i, arg, value, nl%linear_iter_limit)
|
||||
case ('--nl-linear-solver')
|
||||
call require_option_value(argc, i, trim(arg), value)
|
||||
call read_linear_solver_value(trim(arg), value, nl%linear_solver_method)
|
||||
i = i + 2
|
||||
case ('--nl-preconditioner')
|
||||
call require_option_value(argc, i, trim(arg), value)
|
||||
call read_preconditioner_value(trim(arg), value, nl%linear_precond_method)
|
||||
i = i + 2
|
||||
case ('--nl-tol')
|
||||
call read_option_real(argc, i, arg, value, nl%solver_tol)
|
||||
case ('--nl-sr-tol')
|
||||
call read_option_real(argc, i, arg, value, nl%tolerance)
|
||||
case ('--nl-disp-limit')
|
||||
call read_option_real(argc, i, arg, value, nl%displacement_limit)
|
||||
case ('--nl-plastic-limit')
|
||||
call read_option_real(argc, i, arg, value, nl%plastic_limit)
|
||||
case ('--nl-write-cloud')
|
||||
nl%write_cloud = .true.
|
||||
i = i + 1
|
||||
case ('--nl-cloud-factor')
|
||||
call read_option_real(argc, i, arg, value, nl%cloud_factor)
|
||||
case ('--nl-cloud-step')
|
||||
call read_option_int(argc, i, arg, value, nl%cloud_step)
|
||||
case default
|
||||
write(*,'(A,A)') 'Unknown option: ', trim(arg)
|
||||
call write_usage()
|
||||
stop 2
|
||||
end select
|
||||
end subroutine parse_one_option
|
||||
|
||||
subroutine read_option_int(argc, i, arg, value, target)
|
||||
integer, intent(in) :: argc
|
||||
integer, intent(inout) :: i
|
||||
character(len=*), intent(in) :: arg
|
||||
character(len=*), intent(out) :: value
|
||||
integer, intent(out) :: target
|
||||
|
||||
call require_option_value(argc, i, trim(arg), value)
|
||||
call read_int_value(trim(arg), value, target)
|
||||
i = i + 2
|
||||
end subroutine read_option_int
|
||||
|
||||
subroutine read_option_real(argc, i, arg, value, target)
|
||||
integer, intent(in) :: argc
|
||||
integer, intent(inout) :: i
|
||||
character(len=*), intent(in) :: arg
|
||||
character(len=*), intent(out) :: value
|
||||
real(rk), intent(out) :: target
|
||||
|
||||
call require_option_value(argc, i, trim(arg), value)
|
||||
call read_real_value(trim(arg), value, target)
|
||||
i = i + 2
|
||||
end subroutine read_option_real
|
||||
|
||||
subroutine validate_nonlinear_options(nl)
|
||||
type(nonlinear_chain_options), intent(in) :: nl
|
||||
|
||||
if (nl%material_case .lt. 1 .or. &
|
||||
nl%material_case .gt. MATERIAL_CASE_COUNT) then
|
||||
write(*,'(A)') '--nl-material-case must be 1 or 2'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%max_trials .lt. 1 .or. &
|
||||
nl%max_trials .gt. SR_SEARCH_MAX_RECORDS) then
|
||||
write(*,'(A,I0)') '--nl-max-trials must be 1..', SR_SEARCH_MAX_RECORDS
|
||||
stop 2
|
||||
end if
|
||||
if (nl%max_increments .lt. 1 .or. nl%max_newton .lt. 1) then
|
||||
write(*,'(A)') '--nl-increments and --nl-max-newton must be positive'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%linear_iter_limit .lt. 1) then
|
||||
write(*,'(A)') '--nl-linear-iter must be positive'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%linear_solver_method .eq. LSOLVER_CG .and. &
|
||||
(nl%linear_precond_method .eq. LPRECOND_GAUSS_SEIDEL .or. &
|
||||
nl%linear_precond_method .eq. LPRECOND_ILU0)) then
|
||||
write(*,'(A)') '--nl-preconditioner gs/ilu0 requires bicgstab or gmres'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%tolerance .le. ZERO .or. nl%solver_tol .le. ZERO) then
|
||||
write(*,'(A)') '--nl-sr-tol and --nl-tol must be positive'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%plastic_limit .le. ZERO .or. nl%plastic_limit .gt. ONE) then
|
||||
write(*,'(A)') '--nl-plastic-limit must be in (0, 1]'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%cloud_factor .lt. ZERO) then
|
||||
write(*,'(A)') '--nl-cloud-factor must be non-negative'
|
||||
stop 2
|
||||
end if
|
||||
if (nl%cloud_step .lt. 0) then
|
||||
write(*,'(A)') '--nl-cloud-step must be non-negative'
|
||||
stop 2
|
||||
end if
|
||||
end subroutine validate_nonlinear_options
|
||||
|
||||
subroutine require_option_value(argc, index, name, value)
|
||||
integer, intent(in) :: argc
|
||||
integer, intent(in) :: index
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=*), intent(out) :: value
|
||||
|
||||
if (index + 1 .gt. argc) then
|
||||
write(*,'(A,A)') 'Missing value for option ', trim(name)
|
||||
stop 2
|
||||
end if
|
||||
call getarg(index + 1, value)
|
||||
end subroutine require_option_value
|
||||
|
||||
subroutine read_int_value(name, text, value)
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=*), intent(in) :: text
|
||||
integer, intent(out) :: value
|
||||
integer :: stat
|
||||
|
||||
read(text, *, iostat=stat) value
|
||||
if (stat .ne. 0) then
|
||||
write(*,'(A,A,A,A)') 'Invalid integer for ', trim(name), ': ', &
|
||||
trim(text)
|
||||
stop 2
|
||||
end if
|
||||
end subroutine read_int_value
|
||||
|
||||
subroutine read_real_value(name, text, value)
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=*), intent(in) :: text
|
||||
real(rk), intent(out) :: value
|
||||
integer :: stat
|
||||
|
||||
read(text, *, iostat=stat) value
|
||||
if (stat .ne. 0) then
|
||||
write(*,'(A,A,A,A)') 'Invalid real for ', trim(name), ': ', trim(text)
|
||||
stop 2
|
||||
end if
|
||||
end subroutine read_real_value
|
||||
|
||||
subroutine read_linear_solver_value(name, text, value)
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=*), intent(in) :: text
|
||||
integer, intent(out) :: value
|
||||
|
||||
select case (trim(text))
|
||||
case ('cg', 'CG')
|
||||
value = LSOLVER_CG
|
||||
case ('bicgstab', 'BiCGSTAB', 'BICGSTAB')
|
||||
value = LSOLVER_BICGSTAB
|
||||
case ('gmres', 'GMRES')
|
||||
value = LSOLVER_GMRES
|
||||
case default
|
||||
write(*,'(A,A,A,A)') 'Invalid value for ', trim(name), ': ', trim(text)
|
||||
stop 2
|
||||
end select
|
||||
end subroutine read_linear_solver_value
|
||||
|
||||
subroutine read_preconditioner_value(name, text, value)
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=*), intent(in) :: text
|
||||
integer, intent(out) :: value
|
||||
|
||||
select case (trim(text))
|
||||
case ('none', 'NONE')
|
||||
value = LPRECOND_NONE
|
||||
case ('jacobi', 'Jacobi', 'JACOBI')
|
||||
value = LPRECOND_JACOBI
|
||||
case ('gs', 'GS', 'gauss-seidel', 'GAUSS-SEIDEL', &
|
||||
'gauss_seidel', 'GAUSS_SEIDEL')
|
||||
value = LPRECOND_GAUSS_SEIDEL
|
||||
case ('ilu0', 'ILU0', 'ilu', 'ILU')
|
||||
value = LPRECOND_ILU0
|
||||
case default
|
||||
write(*,'(A,A,A,A)') 'Invalid value for ', trim(name), ': ', trim(text)
|
||||
stop 2
|
||||
end select
|
||||
end subroutine read_preconditioner_value
|
||||
|
||||
end module sr_benchmark_cli
|
||||
@@ -0,0 +1,421 @@
|
||||
module sr_benchmark_report
|
||||
use fem_precision
|
||||
use fem_error
|
||||
use fem_control
|
||||
use fem_strength_reduction_driver
|
||||
use sr_benchmark_cli, only: nonlinear_chain_options
|
||||
implicit none
|
||||
|
||||
private
|
||||
|
||||
type mc_struct_diag
|
||||
integer :: point_count = 0
|
||||
integer :: updated_points = 0
|
||||
integer :: substeps = 0
|
||||
integer :: requested_substeps = 0
|
||||
integer :: limited_points = 0
|
||||
integer :: branch_mask = 0
|
||||
real(rk) :: max_yield = ZERO
|
||||
real(rk) :: max_plastic_step = ZERO
|
||||
end type mc_struct_diag
|
||||
|
||||
public :: mc_struct_diag
|
||||
public :: write_cloud_progress_record
|
||||
public :: write_nonlinear_chain_record
|
||||
public :: write_nonlinear_summary
|
||||
public :: write_nonlinear_cloud_summary
|
||||
public :: write_mc_diag_row
|
||||
public :: write_mc_summary_fields
|
||||
public :: write_overall_summary
|
||||
public :: cloud_status_name
|
||||
public :: vtk_result_basename
|
||||
public :: flow_rule_name
|
||||
public :: join_path
|
||||
|
||||
contains
|
||||
|
||||
subroutine write_cloud_progress_record(unit_id, segment, target_time, &
|
||||
accepted_time, solve_ierr, converged_i, &
|
||||
conv_status, failure_code, cutbacks, &
|
||||
iter_total, last_dt, &
|
||||
linear_iter, linear_status, &
|
||||
relative_residual, combined_norm, &
|
||||
max_disp, plastic_share, max_eqps, &
|
||||
mc_diag)
|
||||
integer, intent(in) :: unit_id
|
||||
integer, intent(in) :: segment
|
||||
real(rk), intent(in) :: target_time
|
||||
real(rk), intent(in) :: accepted_time
|
||||
integer, intent(in) :: solve_ierr
|
||||
integer, intent(in) :: converged_i
|
||||
integer, intent(in) :: conv_status
|
||||
integer, intent(in) :: failure_code
|
||||
integer, intent(in) :: cutbacks
|
||||
integer, intent(in) :: iter_total
|
||||
real(rk), intent(in) :: last_dt
|
||||
integer, intent(in) :: linear_iter
|
||||
integer, intent(in) :: linear_status
|
||||
real(rk), intent(in) :: relative_residual
|
||||
real(rk), intent(in) :: combined_norm
|
||||
real(rk), intent(in) :: max_disp
|
||||
real(rk), intent(in) :: plastic_share
|
||||
real(rk), intent(in) :: max_eqps
|
||||
type(mc_struct_diag), intent(in) :: mc_diag
|
||||
|
||||
write(unit_id,'(I0,",",I0,",",ES12.4,",",ES12.4,",",I0,",",I0,'// &
|
||||
'",",I0,",",I0,",",I0,",",I0,",",ES12.4,",",ES12.4,'// &
|
||||
'",",ES12.4,",",ES12.4,",",I0,",",ES12.4,'// &
|
||||
'",",ES12.4,",",ES12.4,",",ES12.4,",",I0,",",I0,'// &
|
||||
'",",I0,",",I0,'// &
|
||||
'",",ES12.4,",",ES12.4,",",ES12.4,",",F8.4,",",ES12.4)', &
|
||||
advance='no') &
|
||||
segment, nonlinear_continuation_method, target_time, accepted_time, &
|
||||
solve_ierr, converged_i, conv_status, failure_code, cutbacks, &
|
||||
iter_total, last_dt, nlc_last_target_dt, nlc_last_actual_dt, &
|
||||
nlc_next_target_dt, nlc_last_adjust, nlc_last_trust_radius, &
|
||||
nlc_next_trust_radius, nlc_last_damping, nlc_last_merit_ratio, &
|
||||
nlc_last_rejections, nlc_last_trust_adjust, linear_iter, linear_status, &
|
||||
relative_residual, combined_norm, max_disp, plastic_share, max_eqps
|
||||
call write_mc_diag_row(unit_id, mc_diag)
|
||||
write(unit_id,'(A)') ''
|
||||
end subroutine write_cloud_progress_record
|
||||
|
||||
subroutine write_nonlinear_chain_record(unit_id, record_index, nl, factor, &
|
||||
target, solve_ierr, converged, &
|
||||
conv_status, failure_code, cutbacks, &
|
||||
iter_total, correction_norm, last_dt, &
|
||||
accepted_time, linear_iter, &
|
||||
linear_residual, linear_status, residual, &
|
||||
relative_residual, combined_norm, &
|
||||
max_disp, plastic_share, mc_diag, &
|
||||
metric, stable, status_after)
|
||||
integer, intent(in) :: unit_id
|
||||
integer, intent(in) :: record_index
|
||||
type(nonlinear_chain_options), intent(in) :: nl
|
||||
real(rk), intent(in) :: factor
|
||||
real(rk), intent(in) :: target
|
||||
integer, intent(in) :: solve_ierr
|
||||
logical, intent(in) :: converged
|
||||
integer, intent(in) :: conv_status
|
||||
integer, intent(in) :: failure_code
|
||||
integer, intent(in) :: cutbacks
|
||||
integer, intent(in) :: iter_total
|
||||
real(rk), intent(in) :: correction_norm
|
||||
real(rk), intent(in) :: last_dt
|
||||
real(rk), intent(in) :: accepted_time
|
||||
integer, intent(in) :: linear_iter
|
||||
real(rk), intent(in) :: linear_residual
|
||||
integer, intent(in) :: linear_status
|
||||
real(rk), intent(in) :: residual
|
||||
real(rk), intent(in) :: relative_residual
|
||||
real(rk), intent(in) :: combined_norm
|
||||
real(rk), intent(in) :: max_disp
|
||||
real(rk), intent(in) :: plastic_share
|
||||
type(mc_struct_diag), intent(in) :: mc_diag
|
||||
real(rk), intent(in) :: metric
|
||||
integer, intent(in) :: stable
|
||||
integer, intent(in) :: status_after
|
||||
integer :: converged_i
|
||||
|
||||
converged_i = 0
|
||||
if (converged) converged_i = 1
|
||||
write(unit_id,'(I0,",",I0,",",I0,",",A,",",F6.1,",",F10.4,'// &
|
||||
'",",F10.4,",",I0,",",I0,",",I0,",",I0,",",I0,",",I0,'// &
|
||||
'",",ES12.4,",",ES12.4,",",ES12.4,",",ES12.4,'// &
|
||||
'",",ES12.4,",",ES12.4,",",I0,",",ES12.4,'// &
|
||||
'",",ES12.4,",",ES12.4,",",ES12.4,",",I0,",",I0,'// &
|
||||
'",",I0,",",ES12.4,'// &
|
||||
'",",I0,",",ES12.4,",",ES12.4,",",ES12.4,",",ES12.4,'// &
|
||||
'",",ES12.4,",",F8.4)', advance='no') &
|
||||
record_index, nonlinear_continuation_method, nl%material_case, &
|
||||
trim(flow_rule_name(nl%material_case)), nl%alpha, factor, target, &
|
||||
solve_ierr, converged_i, conv_status, failure_code, cutbacks, &
|
||||
iter_total, last_dt, accepted_time, correction_norm, &
|
||||
nlc_last_target_dt, nlc_last_actual_dt, nlc_next_target_dt, &
|
||||
nlc_last_adjust, nlc_last_trust_radius, nlc_next_trust_radius, &
|
||||
nlc_last_damping, nlc_last_merit_ratio, nlc_last_rejections, &
|
||||
nlc_last_trust_adjust, linear_iter, &
|
||||
linear_residual, linear_status, residual, relative_residual, &
|
||||
combined_norm, max_disp, nl%displacement_limit, plastic_share
|
||||
call write_mc_diag_row(unit_id, mc_diag)
|
||||
write(unit_id,'(",",ES12.4,",",I0,",",A)') metric, stable, &
|
||||
trim(sr_search_status_name(status_after))
|
||||
end subroutine write_nonlinear_chain_record
|
||||
|
||||
subroutine write_nonlinear_summary(unit_id, nl, state, target, mc_diag, ierr)
|
||||
integer, intent(in) :: unit_id
|
||||
type(nonlinear_chain_options), intent(in) :: nl
|
||||
type(sr_search_state), intent(in) :: state
|
||||
real(rk), intent(in) :: target
|
||||
type(mc_struct_diag), intent(in) :: mc_diag
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
real(rk) :: lower
|
||||
real(rk) :: upper
|
||||
real(rk) :: next_factor
|
||||
real(rk) :: converged_factor
|
||||
real(rk) :: last_metric
|
||||
integer :: trials
|
||||
integer :: stable_count
|
||||
integer :: unstable_count
|
||||
integer :: status
|
||||
|
||||
call sr_search_summary(state, lower, upper, next_factor, trials, &
|
||||
stable_count, unstable_count, status, &
|
||||
converged_factor, last_metric, ierr)
|
||||
if (ierr .ne. FEM_SUCCESS) return
|
||||
write(unit_id,'(A)') 'key,value'
|
||||
write(unit_id,'(A,A)') 'chain_type,real_nonlinear_fe_trials'
|
||||
write(unit_id,'(A,I0)') 'continuation_method,', &
|
||||
nonlinear_continuation_method
|
||||
write(unit_id,'(A,A)') 'status,', trim(sr_search_status_name(status))
|
||||
write(unit_id,'(A,I0)') 'material_case,', nl%material_case
|
||||
write(unit_id,'(A,A)') 'flow_rule,', trim(flow_rule_name(nl%material_case))
|
||||
write(unit_id,'(A,F10.4)') 'alpha_deg,', nl%alpha
|
||||
write(unit_id,'(A,F10.4)') 'reference_fos,', target
|
||||
write(unit_id,'(A,F10.4)') 'computed_fos,', converged_factor
|
||||
write(unit_id,'(A,F10.4)') 'lower,', lower
|
||||
write(unit_id,'(A,F10.4)') 'upper,', upper
|
||||
write(unit_id,'(A,F10.4)') 'next_factor,', next_factor
|
||||
write(unit_id,'(A,I0)') 'trials,', trials
|
||||
write(unit_id,'(A,I0)') 'stable_count,', stable_count
|
||||
write(unit_id,'(A,I0)') 'unstable_count,', unstable_count
|
||||
write(unit_id,'(A,ES16.8)') 'last_metric,', last_metric
|
||||
write(unit_id,'(A,I0)') 'max_increments,', nl%max_increments
|
||||
write(unit_id,'(A,I0)') 'max_newton,', nl%max_newton
|
||||
call write_common_nlc_summary(unit_id)
|
||||
write(unit_id,'(A,I0)') 'linear_iter_limit,', nl%linear_iter_limit
|
||||
write(unit_id,'(A,I0)') 'linear_solver_method,', nl%linear_solver_method
|
||||
write(unit_id,'(A,I0)') 'linear_precond_method,', nl%linear_precond_method
|
||||
write(unit_id,'(A,ES16.8)') 'solver_tol,', nl%solver_tol
|
||||
write(unit_id,'(A,ES16.8)') 'displacement_limit,', nl%displacement_limit
|
||||
write(unit_id,'(A,ES16.8)') 'plastic_limit,', nl%plastic_limit
|
||||
call write_mc_summary_fields(unit_id, mc_diag)
|
||||
call error_clear(ierr)
|
||||
end subroutine write_nonlinear_summary
|
||||
|
||||
subroutine write_nonlinear_cloud_summary(unit_id, nl, factor, target, &
|
||||
vtk_name, solve_ierr, converged_i, &
|
||||
conv_status, failure_code, cutbacks, &
|
||||
iter_total, correction_norm, last_dt, &
|
||||
accepted_time, linear_iter, &
|
||||
linear_residual, linear_status, &
|
||||
residual, relative_residual, &
|
||||
combined_norm, max_disp, &
|
||||
plastic_share, max_eqps, mc_diag, &
|
||||
ierr)
|
||||
integer, intent(in) :: unit_id
|
||||
type(nonlinear_chain_options), intent(in) :: nl
|
||||
real(rk), intent(in) :: factor
|
||||
real(rk), intent(in) :: target
|
||||
character(len=*), intent(in) :: vtk_name
|
||||
integer, intent(in) :: solve_ierr
|
||||
integer, intent(in) :: converged_i
|
||||
integer, intent(in) :: conv_status
|
||||
integer, intent(in) :: failure_code
|
||||
integer, intent(in) :: cutbacks
|
||||
integer, intent(in) :: iter_total
|
||||
real(rk), intent(in) :: correction_norm
|
||||
real(rk), intent(in) :: last_dt
|
||||
real(rk), intent(in) :: accepted_time
|
||||
integer, intent(in) :: linear_iter
|
||||
real(rk), intent(in) :: linear_residual
|
||||
integer, intent(in) :: linear_status
|
||||
real(rk), intent(in) :: residual
|
||||
real(rk), intent(in) :: relative_residual
|
||||
real(rk), intent(in) :: combined_norm
|
||||
real(rk), intent(in) :: max_disp
|
||||
real(rk), intent(in) :: plastic_share
|
||||
real(rk), intent(in) :: max_eqps
|
||||
type(mc_struct_diag), intent(in) :: mc_diag
|
||||
integer, intent(out) :: ierr
|
||||
|
||||
write(unit_id,'(A)') 'key,value'
|
||||
write(unit_id,'(A,A)') 'cloud_type,real_nonlinear_fe_target'
|
||||
write(unit_id,'(A,I0)') 'continuation_method,', &
|
||||
nonlinear_continuation_method
|
||||
write(unit_id,'(A,A)') 'status,', &
|
||||
trim(cloud_status_name(converged_i .eq. 1, accepted_time))
|
||||
write(unit_id,'(A,I0)') 'material_case,', nl%material_case
|
||||
write(unit_id,'(A,A)') 'flow_rule,', trim(flow_rule_name(nl%material_case))
|
||||
write(unit_id,'(A,F10.4)') 'alpha_deg,', nl%alpha
|
||||
write(unit_id,'(A,F10.4)') 'factor,', factor
|
||||
write(unit_id,'(A,F10.4)') 'reference_fos,', target
|
||||
write(unit_id,'(A,A)') 'vtk_file,', trim(vtk_name)
|
||||
write(unit_id,'(A,I0)') 'vtk_step,', nl%cloud_step
|
||||
write(unit_id,'(A,I0)') 'solve_ierr,', solve_ierr
|
||||
write(unit_id,'(A,I0)') 'converged,', converged_i
|
||||
write(unit_id,'(A,I0)') 'convergence_status,', conv_status
|
||||
write(unit_id,'(A,I0)') 'failure_code,', failure_code
|
||||
write(unit_id,'(A,I0)') 'cutbacks,', cutbacks
|
||||
write(unit_id,'(A,I0)') 'iterations,', iter_total
|
||||
write(unit_id,'(A,ES16.8)') 'last_dt,', last_dt
|
||||
write(unit_id,'(A,ES16.8)') 'accepted_time,', accepted_time
|
||||
write(unit_id,'(A,ES16.8)') 'correction_norm,', correction_norm
|
||||
write(unit_id,'(A,I0)') 'linear_iterations,', linear_iter
|
||||
write(unit_id,'(A,ES16.8)') 'linear_residual,', linear_residual
|
||||
write(unit_id,'(A,I0)') 'linear_status,', linear_status
|
||||
write(unit_id,'(A,ES16.8)') 'residual,', residual
|
||||
write(unit_id,'(A,ES16.8)') 'relative_residual,', relative_residual
|
||||
write(unit_id,'(A,ES16.8)') 'combined_norm,', combined_norm
|
||||
write(unit_id,'(A,ES16.8)') 'max_displacement,', max_disp
|
||||
write(unit_id,'(A,ES16.8)') 'stop_displacement,', nl%displacement_limit
|
||||
write(unit_id,'(A,ES16.8)') 'plastic_share,', plastic_share
|
||||
write(unit_id,'(A,ES16.8)') 'max_eqps,', max_eqps
|
||||
write(unit_id,'(A,I0)') 'max_increments,', nl%max_increments
|
||||
write(unit_id,'(A,I0)') 'max_newton,', nl%max_newton
|
||||
call write_common_nlc_summary(unit_id)
|
||||
write(unit_id,'(A,I0)') 'linear_iter_limit,', nl%linear_iter_limit
|
||||
write(unit_id,'(A,I0)') 'linear_solver_method,', nl%linear_solver_method
|
||||
write(unit_id,'(A,I0)') 'linear_precond_method,', nl%linear_precond_method
|
||||
write(unit_id,'(A,ES16.8)') 'solver_tol,', nl%solver_tol
|
||||
call write_mc_summary_fields(unit_id, mc_diag)
|
||||
call error_clear(ierr)
|
||||
end subroutine write_nonlinear_cloud_summary
|
||||
|
||||
subroutine write_common_nlc_summary(unit_id)
|
||||
integer, intent(in) :: unit_id
|
||||
|
||||
write(unit_id,'(A,I0)') 'target_newton,', nlc_target_newton
|
||||
write(unit_id,'(A,ES16.8)') 'growth_factor,', nlc_growth_factor
|
||||
write(unit_id,'(A,ES16.8)') 'shrink_factor,', nlc_shrink_factor
|
||||
write(unit_id,'(A,ES16.8)') 'last_target_dt,', nlc_last_target_dt
|
||||
write(unit_id,'(A,ES16.8)') 'last_actual_dt,', nlc_last_actual_dt
|
||||
write(unit_id,'(A,ES16.8)') 'next_target_dt,', nlc_next_target_dt
|
||||
write(unit_id,'(A,I0)') 'last_adjust,', nlc_last_adjust
|
||||
write(unit_id,'(A,ES16.8)') 'trust_radius,', nlc_trust_radius
|
||||
write(unit_id,'(A,ES16.8)') 'trust_min_radius,', nlc_trust_min_radius
|
||||
write(unit_id,'(A,ES16.8)') 'trust_max_radius,', nlc_trust_max_radius
|
||||
write(unit_id,'(A,ES16.8)') 'trust_growth_factor,', &
|
||||
nlc_trust_growth_factor
|
||||
write(unit_id,'(A,ES16.8)') 'trust_shrink_factor,', &
|
||||
nlc_trust_shrink_factor
|
||||
write(unit_id,'(A,ES16.8)') 'trust_accept_ratio,', &
|
||||
nlc_trust_accept_ratio
|
||||
write(unit_id,'(A,ES16.8)') 'trust_good_ratio,', nlc_trust_good_ratio
|
||||
write(unit_id,'(A,ES16.8)') 'last_trust_radius,', &
|
||||
nlc_last_trust_radius
|
||||
write(unit_id,'(A,ES16.8)') 'next_trust_radius,', &
|
||||
nlc_next_trust_radius
|
||||
write(unit_id,'(A,ES16.8)') 'last_damping,', nlc_last_damping
|
||||
write(unit_id,'(A,ES16.8)') 'last_merit_ratio,', nlc_last_merit_ratio
|
||||
write(unit_id,'(A,I0)') 'last_trust_rejections,', nlc_last_rejections
|
||||
write(unit_id,'(A,I0)') 'last_trust_adjust,', nlc_last_trust_adjust
|
||||
end subroutine write_common_nlc_summary
|
||||
|
||||
subroutine write_mc_diag_row(unit_id, diag)
|
||||
integer, intent(in) :: unit_id
|
||||
type(mc_struct_diag), intent(in) :: diag
|
||||
|
||||
write(unit_id,'(",",I0,",",I0,",",I0,",",I0,",",I0,",",I0,'// &
|
||||
'",",ES12.4,",",ES12.4)', advance='no') &
|
||||
diag%point_count, diag%updated_points, diag%substeps, &
|
||||
diag%requested_substeps, diag%limited_points, diag%branch_mask, &
|
||||
diag%max_yield, diag%max_plastic_step
|
||||
end subroutine write_mc_diag_row
|
||||
|
||||
subroutine write_mc_summary_fields(unit_id, diag)
|
||||
integer, intent(in) :: unit_id
|
||||
type(mc_struct_diag), intent(in) :: diag
|
||||
|
||||
write(unit_id,'(A,I0)') 'mc_min_substeps,', nlc_mc_min_substeps
|
||||
write(unit_id,'(A,I0)') 'mc_max_substeps,', nlc_mc_max_substeps
|
||||
write(unit_id,'(A,ES16.8)') 'mc_target_strain,', nlc_mc_target_strain
|
||||
write(unit_id,'(A,ES16.8)') 'mc_yield_tol,', nlc_mc_yield_tolerance
|
||||
write(unit_id,'(A,ES16.8)') 'mc_plastic_limit,', nlc_mc_plastic_limit
|
||||
write(unit_id,'(A,I0)') 'mc_points,', diag%point_count
|
||||
write(unit_id,'(A,I0)') 'mc_updated_points,', diag%updated_points
|
||||
write(unit_id,'(A,I0)') 'mc_substeps,', diag%substeps
|
||||
write(unit_id,'(A,I0)') 'mc_requested_substeps,', diag%requested_substeps
|
||||
write(unit_id,'(A,I0)') 'mc_limited_points,', diag%limited_points
|
||||
write(unit_id,'(A,I0)') 'mc_branch_mask,', diag%branch_mask
|
||||
write(unit_id,'(A,ES16.8)') 'mc_max_yield,', diag%max_yield
|
||||
write(unit_id,'(A,ES16.8)') 'mc_max_plastic_step,', diag%max_plastic_step
|
||||
end subroutine write_mc_summary_fields
|
||||
|
||||
subroutine write_overall_summary(unit_id, alpha_count, material_case_count, &
|
||||
total_trials, total_stable, &
|
||||
total_unstable, converged_cases, &
|
||||
max_abs_error, case1_alpha45)
|
||||
integer, intent(in) :: unit_id
|
||||
integer, intent(in) :: alpha_count
|
||||
integer, intent(in) :: material_case_count
|
||||
integer, intent(in) :: total_trials
|
||||
integer, intent(in) :: total_stable
|
||||
integer, intent(in) :: total_unstable
|
||||
integer, intent(in) :: converged_cases
|
||||
real(rk), intent(in) :: max_abs_error
|
||||
real(rk), intent(in) :: case1_alpha45
|
||||
integer :: case_count
|
||||
character(len=16) :: status
|
||||
|
||||
case_count = alpha_count * material_case_count
|
||||
if (converged_cases .eq. case_count) then
|
||||
status = 'CONVERGED'
|
||||
else
|
||||
status = 'INCOMPLETE'
|
||||
end if
|
||||
write(unit_id,'(A)') 'key,value'
|
||||
write(unit_id,'(A,A)') 'status,', trim(status)
|
||||
write(unit_id,'(A,I0)') 'case_count,', case_count
|
||||
write(unit_id,'(A,I0)') 'alpha_count,', alpha_count
|
||||
write(unit_id,'(A,I0)') 'material_case_count,', material_case_count
|
||||
write(unit_id,'(A,I0)') 'converged_cases,', converged_cases
|
||||
write(unit_id,'(A,I0)') 'trials,', total_trials
|
||||
write(unit_id,'(A,I0)') 'stable_count,', total_stable
|
||||
write(unit_id,'(A,I0)') 'unstable_count,', total_unstable
|
||||
write(unit_id,'(A,ES16.8)') 'max_abs_error,', max_abs_error
|
||||
write(unit_id,'(A,ES16.8)') 'converged_factor,', case1_alpha45
|
||||
write(unit_id,'(A)') 'summary,"PDF strength reduction sweep: 4 slope '// &
|
||||
'angles x 2 material cases"'
|
||||
end subroutine write_overall_summary
|
||||
|
||||
character(len=16) function cloud_status_name(converged, accepted_time)
|
||||
logical, intent(in) :: converged
|
||||
real(rk), intent(in) :: accepted_time
|
||||
|
||||
if (converged) then
|
||||
cloud_status_name = 'CONVERGED'
|
||||
else if (accepted_time .gt. ZERO) then
|
||||
cloud_status_name = 'PARTIAL'
|
||||
else
|
||||
cloud_status_name = 'FAILED'
|
||||
end if
|
||||
end function cloud_status_name
|
||||
|
||||
character(len=32) function vtk_result_basename(step)
|
||||
integer, intent(in) :: step
|
||||
character(len=8) :: step_text
|
||||
|
||||
write(step_text,'(I8.8)') step
|
||||
vtk_result_basename = 'result_'//step_text//'.vtk'
|
||||
end function vtk_result_basename
|
||||
|
||||
character(len=32) function flow_rule_name(material_case)
|
||||
integer, intent(in) :: material_case
|
||||
|
||||
if (material_case .eq. 1) then
|
||||
flow_rule_name = 'nonassociative_davis_b'
|
||||
else
|
||||
flow_rule_name = 'associative'
|
||||
end if
|
||||
end function flow_rule_name
|
||||
|
||||
function join_path(dir, name) result(out_path)
|
||||
character(len=*), intent(in) :: dir
|
||||
character(len=*), intent(in) :: name
|
||||
character(len=512) :: out_path
|
||||
integer :: n
|
||||
|
||||
out_path = ' '
|
||||
n = len_trim(dir)
|
||||
if (n .le. 0) then
|
||||
out_path = trim(name)
|
||||
else if (dir(n:n) .eq. '\' .or. dir(n:n) .eq. '/') then
|
||||
out_path = trim(dir)//trim(name)
|
||||
else
|
||||
out_path = trim(dir)//'/'//trim(name)
|
||||
end if
|
||||
end function join_path
|
||||
|
||||
end module sr_benchmark_report
|
||||
Reference in New Issue
Block a user