


{"id":327241,"date":"2023-12-10T21:56:59","date_gmt":"2023-12-10T21:56:59","guid":{"rendered":"\/forum\/forums\/topic\/trying-to-automate-boundary-conditions-using-pyfluent-and-setup-simulation\/"},"modified":"2023-12-10T21:56:59","modified_gmt":"2023-12-10T21:56:59","slug":"trying-to-automate-boundary-conditions-using-pyfluent-and-setup-simulation","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/trying-to-automate-boundary-conditions-using-pyfluent-and-setup-simulation\/","title":{"rendered":"trying to automate boundary conditions using pyfluent and setup simulation"},"content":{"rendered":"<p>Version: Fluent 2022R2<\/p>\n<p>I have a simualtion setup already.&nbsp; Using pyFluent, I&#8217;m able to read it in, and run the simulation without changing the boundary conditions.&nbsp; However, when I try to change the boundary conditions, it throws a CAR error and haults the scrip execution.<\/p>\n<p>This is the command that ends up aborting execution:&nbsp;<\/p>\n<div>\n<div style=\"padding-left: 40px\"><em>solver.setup.boundary_conditions.pressure_far_field[&#8216;cv_inlet&#8217;](m = 3.0, t = 230)<\/em><\/div>\n<\/div>\n<p>Here is the output:<\/p>\n<p style=\"padding-left: 40px\"><em>Traceback (most recent call last):<\/em><br \/><em>&nbsp; File &#8220;c:\/pyFluent\/Work\/fluenttest.py&#8221;, line 8, in &lt;module&gt;<\/em><br \/><em>&nbsp; File &#8220;C:\\ProgramData\\Anaconda2021_05\\lib\\site-packages\\ansys\\fluent\\core\\solver\\flobject.py&#8221;, line 405, in __call__<\/em><br \/><em>&nbsp; &nbsp; self.set_state(kwargs)<\/em><br \/><em>&nbsp; File &#8220;C:\\ProgramData\\Anaconda2021_05\\lib\\site-packages\\ansys\\fluent\\core\\solver\\flobject.py&#8221;, line 262, in set_state<\/em><br \/><em>&nbsp; &nbsp; return self.flproxy.set_var(self.path, self.to_scheme_keys(state))<\/em><br \/><em>&nbsp; File &#8220;C:\\ProgramData\\Anaconda2021_05\\lib\\site-packages\\ansys\\fluent\\core\\services\\settings.py&#8221;, line 102, in _fn<\/em><br \/><em>&nbsp; &nbsp; return fn(self, *args, **kwds)<\/em><br \/><em>&nbsp; File &#8220;C:\\ProgramData\\Anaconda2021_05\\lib\\site-packages\\ansys\\fluent\\core\\services\\settings.py&#8221;, line 168, in set_var<\/em><br \/><em>&nbsp; &nbsp; self._service_impl.set_var(request)<\/em><br \/><em>&nbsp; File &#8220;C:\\ProgramData\\Anaconda2021_05\\lib\\site-packages\\ansys\\fluent\\core\\services\\error_handler.py&#8221;, line 15, in func<\/em><br \/><em>&nbsp; &nbsp; raise RuntimeError(ex.details()) from None<\/em><br \/><em>RuntimeError: CAR: invalid argument [1]: wrong type [not a pair]<\/em><br \/><em>Error Object: 3<\/em><\/p>\n<p><em>This command does execute:<\/em><\/p>\n<div>\n<div style=\"padding-left: 40px\"><em>print(solver.setup.boundary_conditions.pressure_far_field())<\/em><\/div>\n<div>output:<\/div>\n<div>\n<div style=\"padding-left: 40px\"><em>{&#8216;cv_inlet&#8217;: {&#8216;p&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0}, &#8216;m&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 2.5}, &#8216;t&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 300}, &#8216;coordinate_system&#8217;: &#8216;Cartesian (X, Y, Z)&#8217;, &#8216;ni&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.9063077869999999}, &#8216;nj&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.4226182620000001}, &#8216;nk&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0}, &#8216;flow_direction_component&#8217;: [{&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.9063077869999999}, {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.4226182620000001}, {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0}], &#8216;ke_spec&#8217;: &#8216;Intensity and Viscosity Ratio&#8217;, &#8216;turb_intensity&#8217;: 0.05, &#8216;turb_viscosity_ratio&#8217;: 10},&nbsp; &#8216;cv_exit&#8217;: {&#8216;p&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0}, &#8216;m&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 2.5}, &#8216;t&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 300}, &#8216;coordinate_system&#8217;: &#8216;Cartesian (X, Y, Z)&#8217;, &#8216;ni&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.9063077869999999}, &#8216;nj&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.4226182620000001}, &#8216;nk&#8217;: {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0}, &#8216;flow_direction_component&#8217;: [{&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.9063077869999999}, {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0.4226182620000001}, {&#8216;option&#8217;: &#8216;constant or expression&#8217;, &#8216;constant&#8217;: 0}], &#8216;ke_spec&#8217;: &#8216;Intensity and Viscosity Ratio&#8217;, &#8216;turb_intensity&#8217;: 0.05, &#8216;turb_viscosity_ratio&#8217;: 10}}<\/em><\/div>\n<div>&nbsp;<\/div>\n<div>I&#8217;m perplexed as I&#8217;ve seen a very similar command in a pyfluent training video:<\/div>\n<div style=\"padding-left: 40px\"><a href=\"https:\/\/youtu.be\/5nt8A7b3Wlk?t=495\">https:\/\/youtu.be\/5nt8A7b3Wlk?t=495<\/a><\/div>\n<div style=\"padding-left: 40px\">solver.setup.boundary_conditions.velocity_inlet[&#8216;velocity_inlet_1&#8217;](vmag = 1, t = 300).<\/div>\n<div>&nbsp;<\/div>\n<div>I realize I&#8217;m solving a sim with different boundary condition types, but the syntax should be similar.&nbsp; Anyone know what&#8217;s going on?<\/div>\n<\/div>\n<\/div>\n","protected":false},"template":"","class_list":["post-327241","topic","type-topic","status-closed","hentry","topic-tag-fluent-cfd-ansys-1","topic-tag-fluent","topic-tag-python","topic-tag-python-scripting"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["49725","2404","199"],"_bbp_author_ip":["23.206.193.146"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1357"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["327241"],"_bbp_forum_id":["27792"],"_bbp_engagement":["199","2404","49725"],"_bbp_voice_count":["3"],"_bbp_reply_count":["2"],"_bbp_last_reply_id":["338202"],"_bbp_last_active_id":["338202"],"_bbp_last_active_time":["2023-12-12 13:29:27"]},"test":"christopher-mifflinngc-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/327241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/327241\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=327241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}