Fluid swirl#

This example illustrates a one-way data transfer from a SCDT file to Fluent, using System Coupling. Fluent solves a simple steady fluid flow problem, where the flow is affected by the momentum sources defined in the SCDT file.

Problem description

Fluid flow problem consists of the water flowing through the pipe.

../../_images/fluid_swirl_setup.png

The SCDT file will be generated that consists of a cloud of points overlapping the fluid domain. At each point, the force density value is defined, with force acting along the flow cross-section, always in a counter-clockwise direction (if looking from the inlet to the outlet).

System Coupling is used to map the data from the cloud of points defined in the SCDT file onto Fluent mesh. The force values are then transferred into Fluent and Fluent solves the resulting fluid flow problem, where the fluid is influenced by the provided forces. As a result, the swirl is induced in the fluid flow.

# Tags: SCDT, Fluent, steady

Import modules, download files, launch products#

Setting up this example consists of performing imports, downloading the input file, and launching the required products.

Perform required imports#

Import the ansys-systemcoupling-core package and other required packages.

import math

import ansys.fluent.core as pyfluent

import ansys.systemcoupling.core as pysystemcoupling
from ansys.systemcoupling.core import examples

Download input files#

Download the case file for Fluent and the FMU file.

fluent_cas_file = examples.download_file(
    "water_pipe_flow.cas.h5", "pysystem-coupling/fluid-swirl"
)

Launch products#

Launch a remote Fluent and System Coupling instances and return client objects that allows you to interact with these products via an API exposed into the current Python environment.

Note

Fluent version greater than 24.1 is required. To specify Fluent version explicitly when launching Fluent, use product_version argument to the launch_fluent function, for example pyfluent.launch_fluent(product_version="24.2.0")

fluent = pyfluent.launch_fluent(start_transcript=True, processor_count=4)
syc = pysystemcoupling.launch(start_output=False)
pyfluent.launcher WARNING: Starting Fluent container mounted to /home/runner/work/pysystem-coupling/pysystem-coupling/examples/00-systemcoupling, with this path available as /mnt/pyfluent for the Fluent session running inside the container.

Setup#

The setup consists of setting up the the fluids analysis, generating the SCDT file, and setting up the coupled analysis.

Set up the fluid analysis#

Read the pre-created case file.

fluent.file.read(file_type="case", file_name=fluent_cas_file)
Fast-loading "/ansys_inc/v242/fluent/fluent24.2.0/addons/afd/lib/hdfio.bin"
Done.

Reading from 74ab5ab119a0:"/mnt/pyfluent/water_pipe_flow.cas.h5" in NODE0 mode ...
  Reading mesh ...
       48575 cells,     1 cell zone  ...
          48575 mixed cells,  zone id: 2
      116126 faces,     4 face zones ...
         109564 mixed interior faces,  zone id: 1
           6278 triangular wall faces,  zone id: 5
            142 mixed velocity-inlet faces,  zone id: 6
            142 mixed pressure-outlet faces,  zone id: 7
       20404 nodes,     1 node zone  ...
  Done.


Building...
     mesh
        distributing mesh
                parts....,
                faces....,
                nodes....,
                cells....,
        bandwidth reduction using Reverse Cuthill-McKee: 5885/214 = 27.5
     materials,
     interface,
     domains,
        mixture
     zones,
        out
        wall
        interior-tube_solid
        in
        tube_solid
     parallel,
Done.

Generate the SCDT file#

The following script generates a simple comma-separated file with points defined along the fluid domain. Six columns of data will be written: x, y, z coordinate values, followed by x-, y-, and z-components of the force density field. The number of points can be adjusted by naxial, ncirc, and nrad parameter values. The magnitude of the force (defined in N/m^3) can be adjusted by force_mag parameter value.

def create_source_file(file_name):
    force_mag = 5.0
    naxial = 33
    ncirc = 10
    nrad = 20
    radius = 0.025
    with open(file_name, "w") as f:
        for xi in range(naxial):
            x = (1.0 - 0.0) * xi / (naxial - 1)
            for ti in range(ncirc):
                theta = 2.0 * math.pi * ti / ncirc
                for ri in range(nrad):
                    r = radius * (ri + 1) / nrad
                    z = r * math.cos(theta)
                    y = r * math.sin(theta)
                    fx = 0.0
                    fy = force_mag * math.sin(theta + 0.5 * math.pi)
                    fz = force_mag * math.cos(theta + 0.5 * math.pi)
                    f.write(f"{x}, {y}, {z}, {fx}, {fy}, {fz}\n")


