-
-
May 1, 2023 at 11:26 pm
Meyzeeh
SubscriberHi
I'm modeling a mixture of air and another gas (no reactions) using the species model and I want to add a custom source term in kg/m3s given by S=-cΦ (c=constant and Φ=concentration in kmol/m3 calculated by the species model) using DEFINE_SOURCE. My question is what macro can I use to retrieve the cell field variable Φ from the species model when defining the source?
-
May 2, 2023 at 6:30 am
SRP
SubscriberHi,
you can use the following macro in the source definition:C_UDMI(c,t,phi_index).
You can use C_UDMI to access or store the value of the user-defined memory in a cell.
It can be used to allocate up to 500 memory locations in order to store and retrieve the values of cell field variables computed by UDFs.
For more details please refer to fluent customization manual: 3.2. Data Access Macros (ansys.com)
If you are not able to access the link, please refer to this forum discussion: https://forum.ansys.com/forums/topic/using-help-with-links/#latest
Thank you.
-
May 2, 2023 at 11:19 am
Meyzeeh
SubscriberThank you for your reply. I looked at C_UDMI it seems like it doesn't access the field variables directly by itself as there are calculated by the model it only stores variables in the allocated "user-defined memory" which are retrieved by cell field variable macros (e.g. C_UDMI() = C_T() would store the cell temperatures retrieved by C_T() in the allocated memory using C_UDMI() but doesn't retrieve the temperatures by itself) and once this data it stored in memory it can than be accessed using C_UDMI() for other purposes. It only links cell field variable macros with the allocated memory. I'm looking for a cell field variable macros similar to C_T(), C_U(), C_P() but for concentration. The closest thing I found was C_UDSI but this is used with UDS transport equations but in my case I don't need to define UDS transport equations since the species model is sufficiate for my problem. Can I somehow maybe pass the species model in the argument of C_UDSI(c,t,i) (e.g. using the species model index if it has one or something)?. Please help!!
-
May 2, 2023 at 12:30 pm
SRP
SubscriberHi,
No, it is not possible to pass the species model as an argument to C_UDSI(c, t, i) in ANSYS Fluent. C_UDSI is a user-defined scalar function that allows you to access and modify user-defined scalar variables associated with a cell (c), thread (t), and index (i).
Within the DEFINE_SOURCE macro, you can access the species concentrations using the FLUENT macros C_YI(c, t, i), which returns the mass fraction of species i in cell c and thread t.
Thank you.
-
May 2, 2023 at 1:12 pm
Meyzeeh
SubscriberThank you again for your reply.
I'm trying to model the effect of air ventilation on a gas that is introduced in the fluid domain with two sources. The first source is a constant in kg/m3s which results in a concentration build-up within the domain of the gas and the second negative source is the one I mentioned above which has the overall effect of removing some of this gas. In the end, I'm interested in the effect of both the ventilation and the negative source term on the concentration (kmol/m3) of the gas that is building up inside the domain. The mass fraction has no units so it wouldn't work with my source which must have the units kg/m3s. So there is no micro to access species concentration in kmol/m3 which I can then use with the source I mentioned above?
-
May 2, 2023 at 1:54 pm
Meyzeeh
SubscriberI also have another question. If I wanted to set up my problem as described above using UDS transport equations instead of the species model how many equations would I need and how would I define/create the air-gas mixture under the fluid tap in materials since the mixture option only appears only when you have activated the species model? The reason I'm asking is that I've gone through all the examples in the UDF manual for setting up UDS transport equations and there only consider a single fluid, not a mixture. Also, I think if I can set up UDS transport equations then I can use C_UDSI(c, t, i) to retrieve the concentration and then use it in the source.
-
May 2, 2023 at 3:39 pm
Rob
Ansys EmployeeDoes the mass sink just remove one species or all gas equally? Scalars allow you to do pretty much anything you want, the draw back is you need to know how it works: given they can also be any value it's not always simple to substitute scalar UDS for another equation.
-
May 2, 2023 at 5:11 pm
Meyzeeh
SubscriberHi Rob
The diffusion-advection equation above is what I'm trying to simulate which is just the species transport equation with an extra term that is not accounted for in the species model in ansys. The C is the concentration kmol/m3, λ is the decay constant in s^-1, D is the diffusion coefficient m2/s, S is a constant source term in kg/m3s and u is the velocity m/s. I'm trying to include the term -λC which is the missing term in the species model it's called the decay term. I wanted to add it as a source term defined as E= -λC. The concentration building in the domain decays/sink by the non-constant value -λC which also depends on the value of that concentration. The gas described by this equation will be introduced in the near-wall cells to simulate the gas emanating from the wall. There is also air entering the domain providing natural ventilation which further decreases the gas emanating from the wall.
-
May 3, 2023 at 9:02 am
Rob
Ansys EmployeeSo, you also need the age of the decaying gas? That's a good use for a scalar. Nothing stopping you using species and a scalar to then calculate the source (sink) term.
-
May 5, 2023 at 11:44 am
Meyzeeh
SubscriberHi Rob
I only needed the gas concentration distribution in the fluid domain after ventilation and after some of it had decayed. The decay is due to the radioactivity of the gas which is taken care of by the source term I wanted to introduce using a UDF. I finally manage to solve the problem using a UDS scalar transport equation thank you Rob and subscriber SRP.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5204
-
3281
-
2459
-
1308
-
970
© 2023 Copyright ANSYS, Inc. All rights reserved.