def testSolution(self): input_dir = "tests/junctions/" test_dir = input_dir + "equal_solution_lm_1phase_junction/" solution_file = test_dir + "equal_solution_lm_1phase_junction.csv" mods = list() mods.append( SubblockParameterModification("Junctions", "junction1", "type", "EqualSolutionLM1PhaseJunction")) mods.append( SubblockParameterModification("Junctions", "junction1", "phase", "air")) mods.append( BlockParameterModification("NonlinearSolver", "verbose", False)) mods.append(BlockParameterModification("Executioner", "verbose", False)) mods.append(BlockParameterModification("Executioner", "end_time", 0.05)) mods.append( BlockParameterModification("Output", "solution_file", solution_file)) mods.append( BlockParameterModification("Output", "plot_solution", False)) sem.run(input_dir + "junction.in", mods) csv_tester = CSVTester(test_dir, "equal_solution_lm_1phase_junction.csv") self.assertTrue(csv_tester.filesAreEqual())
def solutionsAreEqual(self): # add default modifications self.input_file_modifier.modifyBlockParam("Executioner", "verbose", False) self.input_file_modifier.modifyBlockParam("NonlinearSolver", "verbose", False) self.input_file_modifier.modifySubblockParam( "Output", "csv", "file_name", self.test_dir + self.solution_file_name) self.input_file_modifier.modifySubblockParam("Output", "csv", "save_by_mesh", False) self.input_file_modifier.removeSubblock("Output", "plot") sem.run(self.input_file, self.input_file_modifier) csv_tester = CSVTester(self.test_dir, self.solution_file_name) return csv_tester.filesAreEqual()
def test1Phase(self): test_dir = "tests/solution/source_splitting/" mods = list() mods.append( BlockParameterModification("NonlinearSolver", "verbose", False)) mods.append(BlockParameterModification("Executioner", "verbose", False)) mods.append( BlockParameterModification("Output", "plot_solution", False)) mods.append(BlockParameterModification("Output", "save_solution", True)) mods.append( BlockParameterModification( "Output", "solution_file", "tests/solution/source_splitting/solution_1phase.csv")) sem.run(test_dir + "source_splitting_1phase.in", mods) csv_tester = CSVTester(test_dir, "solution_1phase.csv") self.assertTrue(csv_tester.filesAreEqual())
def testSolution(self): test_dir = "tests/solution/one_phase_ss/" sem.run(test_dir + "one_phase_ss.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual())
import unittest import sem from ParameterModification import BlockParameterModification from CSVTester import CSVTester class OnePhaseSteadyStateTester(unittest.TestCase): ## Tests the solution def testSolution(self): test_dir = "tests/solution/one_phase_ss/" sem.run(test_dir + "one_phase_ss.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual()) if __name__ == "__main__": mods = list() mods.append(BlockParameterModification("NonlinearSolver", "verbose", True)) mods.append(BlockParameterModification("Output", "save_solution", False)) sem.run("one_phase_ss.in", mods)
import unittest import sem from ParameterModification import BlockParameterModification from CSVTester import CSVTester class TwoPhaseNoninteractingSteadyStateTester(unittest.TestCase): ## Tests the solution def testSolution(self): test_dir = "tests/solution/two_phase_noninteracting_ss/" sem.run(test_dir + "two_phase_noninteracting_ss.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual()) if __name__ == "__main__": mods = list() mods.append(BlockParameterModification("NonlinearSolver", "verbose", True)) mods.append(BlockParameterModification("Output", "save_solution", False)) sem.run("two_phase_noninteracting_ss.in", mods)
def testSolution(self): test_dir = "tests/mesh/multi_mesh/" sem.run(test_dir + "multi_mesh.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual())
import unittest import sem from ParameterModification import BlockParameterModification from CSVTester import CSVTester class MultiMeshTester(unittest.TestCase): ## Tests the solution def testSolution(self): test_dir = "tests/mesh/multi_mesh/" sem.run(test_dir + "multi_mesh.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual()) if __name__ == "__main__": mods = list() mods.append(BlockParameterModification("NonlinearSolver", "verbose", True)) mods.append( BlockParameterModification("Output", "solution_file", "solution.csv")) mods.append(BlockParameterModification("Output", "plot_solution", True)) mods.append( BlockParameterModification("Output", "plot_file", "solution.pdf")) sem.run("multi_mesh.in", mods)
def testSolution(self): test_dir = "tests/closures/berry_interface_closures/" sem.run(test_dir + "berry_interface_closures.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual())
import unittest import sem from ParameterModification import BlockParameterModification from CSVTester import CSVTester class BerryInterfaceClosuresTester(unittest.TestCase): ## Tests the solution def testSolution(self): test_dir = "tests/closures/berry_interface_closures/" sem.run(test_dir + "berry_interface_closures.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual()) if __name__ == "__main__": mods = list() mods.append(BlockParameterModification("NonlinearSolver", "verbose", True)) mods.append(BlockParameterModification("Executioner", "verbose", True)) mods.append(BlockParameterModification("Output", "save_solution", False)) sem.run("berry_interface_closures.in", mods)
import unittest import sem from ParameterModification import BlockParameterModification from CSVTester import CSVTester class AmbrosoInterfaceClosuresTester(unittest.TestCase): ## Tests the solution def testSolution(self): test_dir = "tests/closures/ambroso_interface_closures/" sem.run(test_dir + "ambroso_interface_closures.in") csv_tester = CSVTester(test_dir, "solution.csv") self.assertTrue(csv_tester.filesAreEqual()) if __name__ == "__main__": mods = list() mods.append(BlockParameterModification("NonlinearSolver", "verbose", True)) mods.append(BlockParameterModification("Executioner", "verbose", True)) mods.append(BlockParameterModification("Output", "save_solution", False)) sem.run("ambroso_interface_closures.in", mods)