|
[Sponsors] | |||||
|
|
|
#1 |
|
Member
Join Date: Dec 2023
Posts: 51
Rep Power: 4 ![]() |
Hi,
I have a case that requires coupling my Python code with CFX so that I can send input variables (from Python) to Ansys CFX and then extract outputs (simulation results) to my Python code for further calculations. What are the tools for this, and where can I start? Thank you. |
|
|
|
|
|
|
|
|
#2 | |
|
Senior Member
Join Date: Jun 2009
Posts: 1,945
Rep Power: 34 ![]() |
Quote:
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
|
|
|
||
|
|
|
#3 |
|
Member
Join Date: Dec 2023
Posts: 51
Rep Power: 4 ![]() |
||
|
|
|
|
|
|
|
#4 |
|
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 18,018
Rep Power: 146 ![]() ![]() ![]() ![]() |
Have you had a look at the workbench parameterisation stuff and the operating point stuff in CFX? These are already built in and may do what you want.
Are you looking to do a series of simulations and then the python analyses it as post processing, or does the python generate new simulation conditions based on the previous set of simulation results?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
|
|
|
|
|
|
|
#5 | |
|
Member
Join Date: Dec 2023
Posts: 51
Rep Power: 4 ![]() |
Quote:
I've seen and used parametrization in workbench but very deeply.Python generates new simulation conditions but they are not based on previous results. Actually new conditions are set based on sampling method (called Sobol sampling) in Python then these conditions are used in the simulations then results go to a Python code for statistical post processing. |
||
|
|
|
||
|
|
|
#6 |
|
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 18,018
Rep Power: 146 ![]() ![]() ![]() ![]() |
If you are generating a long list of simulations, then running them then post processing them - this is easy.
The way I would do it in your circumstance is to make a master CFX run, generate a def file and extract the CCL file from that. Then get your python to read in the CCL and generate lots of CCL files, one CCL for each simulation. Get the python to also generate a batch file to write the CCL into the def file and run them all using the command line (cfx5cmds -write -def Master.def -text Run123.ccl; cfx5solve -def Master.def repeated for each run). Then you can post process at your liesure.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
|
|
|
|
|
|
|
#7 | |
|
Member
Join Date: Dec 2023
Posts: 51
Rep Power: 4 ![]() |
Quote:
Thank you. I will try that. |
||
|
|
|
||
|
|
|
#8 |
|
Member
Join Date: Dec 2023
Posts: 51
Rep Power: 4 ![]() |
Hello again,
There is another question, what if I want to change the geometry too. I mean beside of boundary condition changes I want to use python to sample some new angles that I want to apply on my geometry and the mesh. Can I change the mesh file using .ccl? (I couldn't find the mesh location(address) in .ccl file. It seems that mesh is included in .def file). Do you think that I can do meshing with design modeler and turbogrid separately and then use .ccl file to call these meshes for each simulation? |
|
|
|
|
|
|
|
|
#9 |
|
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 18,018
Rep Power: 146 ![]() ![]() ![]() ![]() |
The mesh is input into the simulation in CFX-Pre. So it you want to change the mesh you will need to run CFX-Pre from the command line. Alternately, if you want to dynamically change your mesh you will need to control your meshing program from the command line this depends on what meshing software you use.
But this all starts getting difficult, so I would consider moving into Workbench where this can all be done in a few simulations blocks and maybe a parametric block. While I am no fan of Workbench, it does do this sort of stuff really well. Workbench is by far the easiest way to do it.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
|
|
|
|
![]() |
| Tags |
| cfx, coupling, python |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ansys CFX Possibly using the wrong fluid | AmreD | CFX | 4 | May 5, 2023 13:27 |
| Regestry Exception when running batch commands of CFX simulations | Eman Eal | CFX | 1 | October 20, 2022 18:36 |
| Ansys CFX’s Future | butterflymuzzy | CFX | 23 | June 24, 2022 08:29 |
| Python compatibility with CFx | jmex | CFX | 4 | January 2, 2020 05:56 |
| Optimization study with ANSYS CFX (FLUENT) and MATLAB | rusham | ANSYS | 0 | January 25, 2018 05:54 |