Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

Extract the vector field of the fluid domain

    • Antoine ROLAND
      Subscriber

      Hi,

      I'm having trouble doing something pretty basic... I want to extract the vector field from a .dat.gz of the volume/fluid domain "surface".
      To be clear: I want the DataFrame with columns=[nodes_number, x, y, z, velocity_x, velocity_y, velocity_z]

      Here is a test code:

      import ansys.fluent.core as pyfluent
      from ansys.fluent.core import examples

      file = examples.download_file(
      filename="manifold_solution.cas.h5", directory="pyfluent/exhaust_manifold"
      )
      file_dat = examples.download_file(
      filename="manifold_solution.dat.h5", directory="pyfluent/exhaust_manifold"
      )

      solver = pyfluent.launch_fluent(precision='double', processor_count=1, mode="solver")
      solver.file.read(file_type="case-data", file_name=file)

      field_data = solver.field_data
      vector_field = field_data.get_vector_field_data(field_name="velocity", surface_name="fluid1")
      print(vector_field)
       
       
       
      And here is the traceback:
       
      C:\Users\ARD\anaconda3\Lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
      "class": algorithms.Blowfish,
      Checking if specified file already exists...
      File already exists. File path:
      C:\Users\ARD\AppData\Local\Ansys\ansys_fluent_core\examples\manifold_solution.cas.h5
      Checking if specified file already exists...
      File already exists. File path:
      C:\Users\ARD\AppData\Local\Ansys\ansys_fluent_core\examples\manifold_solution.dat.h5
      Fast-loading "C:\PROGRA~1\ANSYSI~1\v231\fluent\fluent23.1.0\\addons\afd\lib\hdfio.bin"
      Done.
      Note: Rank = 0: Process affinity not being set (6).

      Reading from SYC-29:"C:\Users\ARD\AppData\Local\Ansys\ansys_fluent_core\examples\manifold_solution.cas.h5" in NODE0 mode ...
      Reading mesh ...
      288590 cells, 2 cell zones ...
      201658 polyhedra cells, zone id: 815
      86932 polyhedra cells, zone id: 818
      1795387 faces, 13 face zones ...
      454038 polygonal interior faces, zone id: 817
      1258889 polygonal interior faces, zone id: 814
      275 polygonal pressure-outlet faces, zone id: 559
      261 polygonal velocity-inlet faces, zone id: 463
      265 polygonal velocity-inlet faces, zone id: 367
      262 polygonal velocity-inlet faces, zone id: 272
      51846 polygonal wall faces, zone id: 226
      13399 polygonal wall faces, zone id: 830
      13399 polygonal wall faces, zone id: 2
      724 polygonal wall faces, zone id: 181
      676 polygonal wall faces, zone id: 180
      678 polygonal wall faces, zone id: 179
      675 polygonal wall faces, zone id: 178
      1408040 nodes, 1 node zone ...
      Warning: reading 4 partition grid onto 1 compute node machine.
      Combining every 4 partitions.
      Done.


      Building...
      mesh
      materials,
      interface,
      domains,
      mixture
      zones,
      solid_up:1:830-shadow
      interior--fluid1
      interior--solid_up
      outlet
      inlet2
      inlet1
      inlet
      solid_up:1
      solid_up:1:830
      out1
      in3
      in2
      in1
      fluid1
      solid_up
      parallel,
      Done.

      Reading from SYC-29:"C:\Users\ARD\AppData\Local\Ansys\ansys_fluent_core\examples\manifold_solution.dat.h5" in NODE0 mode ...


      Reading results.
      Parallel variables...
      Done.
      Traceback (most recent call last):
      File "D:\python\stansys\example_stack_overflow.py", line 15, in
      vector_field = field_data.get_vector_field_data(field_name="velocity", surface_name="fluid1")
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\ARD\anaconda3\Lib\site-packages\ansys\fluent\core\services\field_data.py", line 359, in __call__
      return self._field_data_accessor(*args, **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\ARD\anaconda3\Lib\site-packages\ansys\fluent\core\services\field_data.py", line 1336, in get_vector_field_data
      surface_ids = _get_surface_ids(
      ^^^^^^^^^^^^^^^^^
      File "C:\Users\ARD\anaconda3\Lib\site-packages\ansys\fluent\core\services\field_data.py", line 730, in _get_surface_ids
      allowed_surface_names.valid_name(surface_name)
      File "C:\Users\ARD\anaconda3\Lib\site-packages\ansys\fluent\core\services\field_data.py", line 293, in valid_name
      raise SurfaceNameError(
      ansys.fluent.core.services.field_data.SurfaceNameError: fluid1 is not an allowed surface name.
      The most similar names are: solid_up:1.
    • Supreetha J
      Subscriber

      Hello,

      PyAnsys project is developed and supported through GitHub. You can post issues and request new featured on the the Issues page for each package, or contact PyAnsys support. For more details, please refer to PyAnsys GitHub page: https://github.com/pyansys

      Thank you.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.