def run(self): # Compile and attempt to run the suite. (output, error) = self.compileSuite() # If an executable is produced, compilation succeeded. if "Segmentation fault" in error: # If there is a segmentation fault, perform verification and re-run. #print error print "Performing Verification" verifier = Verifier() verifier.suite = self.suite verifier.verify(self.suite.getFileName()) print "Attempting to rerun." self.suite.importSuite() self.run() else: # If it ran sucessfully, import the obligation scores and recalculate the suite score. self.suite.importObligations( os.path.basename(self.suite.getFileName()) + "sv") rmProcess = Popen( "rm " + os.path.basename(self.suite.getFileName()) + "sv", stdout=PIPE, stderr=PIPE, shell=True) (rOutput, eError) = rmProcess.communicate()
def test1DConfig(): v = Verifier("test/simulation1D_config.ini") v.verify() x = v._data["x"] u = v._data["u"] d2x = v._derivs["x"][2] dt = v._derivs["t"][1] uxx = d2x @ u ut = dt @ u print("1D MAX ERROR: ",str(np.amax(np.abs(v._output))))
def test2DConfig(): vgood = Verifier("test/simulation2D_config.ini") vgood.verify() vbad = Verifier("test/simulation2Dcorrupt_config.ini") vbad.verify() x = vgood._data["x"] y = vgood._data["y"] t = vgood._data["t"] u = vgood._data["u"] ubad = vbad._data["u"] print("2D MAX ERROR: ",str(np.amax(np.abs(vgood._output)))) contourPlotVector(x,y,t,u,title="Correct data\nDynamic heat equation in isotropic material",nobc=False,tstep=1,filename="correct_data_2D.png") contourPlotVector(x,y,t,ubad,title="Incorrect data\nDynamic heat equation in isotropic material",nobc=False,tstep=1,filename="incorrect_data_2D.png") contourPlotVector(x,y,t,np.abs(vbad._output),title="Identified error",colormap=cm.afmhot,filename="error_2D.png") pyplot.show()