else:
    mRun.simParams = SimParams(nsteps=runSteps, cpevery=0, dumpevery=0)
    fTests = mRun.analysis['fieldTests']
    fTests.testTimestep = runSteps
    fTests.useReference = True
    fTests.referencePath = expectedPath
    defFieldTol = 1e-2
    for fieldName in standardFields:
        fTests.add(FieldTest(fieldName, tol=defFieldTol))

mRun.writeInfoXML()

# This will generate an additional XML to require StGermain/Underworld to do
# any requested extra analysis (eg compare fields), and run for the
# appropriate number of timesteps etc.
mRun.analysisXMLGen()

credo.prepareOutputLogDirs(mRun.outputPath, mRun.logPath)

# This will run the model, and also save basic results (e.g. walltime)
results = credo.modelrun.runModel(mRun)

if not createReference:
    # TODO: This step necessary since currently convergence files saved
    # in directory of run may be better handled within the runModel
    credo.moveConvergenceResults(os.getcwd(), mRun.outputPath)

    results.fieldResults = fTests.testConvergence(outputPath)

    credo.modelresult.writeModelResultsXML(results, path=mRun.outputPath)
Exemplo n.º 2
0
else:
    mRun.simParams = SimParams(nsteps=runSteps, cpevery=0, dumpevery=0)
    fTests = mRun.analysis['fieldTests']
    fTests.testTimestep = runSteps
    fTests.useReference = True
    fTests.referencePath = expectedPath
    defFieldTol = 1e-2
    for fieldName in standardFields:
        fTests.add(FieldTest(fieldName, tol=defFieldTol))

mRun.writeInfoXML()

# This will generate an additional XML to require StGermain/Underworld to do
# any requested extra analysis (eg compare fields), and run for the
# appropriate number of timesteps etc.
mRun.analysisXMLGen()

credo.prepareOutputLogDirs(mRun.outputPath, mRun.logPath)

# This will run the model, and also save basic results (e.g. walltime)
results = credo.modelrun.runModel(mRun)

if not createReference:
    # TODO: This step necessary since currently convergence files saved
    # in directory of run may be better handled within the runModel
    credo.moveConvergenceResults(os.getcwd(), mRun.outputPath)

    results.fieldResults = fTests.testConvergence(outputPath)

    credo.modelresult.writeModelResultsXML(results, path=mRun.outputPath)
Exemplo n.º 3
0
outputPath = 'output' + os.sep + modelName
standardFields = ['VelocityField', 'PressureField']
runSteps = 20
assert runSteps % 2 == 0

print "Initial run:"
mRun = ModelRun(modelName + "-initial", inputFiles, outputPath, nproc=nproc)
initialOutputPath = outputPath + os.sep + "initial"
mRun.outputPath = initialOutputPath
mRun.simParams = SimParams(nsteps=runSteps, cpevery=runSteps / 2, dumpevery=0)
mRun.cpFields = standardFields

mRun.writeInfoXML()
credo.prepareOutputLogDirs(mRun.outputPath, mRun.logPath)
# This will run the model, and also save basic results (e.g. walltime)
analysisXML = mRun.analysisXMLGen()
results = credo.modelrun.runModel(mRun)
credo.modelresult.writeModelResultsXML(results, path=mRun.outputPath)

print "Restart run:"
mRun.name = modelName + "-restart"
mRun.outputPath = outputPath + os.sep + "restart"
mRun.cpReadPath = initialOutputPath
# Note we could modify existing SimParams rather than create new, but below is
# probably easier
mRun.simParams = SimParams(nsteps=runSteps/2, cpevery=0, dumpevery=0, \
    restartstep=runSteps/2)
fTests = mRun.analysis['fieldTests']
fTests.testTimestep = runSteps
fTests.useReference = True
fTests.referencePath = initialOutputPath
outputPath = "output" + os.sep + modelName
standardFields = ["VelocityField", "PressureField"]
runSteps = 20
assert runSteps % 2 == 0

print "Initial run:"
mRun = ModelRun(modelName + "-initial", inputFiles, outputPath, nproc=nproc)
initialOutputPath = outputPath + os.sep + "initial"
mRun.outputPath = initialOutputPath
mRun.simParams = SimParams(nsteps=runSteps, cpevery=runSteps / 2, dumpevery=0)
mRun.cpFields = standardFields

mRun.writeInfoXML()
credo.prepareOutputLogDirs(mRun.outputPath, mRun.logPath)
# This will run the model, and also save basic results (e.g. walltime)
analysisXML = mRun.analysisXMLGen()
results = credo.modelrun.runModel(mRun)
credo.modelresult.writeModelResultsXML(results, path=mRun.outputPath)

print "Restart run:"
mRun.name = modelName + "-restart"
mRun.outputPath = outputPath + os.sep + "restart"
mRun.cpReadPath = initialOutputPath
# Note we could modify existing SimParams rather than create new, but below is
# probably easier
mRun.simParams = SimParams(nsteps=runSteps / 2, cpevery=0, dumpevery=0, restartstep=runSteps / 2)
fTests = mRun.analysis["fieldTests"]
fTests.testTimestep = runSteps
fTests.useReference = True
fTests.referencePath = initialOutputPath
defFieldTol = 1e-5