Source Terms
Is it possible to multiply one source term in another source term? (simple example below)
mass1 doesn´t work...
Or more detailed, is it possible to refer in one source term to a source term which was defined before?
Best Answers

DrAmine GermanyForum Coordinator
Yes because your are printing a message for UDMI0 which has the value of 1. You won't see any changes. You should rather printe source2 or assign source 2 to a second UDMI.
Another point: are you assigning the UDF's to the same same cell zone? If yes it should work if no, it won't work.
By the way why using an UDF for this simple task. Rely on Expressions in Fluent.

Rob UKForum Coordinator
Correct as the first source term hasn't been defined for the second cell zone. In your example use source2 = 0.5*y * 2 rather than reference the other function. If the overall model is more complex review the use of Functions as that may simplify the code.
Answers
Yes, you should be able to do that. But, please store the value of the source in UDMI's and then use these UDMI's for all the subsequent operations (multiplication or division).
Please take a look at the following section: 2.3.42.4. Example 2  Degassing Boundary Condition (Fluent Customization Manual)
I hope this helps.
Thanks.
Karthik
Dear Kremalla,
thanks a lot for your help and your response.
But unfortunately the second source term (mass1) also does not work with UDMI´s...
With best regards
isaps1860
How are you hooking the sources? HOW are the UDF now looking? about using Fluent expressions?
Hello DrAmine,
first step I do, is to set the Number of UserDefined Memory Locations to 1.
After that, the compiling of the UDF occurs.
The messages I get from the UDF say that C_UDMI(c,t,0) = 1,
but fot the second source term the cells of C_UDMI2(c,t,0)=0. So the Values of C_UDMI(c,t,0) doesn´t get transfered to the second DEFINE_SOURCE macro.
With best regards
isaps1860
Because you need two UDMI's: You have only one and it has the value of source 1. It will return the same value in the second UDF.
Dear DrAmine,
thank you for your answer. But I don´t understand it exactly.
My wish for the second UDF is to return the same value like in source1. In the example above, the value "1" and then multiplicate this value.
I don´t know why this values don´t get transferred and also have no idea in which way a second UDMI can solve it...sorry for that
Best regards
isaps1860
Yes because your are printing a message for UDMI0 which has the value of 1. You won't see any changes. You should rather printe source2 or assign source 2 to a second UDMI.
Another point: are you assigning the UDF's to the same same cell zone? If yes it should work if no, it won't work.
By the way why using an UDF for this simple task. Rely on Expressions in Fluent.
Thanks one more time for your respond DrAmine.
I think the point of different cell zones is the problem. The second source term is for an other cell zone than the first one. So for this setup it isn´t possible to rely on another source term?
An UDF is necessary for the terms I want to handle, the example I printed here is only a simplification.
Correct as the first source term hasn't been defined for the second cell zone. In your example use source2 = 0.5*y * 2 rather than reference the other function. If the overall model is more complex review the use of Functions as that may simplify the code.
Alright Rob, thanks for the help.
The overall model should describe a source term for the second source term (second zone) which is depending on the not constant first source term. So the strategy with different source terms will not be promising, when the terms aren´t defined in the different zones...pity
Best regards
isaps1860
Can you describe what you want to do?
I want to describe the filter efficiency with the help of a UDF. So the different zones together represent the filter.
Let´s say the first zone has an efficiency of 50% and 100g/h oil gets into the whole filter, the source term for the first zone corresponds 50 g/h (units for source terms disregarded).
Now the second source term needs the information of the first source term how much oil is "captured" in the first zone, and so on and on. But this efficiency changes with time because of different saturations, velocities etc. So the information of the first source term isn´t constant.
Does the second filter need to know the amount removed by the first filter? If separation efficiency is related to the saturation etc those values can be taken from the solution to determine what's removed in the second filter. You'll need to work out how to track the filter saturation, I'd suggest reading up on scalars.
Yes, the second zone needs to know that.
Thank you for your suggestion, i will read it.
One more question I´ve got. Would it be possible to set a flux over a interior boundary in relation to a flux before?
So to speak, as a substitution for the source terms.
Not really, as the flux is determined by the rest of the flow, in essence you'd be forcing a solution.