src_file_base_name = "source"
src_file_name = f"{src_file_base_name}.scdt"
create_source_file(src_file_name)
../../_images/fluid_swirl_point_cloud.png

Set up the coupled analysis#

System Coupling setup involves adding the SCDT file and Fluent solver session as participants, adding coupled interfaces and data transfers, and setting other coupled analysis properties.

Add participants

source_name = syc.setup.add_participant(input_file=src_file_name)
fluid_name = syc.setup.add_participant(participant_session=fluent)
Writing System Coupling file...done.
Writing System Coupling file...done.
Writing System Coupling file...done.
Writing System Coupling file...done.

Add a coupling interface and data transfers#

# Add a coupling interface for SCDT file -> Fluent
interface_name = syc.setup.add_interface(
    side_one_participant=source_name,
    side_one_regions=[src_file_base_name],
    side_two_participant=fluid_name,
    side_two_regions=["tube_solid"],
)

# Add force data transfer.
# Use System Coupling expression to combine force field
# components in the SCDT file into a vector.
# System Coupling will automatically convert force density
# values on the source (defined in [N/m^3]) to force
# values on the target (defined in [N]).
syc.setup.add_data_transfer(
    interface=interface_name,
    target_side="Two",
    target_variable="lorentz-force",
    value="vector(Variable1 * 1.0 [N], Variable2 * 1.0 [N], Variable3 * 1.0 [N])",
)
'lorentz-force'

Solution#

syc.solution.solve()
Successfully connected to System Coupling

Initialize using the hybrid initialization method.

Checking case topology...
-This case has both inlets & outlets
-Pressure information is not available at the boundaries.
 Case will be initialized with constant pressure

        iter            scalar-0

        1               1.000000e+00
        2               3.723864e-04
        3               5.018576e-05
        4               1.453430e-05
        5               6.488364e-05
        6               9.772111e-06
        7               1.458092e-05
        8               3.472076e-06
        9               3.392149e-05
        10              4.737182e-06

Hybrid initialization is done.
during Hybrid Initialization.

NOTE: System Coupling analysis settings will override Fluent calculation settings

Total loss on zone     2 is   0.00e+00 (watt)

 Force Sumx on zone     2 is   0.00e+00 (newton)

 Force Sumy on zone     2 is  -1.48e-06 (newton)

 Force Sumz on zone     2 is  -1.75e-06 (newton)

