Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

trying to automate boundary conditions using pyfluent and setup simulation

    • Christopher Mifflin
      Subscriber

      Version: Fluent 2022R2

      I have a simualtion setup already.  Using pyFluent, I'm able to read it in, and run the simulation without changing the boundary conditions.  However, when I try to change the boundary conditions, it throws a CAR error and haults the scrip execution.

      This is the command that ends up aborting execution: 

      solver.setup.boundary_conditions.pressure_far_field['cv_inlet'](m = 3.0, t = 230)

      Here is the output:

      Traceback (most recent call last):
        File "c:/pyFluent/Work/fluenttest.py", line 8, in
        File "C:\ProgramData\Anaconda2021_05\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 405, in __call__
          self.set_state(kwargs)
        File "C:\ProgramData\Anaconda2021_05\lib\site-packages\ansys\fluent\core\solver\flobject.py", line 262, in set_state
          return self.flproxy.set_var(self.path, self.to_scheme_keys(state))
        File "C:\ProgramData\Anaconda2021_05\lib\site-packages\ansys\fluent\core\services\settings.py", line 102, in _fn
          return fn(self, *args, **kwds)
        File "C:\ProgramData\Anaconda2021_05\lib\site-packages\ansys\fluent\core\services\settings.py", line 168, in set_var
          self._service_impl.set_var(request)
        File "C:\ProgramData\Anaconda2021_05\lib\site-packages\ansys\fluent\core\services\error_handler.py", line 15, in func
          raise RuntimeError(ex.details()) from None
      RuntimeError: CAR: invalid argument [1]: wrong type [not a pair]
      Error Object: 3

      This command does execute:

      print(solver.setup.boundary_conditions.pressure_far_field())
      output:
      {'cv_inlet': {'p': {'option': 'constant or expression', 'constant': 0}, 'm': {'option': 'constant or expression', 'constant': 2.5}, 't': {'option': 'constant or expression', 'constant': 300}, 'coordinate_system': 'Cartesian (X, Y, Z)', 'ni': {'option': 'constant or expression', 'constant': 0.9063077869999999}, 'nj': {'option': 'constant or expression', 'constant': 0.4226182620000001}, 'nk': {'option': 'constant or expression', 'constant': 0}, 'flow_direction_component': [{'option': 'constant or expression', 'constant': 0.9063077869999999}, {'option': 'constant or expression', 'constant': 0.4226182620000001}, {'option': 'constant or expression', 'constant': 0}], 'ke_spec': 'Intensity and Viscosity Ratio', 'turb_intensity': 0.05, 'turb_viscosity_ratio': 10},  'cv_exit': {'p': {'option': 'constant or expression', 'constant': 0}, 'm': {'option': 'constant or expression', 'constant': 2.5}, 't': {'option': 'constant or expression', 'constant': 300}, 'coordinate_system': 'Cartesian (X, Y, Z)', 'ni': {'option': 'constant or expression', 'constant': 0.9063077869999999}, 'nj': {'option': 'constant or expression', 'constant': 0.4226182620000001}, 'nk': {'option': 'constant or expression', 'constant': 0}, 'flow_direction_component': [{'option': 'constant or expression', 'constant': 0.9063077869999999}, {'option': 'constant or expression', 'constant': 0.4226182620000001}, {'option': 'constant or expression', 'constant': 0}], 'ke_spec': 'Intensity and Viscosity Ratio', 'turb_intensity': 0.05, 'turb_viscosity_ratio': 10}}
       
      I'm perplexed as I've seen a very similar command in a pyfluent training video:
      solver.setup.boundary_conditions.velocity_inlet['velocity_inlet_1'](vmag = 1, t = 300).
       
      I realize I'm solving a sim with different boundary condition types, but the syntax should be similar.  Anyone know what's going on?
    • Supreetha J
      Forum Moderator

      Hello, 

      PyAnsys project is developed and supported through GitHub. You can post issues and request new features 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.

    • Rob
      Forum Moderator

      Pressure farfield also needs the gas density to be ideal gas, did you set that first? 

Viewing 2 reply threads
  • The topic ‘trying to automate boundary conditions using pyfluent and setup simulation’ is closed to new replies.