Merge branch 'modernize-testing' into 'development'

Modernize testing

See merge request damask/DAMASK!280
This commit is contained in:
Sharan Roongta 2020-11-16 20:10:38 +01:00
commit c16ad845bc
9 changed files with 47 additions and 142 deletions

View File

@ -187,8 +187,6 @@ grid_mech_compile_Intel:
stage: compilePETSc stage: compilePETSc
script: script:
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel
- cp -r grid_mech_compile grid_mech_compile_Intel
- grid_mech_compile_Intel/test.py
- cd pytest - cd pytest
- pytest -k 'compile and grid' --basetemp=${TESTROOT}/compile_grid_Intel - pytest -k 'compile and grid' --basetemp=${TESTROOT}/compile_grid_Intel
except: except:
@ -199,8 +197,6 @@ Compile_FEM_Intel:
stage: compilePETSc stage: compilePETSc
script: script:
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel - module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel
- cp -r FEM_compile FEM_compile_Intel
- FEM_compile_Intel/test.py
- cd pytest - cd pytest
- pytest -k 'compile and mesh' --basetemp=${TESTROOT}/compile_mesh_Intel - pytest -k 'compile and mesh' --basetemp=${TESTROOT}/compile_mesh_Intel
except: except:
@ -211,8 +207,6 @@ grid_mech_compile_GNU:
stage: compilePETSc stage: compilePETSc
script: script:
- module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU - module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU
- cp -r grid_mech_compile grid_mech_compile_GNU
- grid_mech_compile_GNU/test.py
- cd pytest - cd pytest
- pytest -k 'compile and grid' --basetemp=${TESTROOT}/compile_grid_GNU - pytest -k 'compile and grid' --basetemp=${TESTROOT}/compile_grid_GNU
except: except:
@ -223,8 +217,6 @@ Compile_FEM_GNU:
stage: compilePETSc stage: compilePETSc
script: script:
- module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU - module load $GNUCompiler $MPICH_GNU $PETSc_MPICH_GNU
- cp -r FEM_compile FEM_compile_GNU
- FEM_compile_GNU/test.py
- cd pytest - cd pytest
- pytest -k 'compile and mesh' --basetemp=${TESTROOT}/compile_mesh_GNU - pytest -k 'compile and mesh' --basetemp=${TESTROOT}/compile_mesh_GNU
except: except:
@ -274,22 +266,6 @@ Nonlocal_Damage_DetectChanges:
- master - master
- release - release
grid_all_restart:
stage: grid
script: grid_all_restart/test.py
except:
- master
- release
grid_all_restartMPI:
stage: grid
script:
- module load $IntelCompiler $MPICH_Intel $PETSc_MPICH_Intel
- grid_all_restartMPI/test.py
except:
- master
- release
Plasticity_DetectChanges: Plasticity_DetectChanges:
stage: grid stage: grid
script: Plasticity_DetectChanges/test.py script: Plasticity_DetectChanges/test.py

@ -1 +1 @@
Subproject commit 281e7eb84f76a2974a50eb54faf35ea25ec89b20 Subproject commit 2105ed1c6e4800050010ca4d73b1882022f81551

View File