COUPLING STEP = 1        COUPLING ITERATION = 1

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
     1  1.0000e+00  1.3645e-03  4.2042e-03  4.2272e-03  0.0000e+00  4.5148e-01  9.9564e-01  0:00:37  199
     2  3.6812e-01  1.4453e-03  2.3085e-03  2.3193e-03  0.0000e+00  1.0856e-01  1.0634e-01  0:00:37  198
     3  1.8783e-01  1.3478e-03  1.2155e-03  1.2196e-03  0.0000e+00  7.8868e-02  6.5653e-02  0:00:37  197
     4  1.8656e-01  1.1984e-03  6.6180e-04  6.6327e-04  0.0000e+00  6.0212e-02  3.2849e-02  0:00:35  196
     5  1.5569e-01  1.0748e-03  3.8708e-04  3.8782e-04  0.0000e+00  5.1280e-02  9.7848e-03  0:00:34  195
     6  1.2568e-01  9.6181e-04  2.5800e-04  2.5844e-04  1.5425e-16  4.5346e-02  7.6360e-03  0:00:33  194
     7  1.0081e-01  8.5220e-04  2.0943e-04  2.0905e-04  1.5477e-16  3.9171e-02  1.1702e-02  0:00:32  193
     8  8.0872e-02  7.4896e-04  1.8474e-04  1.8362e-04  1.5369e-16  3.3552e-02  1.2683e-02  0:00:32  192
     9  6.5168e-02  6.5029e-04  1.6210e-04  1.6113e-04  1.5495e-16  2.9018e-02  1.2014e-02  0:00:31  191
    10  5.2688e-02  5.5486e-04  1.4818e-04  1.4764e-04  1.5355e-16  2.5004e-02  1.0820e-02  0:00:31  190
    11  4.3116e-02  4.7082e-04  1.3967e-04  1.3946e-04  1.5396e-16  2.1133e-02  9.3823e-03  0:00:31  189

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    12  3.5549e-02  3.9574e-04  1.3350e-04  1.3368e-04  1.5567e-16  1.8340e-02  7.8650e-03  0:00:32  188
    13  3.0829e-02  3.2528e-04  1.2906e-04  1.2946e-04  1.5342e-16  1.6008e-02  6.4786e-03  0:00:32  187
    14  3.0432e-02  2.7462e-04  1.2493e-04  1.2544e-04  1.5352e-16  1.3905e-02  5.3487e-03  0:00:32  186
    15  3.0185e-02  2.4151e-04  1.2036e-04  1.2093e-04  1.5401e-16  1.2100e-02  4.4130e-03  0:00:31  185
    16  2.9520e-02  2.1700e-04  1.1567e-04  1.1620e-04  1.5388e-16  1.0581e-02  3.8224e-03  0:00:31  184
    17  2.8754e-02  2.0088e-04  1.1131e-04  1.1183e-04  1.5203e-16  9.2964e-03  3.5478e-03  0:00:30  183
    18  2.7880e-02  1.9005e-04  1.0722e-04  1.0778e-04  1.5330e-16  8.2019e-03  3.3755e-03  0:00:30  182
    19  2.6760e-02  1.8270e-04  1.0333e-04  1.0388e-04  1.5152e-16  7.3075e-03  3.1932e-03  0:00:30  181
    20  2.5502e-02  1.7699e-04  9.9673e-05  1.0017e-04  1.5214e-16  6.5801e-03  2.9966e-03  0:00:30  180
    21  2.4201e-02  1.7212e-04  9.6105e-05  9.6503e-05  1.5182e-16  5.9652e-03  2.7870e-03  0:00:29  179
    22  2.2862e-02  1.6739e-04  9.2543e-05  9.2865e-05  1.5340e-16  5.4327e-03  2.5752e-03  0:00:29  178

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    23  2.1558e-02  1.6246e-04  8.9001e-05  8.9222e-05  1.4968e-16  4.9723e-03  2.3883e-03  0:00:29  177
    24  2.0316e-02  1.5749e-04  8.5494e-05  8.5641e-05  1.5160e-16  4.5749e-03  2.2428e-03  0:00:29  176
    25  1.9096e-02  1.5257e-04  8.2052e-05  8.2148e-05  1.5437e-16  4.2359e-03  2.1123e-03  0:00:28  175
    26  1.7904e-02  1.4797e-04  7.8671e-05  7.8785e-05  1.4938e-16  3.9458e-03  1.9778e-03  0:00:28  174
    27  1.6775e-02  1.4361e-04  7.5351e-05  7.5473e-05  1.5105e-16  3.6947e-03  1.8370e-03  0:00:28  173
    28  1.5705e-02  1.3919e-04  7.2084e-05  7.2215e-05  1.5160e-16  3.4876e-03  1.6996e-03  0:00:28  172
    29  1.4767e-02  1.3482e-04  6.8881e-05  6.9017e-05  1.5302e-16  3.3349e-03  1.5636e-03  0:00:28  171
    30  1.3910e-02  1.3027e-04  6.5735e-05  6.5888e-05  1.5182e-16  3.2136e-03  1.4355e-03  0:00:27  170
    31  1.3170e-02  1.2585e-04  6.2668e-05  6.2811e-05  1.5008e-16  3.1045e-03  1.3169e-03  0:00:27  169
    32  1.2513e-02  1.2157e-04  5.9678e-05  5.9805e-05  1.5130e-16  2.9992e-03  1.2103e-03  0:00:27  168
    33  1.1927e-02  1.1739e-04  5.6766e-05  5.6877e-05  1.5114e-16  2.8949e-03  1.1160e-03  0:00:27  167

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    34  1.1398e-02  1.1328e-04  5.3949e-05  5.4033e-05  1.5151e-16  2.7915e-03  1.0329e-03  0:00:27  166
    35  1.0907e-02  1.0931e-04  5.1221e-05  5.1288e-05  1.5163e-16  2.6874e-03  9.6133e-04  0:00:27  165
    36  1.0446e-02  1.0540e-04  4.8589e-05  4.8641e-05  1.5117e-16  2.5823e-03  8.9967e-04  0:00:26  164
    37  1.0008e-02  1.0150e-04  4.6067e-05  4.6102e-05  1.5125e-16  2.4766e-03  8.4661e-04  0:00:26  163
    38  9.5892e-03  9.7686e-05  4.3645e-05  4.3670e-05  1.5156e-16  2.3700e-03  8.0045e-04  0:00:26  162
    39  9.1887e-03  9.3878e-05  4.1311e-05  4.1345e-05  1.5115e-16  2.2629e-03  7.5930e-04  0:00:36  161
    40  8.8073e-03  9.0105e-05  3.9085e-05  3.9113e-05  1.5156e-16  2.1552e-03  7.2186e-04  0:00:34  160
    41  8.4417e-03  8.6414e-05  3.6965e-05  3.6982e-05  1.5161e-16  2.0473e-03  6.8766e-04  0:00:32  159
    42  8.0863e-03  8.2797e-05  3.4935e-05  3.4937e-05  1.5164e-16  1.9393e-03  6.5684e-04  0:00:30  158
    43  7.7475e-03  7.9291e-05  3.2987e-05  3.2987e-05  1.5141e-16  1.8324e-03  6.2809e-04  0:00:29  157
    44  7.4154e-03  7.5901e-05  3.1123e-05  3.1120e-05  1.5033e-16  1.7276e-03  6.0107e-04  0:00:28  156

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    45  7.0907e-03  7.2650e-05  2.9348e-05  2.9344e-05  1.4893e-16  1.6244e-03  5.7629e-04  0:00:27  155
    46  6.7798e-03  6.9529e-05  2.7652e-05  2.7648e-05  1.4919e-16  1.5248e-03  5.5248e-04  0:00:27  154
    47  6.4715e-03  6.6531e-05  2.6044e-05  2.6033e-05  1.5129e-16  1.4288e-03  5.2990e-04  0:00:26  153
    48  6.1756e-03  6.3650e-05  2.4512e-05  2.4495e-05  1.5315e-16  1.3374e-03  5.0807e-04  0:00:26  152
    49  5.8917e-03  6.0915e-05  2.3063e-05  2.3031e-05  1.5230e-16  1.2509e-03  4.8678e-04  0:00:26  151
    50  5.6215e-03  5.8285e-05  2.1694e-05  2.1650e-05  1.5034e-16  1.1691e-03  4.6612e-04  0:00:25  150
    51  5.3602e-03  5.5754e-05  2.0393e-05  2.0350e-05  1.5040e-16  1.0926e-03  4.4604e-04  0:00:25  149
    52  5.1120e-03  5.3351e-05  1.9161e-05  1.9127e-05  1.5189e-16  1.0207e-03  4.2640e-04  0:00:25  148
    53  4.8782e-03  5.1057e-05  1.7992e-05  1.7965e-05  1.5138e-16  9.5387e-04  4.0741e-04  0:00:24  147
    54  4.6560e-03  4.8857e-05  1.6892e-05  1.6874e-05  1.5295e-16  8.9192e-04  3.8895e-04  0:00:24  146
    55  4.4457e-03  4.6804e-05  1.5864e-05  1.5856e-05  1.5216e-16  8.3435e-04  3.7155e-04  0:00:24  145

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    56  4.2465e-03  4.4823e-05  1.4909e-05  1.4915e-05  1.5265e-16  7.8157e-04  3.5497e-04  0:00:24  144
    57  4.0625e-03  4.2932e-05  1.4029e-05  1.4044e-05  1.5174e-16  7.3295e-04  3.3921e-04  0:00:23  143
    58  3.8866e-03  4.1138e-05  1.3216e-05  1.3239e-05  1.5237e-16  6.8780e-04  3.2452e-04  0:00:23  142
    59  3.7204e-03  3.9443e-05  1.2465e-05  1.2500e-05  1.5231e-16  6.4597e-04  3.1100e-04  0:00:22  141
    60  3.5655e-03  3.7801e-05  1.1773e-05  1.1820e-05  1.5166e-16  6.0739e-04  2.9860e-04  0:00:22  140
    61  3.4168e-03  3.6248e-05  1.1142e-05  1.1193e-05  1.5221e-16  5.7165e-04  2.8727e-04  0:00:22  139
    62  3.2774e-03  3.4799e-05  1.0566e-05  1.0619e-05  1.4966e-16  5.3882e-04  2.7702e-04  0:00:22  138
    63  3.1505e-03  3.3468e-05  1.0043e-05  1.0100e-05  1.5216e-16  5.0889e-04  2.6796e-04  0:00:22  137
    64  3.0338e-03  3.2258e-05  9.5732e-06  9.6468e-06  1.5257e-16  4.8167e-04  2.6002e-04  0:00:22  136
    65  2.9262e-03  3.1134e-05  9.1528e-06  9.2358e-06  1.5061e-16  4.5712e-04  2.5310e-04  0:00:21  135
    66  2.8293e-03  3.0082e-05  8.7773e-06  8.8676e-06  1.5150e-16  4.3475e-04  2.4692e-04  0:00:21  134

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    67  2.7400e-03  2.9134e-05  8.4391e-06  8.5394e-06  1.4947e-16  4.1429e-04  2.4150e-04  0:00:21  133
    68  2.6614e-03  2.8276e-05  8.1473e-06  8.2503e-06  1.5093e-16  3.9590e-04  2.3668e-04  0:00:21  132
    69  2.5951e-03  2.7517e-05  7.9034e-06  7.9962e-06  1.5130e-16  3.7971e-04  2.3245e-04  0:00:20  131
    70  2.5357e-03  2.6816e-05  7.6967e-06  7.7823e-06  1.5248e-16  3.6535e-04  2.2890e-04  0:00:20  130
    71  2.4867e-03  2.6211e-05  7.5247e-06  7.6105e-06  1.5276e-16  3.5326e-04  2.2613e-04  0:00:20  129
    72  2.4458e-03  2.5694e-05  7.3911e-06  7.4746e-06  1.4981e-16  3.4260e-04  2.2426e-04  0:00:20  128
    73  2.4149e-03  2.5256e-05  7.2795e-06  7.3755e-06  1.5118e-16  3.3263e-04  2.2314e-04  0:00:20  127
    74  2.3926e-03  2.4915e-05  7.2054e-06  7.3082e-06  1.4997e-16  3.2511e-04  2.2247e-04  0:00:19  126
    75  2.3767e-03  2.4663e-05  7.1842e-06  7.2761e-06  1.5157e-16  3.1945e-04  2.2238e-04  0:00:19  125
    76  2.3690e-03  2.4496e-05  7.1873e-06  7.2714e-06  1.5238e-16  3.1479e-04  2.2271e-04  0:00:19  124
    77  2.3646e-03  2.4361e-05  7.2175e-06  7.2921e-06  1.4982e-16  3.1084e-04  2.2338e-04  0:00:19  123

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    78  2.3638e-03  2.4288e-05  7.2682e-06  7.3262e-06  1.5179e-16  3.0779e-04  2.2446e-04  0:00:19  122
    79  2.3665e-03  2.4287e-05  7.3359e-06  7.3643e-06  1.5154e-16  3.0625e-04  2.2584e-04  0:00:19  121
    80  2.3759e-03  2.4325e-05  7.4169e-06  7.4174e-06  1.5128e-16  3.0580e-04  2.2733e-04  0:00:18  120
    81  2.3895e-03  2.4410e-05  7.5048e-06  7.4856e-06  1.5233e-16  3.0586e-04  2.2885e-04  0:00:18  119
    82  2.4017e-03  2.4505e-05  7.5993e-06  7.5544e-06  1.5160e-16  3.0632e-04  2.3020e-04  0:00:19  118
    83  2.4159e-03  2.4608e-05  7.7152e-06  7.6241e-06  1.5247e-16  3.0649e-04  2.3165e-04  0:00:18  117
    84  2.4330e-03  2.4716e-05  7.8359e-06  7.6934e-06  1.5218e-16  3.0753e-04  2.3320e-04  0:00:18  116
    85  2.4522e-03  2.4834e-05  7.9666e-06  7.7658e-06  1.5185e-16  3.0900e-04  2.3450e-04  0:00:18  115
    86  2.4627e-03  2.4955e-05  8.0934e-06  7.8224e-06  1.5092e-16  3.1036e-04  2.3573e-04  0:00:18  114
    87  2.4779e-03  2.5082e-05  8.2152e-06  7.8752e-06  1.5265e-16  3.1229e-04  2.3660e-04  0:00:18  113
    88  2.4956e-03  2.5208e-05  8.3177e-06  7.9283e-06  1.5105e-16  3.1405e-04  2.3720e-04  0:00:18  112

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
    89  2.5068e-03  2.5315e-05  8.4173e-06  7.9825e-06  1.5120e-16  3.1558e-04  2.3763e-04  0:00:18  111
    90  2.5233e-03  2.5423e-05  8.5108e-06  8.0317e-06  1.5311e-16  3.1679e-04  2.3792e-04  0:00:18  110
    91  2.5402e-03  2.5507e-05  8.5991e-06  8.0737e-06  1.5290e-16  3.1749e-04  2.3807e-04  0:00:17  109
    92  2.5453e-03  2.5560e-05  8.6635e-06  8.1093e-06  1.5319e-16  3.1842e-04  2.3814e-04  0:00:17  108
    93  2.5480e-03  2.5617e-05  8.7218e-06  8.1371e-06  1.5260e-16  3.1958e-04  2.3781e-04  0:00:17  107
    94  2.5601e-03  2.5634e-05  8.7673e-06  8.1436e-06  1.5299e-16  3.2037e-04  2.3739e-04  0:00:17  106
    95  2.5734e-03  2.5608e-05  8.8324e-06  8.1599e-06  1.5338e-16  3.2082e-04  2.3690e-04  0:00:17  105
    96  2.5802e-03  2.5552e-05  8.8802e-06  8.1765e-06  1.5251e-16  3.2079e-04  2.3635e-04  0:00:17  104
    97  2.5820e-03  2.5441e-05  8.8896e-06  8.1842e-06  1.5257e-16  3.1950e-04  2.3534e-04  0:00:16  103
    98  2.5785e-03  2.5311e-05  8.8766e-06  8.1775e-06  1.5360e-16  3.1802e-04  2.3394e-04  0:00:16  102
    99  2.5724e-03  2.5169e-05  8.8441e-06  8.1636e-06  1.5314e-16  3.1576e-04  2.3166e-04  0:00:16  101

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
   100  2.5661e-03  2.4999e-05  8.8022e-06  8.1195e-06  1.5507e-16  3.1393e-04  2.2963e-04  0:00:16  100
   101  2.5532e-03  2.4803e-05  8.7705e-06  8.0654e-06  1.5445e-16  3.1229e-04  2.2751e-04  0:00:16   99
   102  2.5399e-03  2.4565e-05  8.7100e-06  7.9887e-06  1.5264e-16  3.1048e-04  2.2559e-04  0:00:16   98
   103  2.5182e-03  2.4307e-05  8.6334e-06  7.8950e-06  1.5337e-16  3.0755e-04  2.2328e-04  0:00:16   97
   104  2.5015e-03  2.4025e-05  8.5507e-06  7.8238e-06  1.5119e-16  3.0340e-04  2.2051e-04  0:00:15   96
   105  2.4887e-03  2.3727e-05  8.4571e-06  7.7517e-06  1.5358e-16  2.9888e-04  2.1786e-04  0:00:15   95
   106  2.4619e-03  2.3444e-05  8.3610e-06  7.6569e-06  1.5309e-16  2.9384e-04  2.1521e-04  0:00:15   94
   107  2.4254e-03  2.3172e-05  8.2314e-06  7.5582e-06  1.5329e-16  2.8842e-04  2.1225e-04  0:00:15   93
   108  2.3875e-03  2.2882e-05  8.0743e-06  7.4360e-06  1.5329e-16  2.8221e-04  2.0914e-04  0:00:14   92
   109  2.3591e-03  2.2577e-05  7.9140e-06  7.3248e-06  1.5458e-16  2.7656e-04  2.0586e-04  0:00:14   91
   110  2.3288e-03  2.2231e-05  7.7550e-06  7.2288e-06  1.5506e-16  2.7103e-04  2.0301e-04  0:00:14   90

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
   111  2.3029e-03  2.1890e-05  7.6168e-06  7.1386e-06  1.5302e-16  2.6611e-04  2.0005e-04  0:00:14   89
   112  2.2719e-03  2.1555e-05  7.4786e-06  7.0494e-06  1.5188e-16  2.6073e-04  1.9670e-04  0:00:14   88
   113  2.2376e-03  2.1221e-05  7.3554e-06  6.9660e-06  1.5241e-16  2.5612e-04  1.9312e-04  0:00:14   87
   114  2.1938e-03  2.0857e-05  7.2668e-06  6.8581e-06  1.5064e-16  2.5159e-04  1.8956e-04  0:00:13   86
   115  2.1537e-03  2.0457e-05  7.1790e-06  6.7369e-06  1.5197e-16  2.4724e-04  1.8568e-04  0:00:13   85
   116  2.1134e-03  2.0034e-05  7.0515e-06  6.6052e-06  1.5300e-16  2.4255e-04  1.8166e-04  0:00:13   84
   117  2.0735e-03  1.9619e-05  6.8980e-06  6.4708e-06  1.5243e-16  2.3777e-04  1.7761e-04  0:00:13   83
   118  2.0342e-03  1.9198e-05  6.7520e-06  6.3362e-06  1.5170e-16  2.3257e-04  1.7368e-04  0:00:13   82
   119  1.9912e-03  1.8768e-05  6.6280e-06  6.2038e-06  1.4982e-16  2.2778e-04  1.6965e-04  0:00:13   81
   120  1.9464e-03  1.8325e-05  6.4967e-06  6.0799e-06  1.5038e-16  2.2271e-04  1.6544e-04  0:00:12   80
   121  1.8972e-03  1.7859e-05  6.3609e-06  5.9315e-06  1.5002e-16  2.1691e-04  1.6106e-04  0:00:12   79

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
   122  1.8483e-03  1.7362e-05  6.2157e-06  5.7778e-06  1.5198e-16  2.1031e-04  1.5642e-04  0:00:12   78
   123  1.7952e-03  1.6848e-05  6.0714e-06  5.6236e-06  1.5113e-16  2.0385e-04  1.5139e-04  0:00:12   77
   124  1.7458e-03  1.6361e-05  5.9134e-06  5.4845e-06  1.4916e-16  1.9792e-04  1.4661e-04  0:00:12   76
   125  1.7028e-03  1.5896e-05  5.7447e-06  5.3378e-06  1.4912e-16  1.9170e-04  1.4146e-04  0:00:11   75
   126  1.6637e-03  1.5423e-05  5.5790e-06  5.1824e-06  1.4876e-16  1.8579e-04  1.3689e-04  0:00:11   74
   127  1.6243e-03  1.4946e-05  5.4165e-06  5.0294e-06  1.4883e-16  1.7991e-04  1.3247e-04  0:00:11   73
   128  1.5883e-03  1.4481e-05  5.2530e-06  4.8906e-06  1.5127e-16  1.7444e-04  1.2834e-04  0:00:11   72
   129  1.5502e-03  1.4043e-05  5.1056e-06  4.7447e-06  1.5101e-16  1.6913e-04  1.2439e-04  0:00:11   71
   130  1.5097e-03  1.3609e-05  4.9530e-06  4.6075e-06  1.5168e-16  1.6421e-04  1.2063e-04  0:00:11   70
   131  1.4657e-03  1.3189e-05  4.8009e-06  4.4780e-06  1.5116e-16  1.5931e-04  1.1697e-04  0:00:11   69
   132  1.4197e-03  1.2778e-05  4.6444e-06  4.3550e-06  1.5191e-16  1.5483e-04  1.1341e-04  0:00:11   68

  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k       omega     time/iter
   133  1.3724e-03  1.2378e-05  4.4966e-06  4.2273e-06  1.5105e-16  1.5073e-04  1.1010e-04  0:00:10   67
   134  1.3250e-03  1.2010e-05  4.3519e-06  4.0971e-06  1.5224e-16  1.4604e-04  1.0689e-04  0:00:10   66
   135  1.2801e-03  1.1654e-05  4.2039e-06  3.9632e-06  1.5186e-16  1.4097e-04  1.0372e-04  0:00:10   65
   136  1.2365e-03  1.1284e-05  4.0682e-06  3.8314e-06  1.5182e-16  1.3601e-04  1.0054e-04  0:00:10   64
   137  1.1919e-03  1.0926e-05  3.9339e-06  3.6964e-06  1.5192e-16  1.3111e-04  9.7651e-05  0:00:10   63
   138  1.1482e-03  1.0591e-05  3.7946e-06  3.5608e-06  1.5101e-16  1.2631e-04  9.5004e-05  0:00:10   62
   139  1.1070e-03  1.0252e-05  3.6579e-06  3.4277e-06  1.5149e-16  1.2140e-04  9.2345e-05  0:00:09   61
   140  1.0717e-03  9.9283e-06  3.5356e-06  3.2994e-06  1.5151e-16  1.1678e-04  8.9612e-05  0:00:09   60
   141  1.0330e-03  9.5854e-06  3.4132e-06  3.1713e-06  1.4967e-16  1.1242e-04  8.6789e-05  0:00:09   59
   142  9.9582e-04  9.2375e-06  3.2953e-06  3.0510e-06  1.4977e-16  1.0817e-04  8.3883e-05  0:00:09   58
