diff --git a/test/data/hotRoom.zip b/test/data/hotRoom.zip new file mode 100644 index 0000000..3f18456 Binary files /dev/null and b/test/data/hotRoom.zip differ diff --git a/test/test_example.py b/test/test_example.py index f660ec6..cd4f24d 100644 --- a/test/test_example.py +++ b/test/test_example.py @@ -33,3 +33,28 @@ def test_baby_example(tmpdir): assert isinstance(vel, dolfinx.fem.Function) assert isinstance(T, dolfinx.fem.Function) + + +def test_hot_room(tmpdir): + time = 2000.0 + + zip_path = Path("test/data/hotRoom.zip") + extract_path = Path(tmpdir) / "hotRoom" + + # Unzip the file + with zipfile.ZipFile(zip_path, "r") as zip_ref: + zip_ref.extractall(extract_path) + + # Construct the path to the .foam file + foam_file = extract_path / "hotRoom/hotRoom.foam" + + # read the .foam file + my_of_reader = OpenFOAMReader(filename=str(foam_file), cell_type=12) + + vel = my_of_reader.create_dolfinx_function(t=time, name="U") + T = my_of_reader.create_dolfinx_function(t=time, name="T") + nut = my_of_reader.create_dolfinx_function(t=time, name="nut") + + assert isinstance(vel, dolfinx.fem.Function) + assert isinstance(T, dolfinx.fem.Function) + assert isinstance(nut, dolfinx.fem.Function)