@ -1,69 +0,0 @@
#!/usr/bin/env python3
import os
import sys
from optparse import OptionParser
import damask
scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version])
minimal_surfaces = list(damask.Geom._minimal_surface.keys())
# --------------------------------------------------------------------
# MAIN
# --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [geomfile]', description = """
Generate a bicontinuous structure of given type.
""", version = scriptID)
parser.add_option('-t','--type',
dest = 'type',
choices = minimal_surfaces, metavar = 'string',
help = 'type of minimal surface [primitive] {%s}' %(','.join(minimal_surfaces)))
parser.add_option('-f','--threshold',
dest = 'threshold',
type = 'float', metavar = 'float',
help = 'threshold value defining minimal surface [%default]')
parser.add_option('-g', '--grid',
dest = 'grid',
type = 'int', nargs = 3, metavar = 'int int int',
help = 'a,b,c grid of hexahedral box [%default]')
parser.add_option('-s', '--size',
dest = 'size',
type = 'float', nargs = 3, metavar = 'float float float',
help = 'x,y,z size of hexahedral box [%default]')
parser.add_option('-p', '--periods',
dest = 'periods',
type = 'int', metavar = 'int',
help = 'number of repetitions of unit cell [%default]')
parser.add_option('--m',
dest = 'microstructure',
type = 'int', nargs = 2, metavar = 'int int',
help = 'two microstructure indices to be used [%default]')
parser.set_defaults(type = minimal_surfaces[0],
threshold = 0.0,
periods = 1,
grid = (16,16,16),
size = (1.0,1.0,1.0),
microstructure = (1,2),
)
(options,filename) = parser.parse_args()
name = None if filename == [] else filename[0]
damask.util.report(scriptName,name)
geom=damask.Geom.from_minimal_surface(options.grid,options.size,options.type,options.threshold,
options.periods,options.microstructure)
damask.util.croak(geom)
geom.save_ASCII(sys.stdout if name is None else name)

View File

@ -3,10 +3,6 @@ from pathlib import Path
class Environment: class Environment:
def __init__(self):
"""Do Nothing."""
pass
@property @property
def screen_size(self): def screen_size(self):
width = 1024 width = 1024
@ -43,8 +39,3 @@ class Environment:
def root_dir(self): def root_dir(self):
"""Return DAMASK root path.""" """Return DAMASK root path."""
return Path(__file__).parents[2] return Path(__file__).parents[2]
# for compatibility
def rootDir(self):
return str(self.root_dir)

View File

@ -31,7 +31,7 @@ class Table:
def __repr__(self): def __repr__(self):
"""Brief overview.""" """Brief overview."""
return util.srepr(self.comments)+'\n'+self.data.__repr__() return '\n'.join(['# '+c for c in self.comments])+'\n'+self.data.__repr__()
def __len__(self): def __len__(self):
"""Number of rows.""" """Number of rows."""
@ -159,7 +159,7 @@ class Table:
comments = [util.execution_stamp('Table','from_ang')] comments = [util.execution_stamp('Table','from_ang')]
for line in content: for line in content:
if line.startswith('#'): if line.startswith('#'):
comments.append(line.strip()) comments.append(line.split('#',1)[1].strip())
else: else:
break break
@ -222,6 +222,7 @@ class Table:
dup.data[label] = data.reshape(dup.data[label].shape) dup.data[label] = data.reshape(dup.data[label].shape)
return dup return dup
def add(self,label,data,info=None): def add(self,label,data,info=None):
""" """
Add column data. Add column data.

View File

@ -127,9 +127,9 @@ subroutine DAMASK_interface_init
if (err /= 0) call quit(1) if (err /= 0) call quit(1)
select case(trim(arg)) ! extract key select case(trim(arg)) ! extract key
case ('-h','--help') case ('-h','--help')
print'(a)', ' #######################################################################' print'(/,a)',' #######################################################################'
print'(a)', ' DAMASK Command Line Interface:' print'(a)', ' DAMASK Command Line Interface:'
print'(a)', ' For PETSc-based solvers for the Düsseldorf Advanced Material Simulation Kit' print'(a)', ' Düsseldorf Advanced Material Simulation Kit with PETSc-based solvers'
print'(a,/)',' #######################################################################' print'(a,/)',' #######################################################################'
print'(a,/)',' Valid command line switches:' print'(a,/)',' Valid command line switches:'
print'(a)', ' --geom (-g, --geometry)' print'(a)', ' --geom (-g, --geometry)'

View File

@ -498,7 +498,7 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,devNull3,reason,dumm
err_div/divTol, ' (',err_div, ' / m, tol = ',divTol,')' err_div/divTol, ' (',err_div, ' / m, tol = ',divTol,')'
print '(a,f12.2,a,es8.2,a,es9.2,a)', ' error curl = ', & print '(a,f12.2,a,es8.2,a,es9.2,a)', ' error curl = ', &
err_curl/curlTol,' (',err_curl,' -, tol = ',curlTol,')' err_curl/curlTol,' (',err_curl,' -, tol = ',curlTol,')'
print '(a,f12.2,a,es8.2,a,es9.2,a)', ' error stress BC = ', & print '(a,f12.2,a,es8.2,a,es9.2,a)', ' error stress BC = ', &
err_BC/BCTol, ' (',err_BC, ' Pa, tol = ',BCTol,')' err_BC/BCTol, ' (',err_BC, ' Pa, tol = ',BCTol,')'
print'(/,a)', ' ===========================================================================' print'(/,a)', ' ==========================================================================='
flush(IO_STDOUT) flush(IO_STDOUT)

View File

@ -110,7 +110,8 @@ program DAMASK_mesh
enddo ! count all identifiers to allocate memory and do sanity check enddo ! count all identifiers to allocate memory and do sanity check
enddo enddo
allocate (loadCases(N_def)) if(N_def < 1) call IO_error(error_ID = 837)
allocate(loadCases(N_def))
do i = 1, size(loadCases) do i = 1, size(loadCases)
allocate(loadCases(i)%fieldBC(nActiveFields)) allocate(loadCases(i)%fieldBC(nActiveFields))
@ -161,7 +162,7 @@ program DAMASK_mesh
do faceSet = 1, mesh_Nboundaries do faceSet = 1, mesh_Nboundaries
if (mesh_boundaries(faceSet) == currentFace) currentFaceSet = faceSet if (mesh_boundaries(faceSet) == currentFace) currentFaceSet = faceSet
enddo enddo
if (currentFaceSet < 0) call IO_error(error_ID = errorID, ext_msg = 'invalid BC') if (currentFaceSet < 0) call IO_error(error_ID = 837, ext_msg = 'invalid BC')
case('t','time','delta') ! increment time case('t','time','delta') ! increment time
loadCases(currentLoadCase)%time = IO_floatValue(line,chunkPos,i+1) loadCases(currentLoadCase)%time = IO_floatValue(line,chunkPos,i+1)
case('n','incs','increments','steps') ! number of increments case('n','incs','increments','steps') ! number of increments

View File

@ -17,6 +17,7 @@ module discretization_mesh
use IO use IO
use config use config
use discretization use discretization
use results
use FEsolving use FEsolving
use FEM_quadrature use FEM_quadrature
use YAML_types use YAML_types
@ -182,6 +183,10 @@ subroutine discretization_mesh_init(restart)
reshape(mesh_ipCoordinates,[3,mesh_maxNips*mesh_NcpElems]), & reshape(mesh_ipCoordinates,[3,mesh_maxNips*mesh_NcpElems]), &
mesh_node0) mesh_node0)
call results_openJobFile
call results_closeGroup(results_addGroup('geometry'))
call results_closeJobFile
end subroutine discretization_mesh_init end subroutine discretization_mesh_init