@@ -176,42 +176,25 @@ of minimal server images, which becomes significant in the context of containeri
176176Context manager for active sessions
177177-----------------------------------
178178
179- The ``using(session) `` context manager sets an active session so API calls inside the block are directed to that session, allowing you to work
179+ The ``using(session) `` context manager sets an active session so you can call top-level settings objects and functions
180180without explicitly passing the session each time.
181181
182182Example:
183183
184184.. code :: python
185185
186186 >> > from ansys.fluent.core import using
187- >> > from ansys.fluent.core.solver import Viscous
187+ >> > from ansys.fluent.core.solver import ReadCase, Viscous
188188 >> > with using(solver_session):
189+ ... ReadCase()(file_name = < case_file> )
189190 ... print (Viscous().model())
190191 k- omega
191192
192193 .. note ::
193194
194- You can import ``using `` from ``ansys.fluent.core ``. In older versions, it was exposed only under
195- ``ansys.fluent.core.solver ``.
196-
197-
198- Solver context manager
199- ~~~~~~~~~~~~~~~~~~~~~~
200-
201- Use ``using(solver_session) `` to make a solver session the active session inside a ``with `` block:
202-
203- .. code :: python
195+ Settings trees are inactive outside an active session. Set or query state inside ``with using(session) `` or
196+ pass the session explicitly via ``settings_source=... `` on the object.
204197
205- >> > import ansys.fluent.core as pyfluent
206- >> > from ansys.fluent.core.examples import download_file
207- >> > from ansys.fluent.core import using
208- >> > from ansys.fluent.core.solver import ReadCase, Viscous
209- >> > solver_session = pyfluent.launch_fluent()
210- >> > case_file = download_file(" mixing_elbow.cas.h5" , " pyfluent/mixing_elbow" )
211- >> > with using(solver_session):
212- ... ReadCase()(file_name = case_file)
213- ... print (Viscous().model())
214- k- omega
215198
216199Multiple sessions in one script
217200~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -221,14 +204,21 @@ within its intended scope:
221204
222205.. code :: python
223206
207+ >> > import ansys.fluent.core as pyfluent
208+ >> > from ansys.fluent.core.examples import download_file
209+ >> > from ansys.fluent.core import using
210+ >> > from ansys.fluent.core.solver import ReadCase, Viscous
224211 >> > solver_session_1 = pyfluent.launch_fluent()
225212 >> > solver_session_2 = pyfluent.launch_fluent()
226- >> > from ansys.fluent.core import using
227- >> > from ansys.fluent.core.solver import Viscous
213+ >> > case_file = download_file(" mixing_elbow.cas.h5" , " pyfluent/mixing_elbow" )
228214 >> > with using(solver_session_1):
215+ ... ReadCase()(file_name = case_file)
216+ ... Viscous().model.set_state(" laminar" )
229217 ... print (Viscous().model())
230- k - omega
218+ laminar
231219 >> > with using(solver_session_2):
220+ ... ReadCase()(file_name = case_file)
221+ ... Viscous().model.set_state(" k-omega" )
232222 ... print (Viscous().model())
233223 k- omega
234224
0 commit comments