Skip to content

Commit d153ac6

Browse files
committed
Add download_fluent_mixing_elbow_transient
1 parent b5abc32 commit d153ac6

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

src/ansys/dpf/core/examples/downloads.py

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,3 +1343,107 @@ def download_fluent_mixing_elbow_steady_state(
13431343
),
13441344
],
13451345
}
1346+
1347+
1348+
def download_fluent_mixing_elbow_transient(
1349+
should_upload: bool = True, server=None, return_local_path=False
1350+
) -> dict:
1351+
"""Download the flprj, cas and dat files of a transient fluent analysis of a mixing elbow
1352+
and return the download paths into a dictionary extension->path.
1353+
If the server is remote (or doesn't share memory), the file is uploaded or made available
1354+
on the server side.
1355+
1356+
Examples files are downloaded to a persistent cache to avoid
1357+
re-downloading the same file twice.
1358+
1359+
Parameters
1360+
----------
1361+
should_upload : bool, optional (default True)
1362+
Whether the file should be uploaded server side when the server is remote.
1363+
server : server.DPFServer, optional
1364+
Server with channel connected to the remote or local instance. When
1365+
``None``, attempts to use the global server.
1366+
return_local_path: bool, optional
1367+
If ``True``, the local path is returned as is, without uploading, nor searching
1368+
for mounted volumes.
1369+
1370+
Returns
1371+
-------
1372+
dict[str:str]
1373+
Path to the example files.
1374+
1375+
Examples
1376+
--------
1377+
Download an example result file and return the path of the file
1378+
1379+
>>> from ansys.dpf.core import examples
1380+
>>> paths = examples.download_fluent_mixing_elbow_transient()
1381+
>>> paths
1382+
{'flprj': 'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow.flprj',
1383+
'cas': [
1384+
'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow-2.cas.h5',
1385+
],
1386+
'dat': [
1387+
'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow-2-00001.dat.h5',
1388+
'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow-2-00002.dat.h5',
1389+
'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow-2-00003.dat.h5',
1390+
'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow-2-00004.dat.h5',
1391+
'C:\\Users\\user\\AppData\\Local\\ansys-dpf-core\\ansys-dpf-core\\examples\\fluent-mixing_elbow_transient\\elbow-2-00005.dat.h5',
1392+
]} # noqa: E501
1393+
1394+
"""
1395+
return {
1396+
"flprj": _download_file(
1397+
"result_files/fluent-mixing_elbow_transient",
1398+
"elbow.flprj",
1399+
should_upload,
1400+
server,
1401+
return_local_path,
1402+
),
1403+
"cas": [
1404+
_download_file(
1405+
"result_files/fluent-mixing_elbow_transient",
1406+
"elbow-2.cas.h5",
1407+
should_upload,
1408+
server,
1409+
return_local_path,
1410+
),
1411+
],
1412+
"dat": [
1413+
_download_file(
1414+
"result_files/fluent-mixing_elbow_transient",
1415+
"elbow-2-00001.dat.h5",
1416+
should_upload,
1417+
server,
1418+
return_local_path,
1419+
),
1420+
_download_file(
1421+
"result_files/fluent-mixing_elbow_transient",
1422+
"elbow-2-00002.dat.h5",
1423+
should_upload,
1424+
server,
1425+
return_local_path,
1426+
),
1427+
_download_file(
1428+
"result_files/fluent-mixing_elbow_transient",
1429+
"elbow-2-00003.dat.h5",
1430+
should_upload,
1431+
server,
1432+
return_local_path,
1433+
),
1434+
_download_file(
1435+
"result_files/fluent-mixing_elbow_transient",
1436+
"elbow-2-00004.dat.h5",
1437+
should_upload,
1438+
server,
1439+
return_local_path,
1440+
),
1441+
_download_file(
1442+
"result_files/fluent-mixing_elbow_transient",
1443+
"elbow-2-00005.dat.h5",
1444+
should_upload,
1445+
server,
1446+
return_local_path,
1447+
),
1448+
],
1449+
}

0 commit comments

Comments
 (0)