Skip to content
Snippets Groups Projects

WIP: Python script to run all numerical tests of the paper

Closed Sander, Oliver requested to merge automate-numerical-tests into master
3 files
+ 289
0
Compare changes
  • Side-by-side
  • Inline
Files
3
import math
class ParameterSet(dict):
def __init__(self, *args, **kwargs):
super(ParameterSet, self).__init__(*args, **kwargs)
self.__dict__ = self
parameterSet = ParameterSet()
#############################################
# Grid parameters
#############################################
LX=1
LY=0.5
nX=32
nY=16
parameterSet.structuredGrid = 'true'
parameterSet.lower = '0 0'
parameterSet.upper = str(LX)+' '+ str(LY)
parameterSet.elements = str(nX)+' '+ str(nY)
parameterSet.resultPath= 'plots/'
#############################################
# Solver parameters
#############################################
# Tolerance of the multigrid solver
parameterSet.tolerance = 1e-7
# Maximum number of multigrid iterations
parameterSet.maxIterations = 10000
# Number of presmoothing steps
parameterSet.nu1 = 3
# Number of postsmoothing steps
parameterSet.nu2 = 3
# Tolerance of the base grid solver
parameterSet.baseTolerance = 1e-8
# Type of the linear correction
#parameterSet.linearCorrection = 'direct'
parameterSet.linearCorrection = 'geometricMultigrid'
parameterSet.nestedIteration = 'yes'
parameterSet.tnnmg = ParameterSet()
parameterSet.tnnmg.postprocess = ParameterSet()
parameterSet.tnnmg.postprocess.linesearch_normed = 'false'
# Options for smoother
parameterSet.outerIterations = 1
parameterSet.displacementIterations = 1
parameterSet.localSolver = ParameterSet()
parameterSet.localSolver.type = 'exact'
############################
# Problem specifications
############################
parameterSet.materialParameters = ParameterSet()
# Number of time steps
parameterSet.numTimeSteps = 160
# Lamé parameters
# (Notice that lambda is a key word in python such that
# we cannot use attribute syntax to set it but have to
# resort to dictionary syntax.)
parameterSet.materialParameters['lambda'] = 121
parameterSet.materialParameters.mu = 80
# Residual elastic stiffness
parameterSet.materialParameters.k = 1e-5
# Griffith critical energy release rate
parameterSet.materialParameters.g_c = 2.7e-3
# Fracture thickness
parameterSet.materialParameters.l = 2/64.0
tol = 0.001;
UY = 2e-5
def dirichlet_indicator(x) :
if ((abs(x[0]-0.5) < tol) & (x[1] <= 0.0+tol)) :
return ((1,1),0)
if ((x[0] >= 0.5+tol) & (x[1] <= 0.0+tol)) :
return ((0,1),0)
if (x[1] >= LY-tol) :
return ((0,1),0)
return ((0,0),0)
def initial_damage(x) :
return 0.0
def boundary_deformation(x,t) :
if (x[1] >= LY-tol) :
return (0, UY*(t+1))
return (0, 0)
def reac_indicator(x) :
if (x[1] >= LY-tol) :
return ((0,1),0)
return ((0,0),0)
Loading