Skip to content

Commit 56d3bfe

Browse files
committed
Merge branch '507-solverjobname-and-getsolverjobname' into 'development'
more systematic naming Closes #507 See merge request damask/DAMASK!1084
2 parents 3bbfd04 + 580dd32 commit 56d3bfe

13 files changed

+39
-51
lines changed

src/CLI.f90

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ module CLI
2727
CLI_loadFile, & !< location of the load case file
2828
CLI_materialFile, & !< location of the material configuration file
2929
CLI_numericsFile, & !< location of the numerics configuration file
30-
solverJobname
30+
CLI_jobName
3131

3232
public :: &
33-
getSolverJobname, &
3433
CLI_init
3534

3635
contains
@@ -155,7 +154,7 @@ subroutine CLI_init()
155154
case ('-n', '--numerics', '--numericsconfig')
156155
numericsArg = val
157156
case ('-j', '--job', '--jobname')
158-
solverJobname = val
157+
CLI_jobName = val
159158
case ('-w', '--wd', '--workingdir', '--workingdirectory')
160159
workingDirArg = val
161160
#if defined(GRID)
@@ -179,10 +178,10 @@ subroutine CLI_init()
179178
if (allocated(numericsArg)) &
180179
CLI_numericsFile = getPathRelCWD(numericsArg,'numerics configuration')
181180

182-
if (.not. allocated(solverJobname)) then
183-
solverJobname = jobname(CLI_geomFile,CLI_loadFile,CLI_materialFile,CLI_numericsFile)
184-
elseif (scan(solverJobname,'/') > 0) then
185-
call IO_error(612,ext_msg=solverJobname,label1='--jobname')
181+
if (.not. allocated(CLI_jobName)) then
182+
CLI_jobName = jobname(CLI_geomFile,CLI_loadFile,CLI_materialFile,CLI_numericsFile)
183+
elseif (scan(CLI_jobName,'/') > 0) then
184+
call IO_error(612,ext_msg=CLI_jobName,label1='--jobname')
186185
endif
187186

188187
commandLine = getArg(-1)
@@ -197,7 +196,7 @@ subroutine CLI_init()
197196
print'(1x,a)', 'Material config: '//IO_glueDiffering(CLI_materialFile,materialArg)
198197
if (allocated(numericsArg)) &
199198
print'(1x,a)', 'Numerics config: '//IO_glueDiffering(CLI_numericsFile,numericsArg)
200-
print'(1x,a)', 'Solver job name: '//getSolverJobname()
199+
print'(1x,a)', 'Solver job name: '//CLI_jobName
201200
if (CLI_restartInc > 0) &
202201
print'(1x,a,i6.6)', 'Restart from increment: ', CLI_restartInc
203202

@@ -257,19 +256,6 @@ subroutine setWorkingDirectory(workingDirectoryArg)
257256
end subroutine setWorkingDirectory
258257

259258

260-
!--------------------------------------------------------------------------------------------------
261-
!> @brief Return solver job name (MSC.Marc compatible).
262-
!--------------------------------------------------------------------------------------------------
263-
function getSolverJobname()
264-
265-
character(len=:), allocatable :: getSolverJobname
266-
267-
268-
getSolverJobname = solverJobname
269-
270-
end function getSolverJobname
271-
272-
273259
!--------------------------------------------------------------------------------------------------
274260
!> @brief Determine solver job name.
275261
!--------------------------------------------------------------------------------------------------

src/Marc/DAMASK_Marc.f90

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ module DAMASK_interface
5555
type(tLoadcase), allocatable, protected, public :: loadcase(:)
5656
logical, protected, public :: symmetricSolver
5757
character(len=*), parameter, public :: INPUTFILEEXTENSION = '.dat'
58+
character(len=:), allocatable, public :: CLI_jobName
5859
integer, save, public :: inc_written
5960

6061

6162
public :: &
6263
DAMASK_interface_init, &
63-
getSolverJobName, &
6464
getOutputFrequency
6565

6666
contains
@@ -100,6 +100,8 @@ subroutine DAMASK_interface_init()
100100
print*, 'working directory "'//trim(wd)//'" does not exist'
101101
call quit(1)
102102
end if
103+
CLI_jobName = getSolverJobName()
104+
103105
symmetricSolver = solverIsSymmetric()
104106
call getOutputFrequency
105107

@@ -131,7 +133,7 @@ logical function solverIsSymmetric()
131133
character(len=pSTRLEN) :: line
132134
integer :: myStat,fileUnit,s,e
133135

