def test_writeInfoXML(self): nproc = 2 modelRun = mrun.ModelRun('TestModel', self.inputFiles, self.outputPath, nproc=nproc, basePath=self.basedir) modelRun.simParams = mrun.SimParams(nsteps=5, cpevery=10) modelRun.writeInfoXML(prettyPrint=True)
def test_genFlattenedXML(self): modelRun = mrun.ModelRun('TestModel', self.inputFiles, self.outputPath, basePath=self.basedir) modelRun.simParams = mrun.SimParams(nsteps=5, cpevery=10) modelRun.paramOverrides['allowUnbalancing'] = False modelRun.paramOverrides['defaultDiffusivity'] = 1.0e-5 flatFilename = os.path.join("output", "testFlat.xml") modelRun.genFlattenedXML(flatFilename=flatFilename) os.unlink(modelRun.analysisXML) self.assertTrue(os.path.exists(flatFilename))
def _createDefaultModelRun(self, modelName, outputPath=None): """Create and return a :class:`credo.modelrun.ModelRun` with the default options as specified for this System Test. (Thus is a useful helper function for sub-classes, so they can use this and not keep up to date with changes in the ModelRun interface.)""" return mrun.ModelRun(modelName, self.inputFiles, outputPath, basePath=self.basePath, nproc=self.nproc, paramOverrides=copy.copy(self.paramOverrides), solverOpts=copy.copy(self.solverOpts))
#For now just copy all args as input files inputFiles = args modelName, ext = os.path.splitext(args[0]) # Do the following live on an options struct? outputPath = 'output/' + modelName nproc = 1 resSet = [(10, 10), (20, 20), (30, 30), (40, 40)] print "Running all resolutions in resolution set:" print resSet for res in resSet: mOutputPath = outputPath + os.sep + mrun.strRes(res) mRun = mrun.ModelRun(modelName, inputFiles, mOutputPath, nproc=nproc) customOpts = "--pluginData.appendToAnalysisFile=True " customOpts += mrun.generateResOpts(res) # For analytic test, assume the user has specified what fields to analyse # in the XML (In the background this will generate the flattened XML # for the model fTests = mRun.analysis['fieldTests'] fTests.readFromStgXML(mRun.modelInputFiles) # Set all field tolerances at once. Of course, should allow this to # be over-ridden fTests.setAllTols(defaultFieldTol) mRun.writeModelRunXML()