예제 #1
0
 def test_read_bc_east_ll_coarse(self):
     path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'test_files')
     fname = os.path.join(path, 'east_LL_coarse.bc')
     base_file = os.path.join(path, 'base_east_LL_coarse.bc')
     out_file = os.path.join(path, 'out_files', 'out_east_LL_coarse.bc')
     model = AdhModel()
     model.read_bc(fname, fmt='bc')
     model.write_bc(out_file, fmt='bc', validate=False)
     self.assertTrue(filecmp.cmp(base_file, out_file))
예제 #2
0
 def test_read_bc_red_river(self):
     path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'test_files')
     fname = os.path.join(path, 'RedRiver.bc')
     base_file = os.path.join(path, 'base_RedRiver.bc')
     out_file = os.path.join(path, 'out_files', 'out_RedRiver.bc')
     model = AdhModel()
     model.read_bc(fname, fmt='bc')
     model.write_bc(out_file, fmt='bc', validate=False)
     self.assertTrue(filecmp.cmp(base_file, out_file))
예제 #3
0
 def test_read_bc_2d_coriolis_x(self):
     path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                         'test_files')
     fname = os.path.join(path, '2D-coriolis_X.bc')
     base_file = os.path.join(path, 'base_2D-coriolis_X.bc')
     out_file = os.path.join(path, 'out_files', 'out_2D-coriolis_X.bc')
     model = AdhModel()
     model.read_bc(fname, fmt='bc')
     model.write_bc(out_file, fmt='bc', validate=False)
     self.assertTrue(filecmp.cmp(base_file, out_file))
예제 #4
0
def test_adhmodel_read_bc():
    # set test project name
    project_name = 'SanDiego'
    # set project directory
    path = os.path.join(TESTDIR, 'test_files', project_name,
                        f'{project_name}.bc')
    # instantiate empty adh model object
    adhmod = AdhModel()
    # read the mesh file
    adhmod.read_bc(file_name=path, fmt='bc')
예제 #5
0
    def test_read_bc_file(self):
        path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                            'test_files')
        fname = os.path.join(path, 'ka_mult_sed.bc')
        base_file = os.path.join(path, 'base_ka_mult_sed.bc')
        out_file = os.path.join(path, 'out_files', 'out_ka_mult_sed.bc')
        out_file2 = os.path.join(path, 'out_files', 'out2_ka_mult_sed.bc')
        model = AdhModel()
        model.read_bc(fname, fmt='bc')
        model.write_bc(out_file, fmt='bc', validate=False)
        self.assertTrue(filecmp.cmp(base_file, out_file))

        bc_class2 = BoundaryConditions()
        read_bc_file(out_file, bc_class2)
        write_bc_file(out_file2, bc_class2)
        self.assertTrue(filecmp.cmp(out_file, out_file2))