134-
open(newunit=fileUnit, file=getSolverJobName()//INPUTFILEEXTENSION, &
136+
open(newunit=fileUnit, file=CLI_jobName//INPUTFILEEXTENSION, &
135137
status='old', position='rewind', action='read',iostat=myStat)
136138
do
137139
read (fileUnit,'(A)',END=100) line
@@ -156,7 +158,7 @@ subroutine getOutputFrequency
156158
character(len=pSTRLEN) :: line
157159
integer, allocatable, dimension(:) :: chunkPos
158160

159-
open(newunit=fileUnit, file=getSolverJobName()//INPUTFILEEXTENSION, &
161+
open(newunit=fileUnit, file=CLI_jobName//INPUTFILEEXTENSION, &
160162
status='old', position='rewind', action='read',iostat=myStat)
161163
number_loadcases = 0
162164
do

src/Marc/discretization_Marc.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@ subroutine inputRead(elem,node0_elem,connectivity_elem,materialAt)
212212

213213

214214
call result_openJobFile()
215-
call result_addSetupFile(IO_read(trim(getSolverJobName())//InputFileExtension), &
216-
trim(getSolverJobName())//InputFileExtension, &
215+
call result_addSetupFile(IO_read(trim(CLI_jobName)//InputFileExtension), &
216+
trim(CLI_jobName)//InputFileExtension, &
217217
'MSC.Marc input deck')
218218
call result_closeJobFile()
219219

220-
inputFile = readlines(trim(getSolverJobName())//InputFileExtension)
220+
inputFile = readlines(trim(CLI_jobName)//InputFileExtension)
221221
call inputRead_fileFormat(fileFormatVersion, &
222222
inputFile)
223223
call inputRead_tableStyles(initialcondTableStyle,hypoelasticTableStyle, &

src/grid/DAMASK_grid.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ program DAMASK_grid
241241
! write header of output file
242242
if (worldrank == 0) then
243243
writeHeader: if (CLI_restartInc < 1) then
244-
open(newunit=statUnit,file=trim(getSolverJobName())//'.sta',form='FORMATTED',status='REPLACE')
244+
open(newunit=statUnit,file=trim(CLI_jobName)//'.sta',form='FORMATTED',status='REPLACE')
245245
write(statUnit,'(a)') 'Increment Time CutbackLevel Converged IterationsNeeded StagIterationsNeeded' ! statistics file
246246
else writeHeader
247-
open(newunit=statUnit,file=trim(getSolverJobName())//&
247+
open(newunit=statUnit,file=trim(CLI_jobName)//&
248248
'.sta',form='FORMATTED', position='APPEND', status='OLD')
249249
end if writeHeader
250250
end if
@@ -388,7 +388,7 @@ program DAMASK_grid
388388
call MPI_Allreduce(signal_SIGUSR2,sig,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
389389
call parallelization_chkerr(err_MPI)
390390
if (mod(inc,loadCases(l)%f_restart) == 0 .or. sig) then
391-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','w')
391+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','w')
392392
call HDF5_addAttribute(fileHandle,'increment',totalIncsCounter)
393393
call HDF5_closeFile(fileHandle)
394394
do field = 1, nActiveFields

src/grid/grid_damage_spectral.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ subroutine grid_damage_spectral_init(num_grid)
177177
restartRead: if (CLI_restartInc > 0) then
178178
print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc
179179

180-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
180+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','r')
181181
groupHandle = HDF5_openGroup(fileHandle,'solver')
182182

183183
call HDF5_read(tempN,groupHandle,'phi',.false.)
@@ -316,7 +316,7 @@ subroutine grid_damage_spectral_restartWrite()
316316

317317
print'(1x,a)', 'saving damage solver data required for restart'; flush(IO_STDOUT)
318318

319-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
319+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a')
320320
groupHandle = HDF5_openGroup(fileHandle,'solver')
321321
call HDF5_write(reshape(phi,[1,product(shape(phi))]),groupHandle,'phi')
322322
call HDF5_write(reshape(phi_lastInc,[1,product(shape(phi_lastInc))]),groupHandle,'phi_lastInc')

src/grid/grid_mech_FEM.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ subroutine grid_mechanical_FEM_init(num_grid)
242242
restartRead: if (CLI_restartInc > 0) then
243243
print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc
244244

245-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
245+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','r')
246246
groupHandle = HDF5_openGroup(fileHandle,'solver')
247247

248248
call HDF5_read(P_aim,groupHandle,'P_aim',.false.)
@@ -440,7 +440,7 @@ subroutine grid_mechanical_FEM_restartWrite()
440440

441441
print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
442442

443-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
443+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a')
444444
groupHandle = HDF5_addGroup(fileHandle,'solver')
445445
call HDF5_write(reshape(F,[3,3,product(shape(F))/9]),groupHandle,'F')
446446
call HDF5_write(reshape(F_lastInc,[3,3,product(shape(F_lastInc))/9]),groupHandle,'F_lastInc')
@@ -450,7 +450,7 @@ subroutine grid_mechanical_FEM_restartWrite()
450450
call HDF5_closeFile(fileHandle)
451451

452452
if (worldrank == 0) then
453-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a',.false.)
453+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a',.false.)
454454
groupHandle = HDF5_openGroup(fileHandle,'solver')
455455
call HDF5_write(P_aim,groupHandle,'P_aim',.false.)
456456
call HDF5_write(F_aim,groupHandle,'F_aim',.false.)

src/grid/grid_mech_spectral_Galerkin.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ subroutine grid_mechanical_spectral_Galerkin_init(num_grid)
287287
restartRead: if (CLI_restartInc > 0) then
288288
print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc
289289

290-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
290+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','r')
291291
groupHandle = HDF5_openGroup(fileHandle,'solver')
292292

293293
call HDF5_read(P_aim,groupHandle,'P_aim',.false.)
@@ -486,15 +486,15 @@ subroutine grid_mechanical_spectral_Galerkin_restartWrite()
486486

487487
print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
488488

489-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
489+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a')
490490
groupHandle = HDF5_addGroup(fileHandle,'solver')
491491
call HDF5_write(reshape(F,[3,3,product(shape(F))/9]),groupHandle,'F')
492492
call HDF5_write(reshape(F_lastInc,[3,3,product(shape(F_lastInc))/9]),groupHandle,'F_lastInc')
493493
call HDF5_closeGroup(groupHandle)
494494
call HDF5_closeFile(fileHandle)
495495

496496
if (worldrank == 0) then
497-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a',.false.)
497+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a',.false.)
498498
groupHandle = HDF5_openGroup(fileHandle,'solver')
499499
call HDF5_write(P_aim,groupHandle,'P_aim',.false.)
500500
call HDF5_write(F_aim,groupHandle,'F_aim',.false.)

src/grid/grid_mech_spectral_basic.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ subroutine grid_mechanical_spectral_basic_init(num_grid)
201201
restartRead: if (CLI_restartInc > 0) then
202202
print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc
203203

204-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
204+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','r')
205205
groupHandle = HDF5_openGroup(fileHandle,'solver')
206206

207207
call HDF5_read(P_aim,groupHandle,'P_aim',.false.)
@@ -406,15 +406,15 @@ subroutine grid_mechanical_spectral_basic_restartWrite()
406406

407407
print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
408408

409-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
409+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a')
410410
groupHandle = HDF5_addGroup(fileHandle,'solver')
411411
call HDF5_write(reshape(F,[3,3,product(shape(F))/9]),groupHandle,'F')
412412
call HDF5_write(reshape(F_lastInc,[3,3,product(shape(F_lastInc))/9]),groupHandle,'F_lastInc')
413413
call HDF5_closeGroup(groupHandle)
414414
call HDF5_closeFile(fileHandle)
415415

416416
if (worldrank == 0) then
417-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a',.false.)
417+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a',.false.)
418418
groupHandle = HDF5_openGroup(fileHandle,'solver')
419419
call HDF5_write(P_aim,groupHandle,'P_aim',.false.)
420420
call HDF5_write(F_aim,groupHandle,'F_aim',.false.)

src/grid/grid_mech_spectral_polarization.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ subroutine grid_mech_spectral_polarization_init(num_grid)
224224
restartRead: if (CLI_restartInc > 0) then
225225
print '(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc
226226

227-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
227+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','r')
228228
groupHandle = HDF5_openGroup(fileHandle,'solver')
229229

230230
call HDF5_read(P_aim,groupHandle,'P_aim',.false.)
@@ -464,7 +464,7 @@ subroutine grid_mech_spectral_polarization_restartWrite()
464464

465465
print '(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
466466

467-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
467+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a')
468468
groupHandle = HDF5_addGroup(fileHandle,'solver')
469469
call HDF5_write(reshape(F,[3,3,product(shape(F))/9]),groupHandle,'F')
470470
call HDF5_write(reshape(F_lastInc,[3,3,product(shape(F_lastInc))/9]),groupHandle,'F_lastInc')
@@ -474,7 +474,7 @@ subroutine grid_mech_spectral_polarization_restartWrite()
474474
call HDF5_closeFile(fileHandle)
475475

476476
if (worldrank == 0) then
477-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a',.false.)
477+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a',.false.)
478478
groupHandle = HDF5_openGroup(fileHandle,'solver')
479479
call HDF5_write(F_aim,groupHandle,'P_aim',.false.)
480480
call HDF5_write(F_aim,groupHandle,'F_aim',.false.)

src/grid/grid_thermal_spectral.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ subroutine grid_thermal_spectral_init(num_grid)
154154
restartRead: if (CLI_restartInc > 0) then
155155
print'(/,1x,a,1x,i0)', 'loading restart data of increment', CLI_restartInc
156156

157-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','r')
157+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','r')
158158
groupHandle = HDF5_openGroup(fileHandle,'solver')
159159

160160
call HDF5_read(tempN,groupHandle,'T',.false.)
@@ -301,7 +301,7 @@ subroutine grid_thermal_spectral_restartWrite()
301301

302302
print'(1x,a)', 'saving thermal solver data required for restart'; flush(IO_STDOUT)
303303

304-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
304+
fileHandle = HDF5_openFile(CLI_jobName//'_restart.hdf5','a')
305305
groupHandle = HDF5_openGroup(fileHandle,'solver')
306306
call HDF5_write(reshape(T,[1,product(shape(T))]),groupHandle,'T')
307307
call HDF5_write(reshape(T_lastInc,[1,product(shape(T_lastInc))]),groupHandle,'T_lastInc')

0 commit comments

Comments
 (0)