2
2
3
3
from ansys .dpf import post
4
4
from ansys .dpf .post import examples
5
-
6
- # from ansys.dpf.post.helpers import streamlines
7
- from conftest import SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0
5
+ from ansys .dpf .post .helpers import streamlines
6
+ from conftest import (
7
+ SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0 ,
8
+ SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0 ,
9
+ )
8
10
9
11
10
12
@pytest .mark .skipif (
@@ -17,53 +19,53 @@ def simulation(self) -> post.FluidSimulation:
17
19
files_cfx = examples .download_cfx_heating_coil ()
18
20
return post .FluidSimulation (cas = files_cfx ["cas" ], dat = files_cfx ["dat" ]) # noqa
19
21
20
- # def test_plot_streamlines(self, simulation):
21
- # # import pyvista as pv
22
- # #
23
- # # pv.OFF_SCREEN = False
24
- # dataframe = simulation.velocity(times=[0.0], zone_ids=[5])
25
- # sources = [
26
- # {"radius": 0.25, "center": (0.75, 0.0, 0.0), "n_points": 20},
27
- # {
28
- # "radius": 0.25,
29
- # "center": (0.0, 0.75, 0.0),
30
- # "n_points": 5,
31
- # "max_time": 10.0,
32
- # },
33
- # {"radius": 0.25, "center": (-0.75, 0.0, 0.0), "max_time": 2.0},
34
- # {"radius": 0.25, "center": (0.0, -0.75, 0.0)},
35
- # ]
36
- # streamlines.plot_streamlines(
37
- # dataframe=dataframe,
38
- # sources=sources,
39
- # streamline_thickness=0.007,
40
- # plot_mesh=True,
41
- # mesh_opacity=0.2,
42
- # plot_contour=True,
43
- # contour_opacity=0.3,
44
- # title="Streamlines with multiple sources",
45
- # )
46
- # dataframe = simulation.velocity()
47
- # with pytest.raises(ValueError, match="The set_id requested is not available"):
48
- # streamlines.plot_streamlines(
49
- # dataframe=dataframe,
50
- # sources=sources,
51
- # set_id=2,
52
- # streamline_thickness=0.007,
53
- # plot_mesh=True,
54
- # mesh_opacity=0.2,
55
- # plot_contour=True,
56
- # contour_opacity=0.3,
57
- # title="Streamlines with multiple sources",
58
- # )
59
- # streamlines.plot_streamlines(
60
- # dataframe=dataframe,
61
- # sources=sources,
62
- # set_id=1,
63
- # streamline_thickness=0.007,
64
- # plot_mesh=True,
65
- # mesh_opacity=0.2,
66
- # plot_contour=True,
67
- # contour_opacity=0.3,
68
- # title="Streamlines with multiple sources",
69
- # )
22
+ def test_plot_streamlines (self , simulation ):
23
+ if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0 :
24
+ dataframe = simulation . velocity ( times = [ 0.0 ], zone_ids = [ 1 ])
25
+ else :
26
+ dataframe = simulation .velocity (times = [0.0 ], zone_ids = [5 ])
27
+ sources = [
28
+ {"radius" : 0.25 , "center" : (0.75 , 0.0 , 0.0 ), "n_points" : 20 },
29
+ {
30
+ "radius" : 0.25 ,
31
+ "center" : (0.0 , 0.75 , 0.0 ),
32
+ "n_points" : 5 ,
33
+ "max_time" : 10.0 ,
34
+ },
35
+ {"radius" : 0.25 , "center" : (- 0.75 , 0.0 , 0.0 ), "max_time" : 2.0 },
36
+ {"radius" : 0.25 , "center" : (0.0 , - 0.75 , 0.0 )},
37
+ ]
38
+ streamlines .plot_streamlines (
39
+ dataframe = dataframe ,
40
+ sources = sources ,
41
+ streamline_thickness = 0.007 ,
42
+ plot_mesh = True ,
43
+ mesh_opacity = 0.2 ,
44
+ plot_contour = True ,
45
+ contour_opacity = 0.3 ,
46
+ title = "Streamlines with multiple sources" ,
47
+ )
48
+ dataframe = simulation .velocity ()
49
+ with pytest .raises (ValueError , match = "The set_id requested is not available" ):
50
+ streamlines .plot_streamlines (
51
+ dataframe = dataframe ,
52
+ sources = sources ,
53
+ set_id = 2 ,
54
+ streamline_thickness = 0.007 ,
55
+ plot_mesh = True ,
56
+ mesh_opacity = 0.2 ,
57
+ plot_contour = True ,
58
+ contour_opacity = 0.3 ,
59
+ title = "Streamlines with multiple sources" ,
60
+ )
61
+ streamlines .plot_streamlines (
62
+ dataframe = dataframe ,
63
+ sources = sources ,
64
+ set_id = 1 ,
65
+ streamline_thickness = 0.007 ,
66
+ plot_mesh = True ,
67
+ mesh_opacity = 0.2 ,
68
+ plot_contour = True ,
69
+ contour_opacity = 0.3 ,
70
+ title = "Streamlines with multiple sources" ,
71
+ )
0 commit comments