!  142 solution is converged

Writing to 74ab5ab119a0:"/mnt/pyfluent/.//water_pipe_flow-0.cas.h5" in NODE0 mode and compression level 1 ...
Grouping cells for Laplace smoothing ...
       48575 cells,     1 zone  ...
      116126 faces,     4 zones ...
       20404 nodes,     1 zone  ...
  Done.
Done.

Writing to 74ab5ab119a0:"/mnt/pyfluent/.//water_pipe_flow-0-00142.dat.h5" in NODE0 mode and compression level 1 ...
  Writing results.
Done.

Writing to 74ab5ab119a0:"/mnt/pyfluent/.//water_pipe_flow-0.cas.h5" in NODE0 mode and compression level 1 ...
Grouping cells for Laplace smoothing ...
       48575 cells,     1 zone  ...
      116126 faces,     4 zones ...
       20404 nodes,     1 zone  ...
  Done.
Done.

Writing to 74ab5ab119a0:"/mnt/pyfluent/.//water_pipe_flow-0-00142.dat.h5" in NODE0 mode and compression level 1 ...
  Writing results.
Done.

Post-processing#

Generate an image with fluid flow streamlines using PyFluent post-processing. Note how the force values defined in the SCDT file induce the swirl in the fluid flow.

if fluent.results.graphics.picture.use_window_resolution.is_active():
    fluent.results.graphics.picture.use_window_resolution = False

fluent.results.graphics.picture.x_resolution = 1920
fluent.results.graphics.picture.y_resolution = 1440

fluent.results.graphics.pathline["pathline"] = {}
pathline = fluent.results.graphics.pathline["pathline"]
pathline.field = "velocity-magnitude"
pathline.release_from_surfaces = ["in"]
pathline.display()

fluent.results.graphics.views.restore_view(view_name="isometric")
fluent.results.graphics.views.auto_scale()
fluent.results.graphics.picture.save_picture(file_name="fluid_swirl_pathline.png")
number tracked = 142, escaped = 51, incomplete = 91
../../_images/fluid_swirl_pathline.png

Exit#

fluent.exit()
syc.exit()

Total running time of the script: (1 minutes 1.302 seconds)

Gallery generated by Sphinx-Gallery