CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FloEFD, FloWorks & FloTHERM (https://www.cfd-online.com/Forums/floefd-floworks-flotherm/)
-   -   FloEFD API from Python script. Set2DTableData problem. (https://www.cfd-online.com/Forums/floefd-floworks-flotherm/199440-floefd-api-python-script-set2dtabledata-problem.html)

dmitry.grigoryev March 6, 2018 08:00

FloEFD API from Python script. Set2DTableData problem.
 
Hello,

A try to set up boundary conditions in FloEFD project from python script and I have a problem with setting up the data for Table dependency parameter. I call the FloEFD API function like this(for example, arrays of length 1):
Code:

error = param.Set2DTableData([0.015], [2.0])
After I call the API getter function:
Code:

_, valueX, valueF = param.Get2DTableData()
Received output:
Code:

valueX  = (2.5e-323,)
valueF = (2.5e-323,)

I don't have any idea about this behavior. :confused: Thanks for any tip

Boris_M March 28, 2018 08:51

Hi Dmitry,

The API is meant for VBA, VB, and VC++.
I cannot tell if there is any compatibility with Python and wouldn't trust it delivering correct values. Have you tried it in the supported languages in a simple example to see what the feedback there is?

Regards,
Boris

dmitry.grigoryev May 4, 2018 09:41

Quote:

Originally Posted by dmitry.grigoryev (Post 684001)
Hello,

A try to set up boundary conditions in FloEFD project from python script and I have a problem with setting up the data for Table dependency parameter. I call the FloEFD API function like this(for example, arrays of length 1):
Code:

error = param.Set2DTableData([0.015], [2.0])
After I call the API getter function:
Code:

_, valueX, valueF = param.Get2DTableData()
Received output:
Code:

valueX  = (2.5e-323,)
valueF = (2.5e-323,)

I don't have any idea about this behavior. :confused: Thanks for any tip

I had solved this problem by explicit casting input data for Set2dTableData to VT_ARRAY object(FloEFD documentation says the input data type is VARIANT).

Python example:
Code:

win32com.client.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8, value)

Boris, thanks for your advice, it was really helpful for me.


All times are GMT -4. The time now is 23:55.