
[Sponsors] 
November 21, 2022, 12:48 
CEL Expression in CFX

#1 
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Hi all,
I am trying to write a CEL expression in CFX to describe the viscosity which changes with time as a result of varying concentrations of a scalar. The equation is as follows: μ_i (t)= μ_initial (1+ β (1 γ_si (t)) where μ_initial and β are constants, and γ_si (t) ∈ [0, 1] is the concentration of a scalar. I have defined an additional variable as a scalar and solved it using a transport equation. However, I am not sure how to get the concentration of this scalar as normalized as [0, 1] as shown in the equation, and put it into the expression. Any suggestions from you would be appreciated and looking forward to hearing back from you. 

November 21, 2022, 13:08 

#2 
Senior Member
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 1,167
Rep Power: 23 
I'm assuming you want mass fraction or volume fraction, but of course you are modeling this as a scalar, so those quantities are not available to you like they would be for a multicomponent mixture.
You will have to convert the scalar to a volume fraction yourself. How to do this exactly will depend on how you defined the scalar. So just make this conversion from whatever you have the scalar quantity defined to what it is that you need it to be. Or model this using a multicomponent mixture instead of a passive scalar, and define your viscosity function in the mixture properties. 

November 21, 2022, 13:38 

#3  
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Quote:
Thanks for your attention and quick response. First, let me explain more about my model: I am now working on a multiphase model with a fluid drug entering the blood. As the drug convects and diffuses, a substance in it dissipates within the blood. This would result in a reduction in the concentration of the drug but an increase in its viscosity. Therefore, except for the twofluid modeling of drug and blood, I also included a scalar transport equation to model the movement of the substance within the drug. As mentioned in my post, the viscosity of the drug depends on the concentration of this substance so I will need to decide the concentration of this substance. Regarding your response, I have further questions: 1. Does concentration mean volume fraction in this equation? In my opinion, concentration has the unit of kg/m3 so how it can be converted into [0 1]. 2. If I just define this substance as an unspecific scalar, how would you suggest obtaining its concentration? I am new to this area so please bear me if I asked any silly questions. Yours, Yu 

November 21, 2022, 13:50 

#4 
Senior Member
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 1,167
Rep Power: 23 
I'm guessing you don't mean multiphase? everything is a fluid, so perhaps you mean multicomponent? I thought you were just modeling this as a passive scalar though?
If your scalar result is in units kg/m^3, you can convert this to a mass fraction via the expression: ScalarName/BloodDensity. So If you had 106 kg/m^3 of the drug, and blood density is 1060 kg/m^3, it would give you a result of 0.10. 

November 21, 2022, 14:14 

#5  
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Quote:
I will dig into more to see if I should use a multiphase model or a multicomponent model. I am now just following the procedure from a paper in which blood and drug were modeled as interpenetrating fluids. The transport equation was also solved for a passive scalar to represent the concentration of drug in the domain. 

November 21, 2022, 16:27 

#6 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143 
Yes, that all sounds like a multicomponent mixture, not multiphase.
Different CFD software have different names for things, so they might use a different name for this physics.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. 

November 21, 2022, 17:13 

#7  
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Quote:
1. I defined an additional variable as an unspecified scalar, which value is 1 at the inlet and 0 in the domain and at the outlet. Am I right on the following expression for viscosity (the actual equation is in my first post): μ_initial[kg/m/s] * (1 + β*(1  max (0, variable name)) where μ_initial and β are constants. 2. Do we even still need a passive scalar? I checked the CFX reference guide and found there is an available syntax that can directly obtain the component concentrations (i.e. drug.mconc), which can be applied in the expression to get the viscosity. Really appreciate your time and look forward to your explanations. 

November 21, 2022, 17:28 

#8 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143 
If you use the multicomponent mixture approach then you will have two species, blood and drug. You define the mass fractions of them at the initial condition and boundary conditions and they will flow around the domain from there. The viscosity at each point will be calculated from the ideal mixture law (unless you define some other relation).
This means your scalars and viscosity equation will not be required, that will all be in there already.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. 

November 22, 2022, 13:15 

#9 
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Hi @ghorrocks,
I double checked paper and confirmed that they used a multiphase model rather than a multicomponent mixture since they solved mass and momentum equations separately for the two fluids, together with the phase fraction equation. The viscosity of drug is changing with time as a function of scalar concentrations [γ_si (t) ∈ [0, 1]] and again, I am still confused about how to implement this into the CEL expression. Am I right on the following expression? μ_initial[kg/m/s] * (1 + β*(1  max (0, variable name)) where μ_initial and β are constants. The variable name is defined from an additional variable as an unspecified scalar, which value is 1 at the inlet and 0 in the domain and at the outlet. 

November 22, 2022, 16:40 

#10 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143 
You need to make sure you have the fundamental physics correct before you look at how to implement it. Have you read the documentation on multicomponent and multiphase models? You really need to understand the underlying assumptions of these options before you choose one.
Because what you are describing sounds like a multicomponent model. It already contains all the physics you are describing built in. Modelling what you describe as a multiphase model and then making the viscosity of the mixture a function of the volume fraction of the drug phase does not make physical sense  the whole point of a multiphase model is that you have relative slip between the phases, and the viscosity of the phases is independent of the volume fraction  but the effective viscosity of the mixture is increased due to the phase slip effect.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. 

November 22, 2022, 17:07 

#11 
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Thanks for coming back ghorrocks,
I did not mean that the viscosity of the mixture is changing with time. The viscosity of one fluid (i.e. drug) changes with time, while another fluid, namely, the blood is with constant viscosity. When the drug is injected into the blood, the concentration and viscosity of the blood would change in the same way as shown in the attached figure. I have tried the multicomponent model which gave me totally different distributions. 

November 22, 2022, 17:22 

#12 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143 
It looks like I misunderstood what you are trying to do. I better ask some fundamental questions:
How does the drug mix with the blood? Is it mixed at the molecular level (and is driven by diffusion)? Or is the drug in droplets or bubbles (and is driven by slip relative to the surrounding blood)? Or is the drug separated from the blood by a distinct free surface (like water in a bath tub)? In your viscosity expression, what is "variable name"? And what is y_si(t)?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. 

November 22, 2022, 18:14 

#13  
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Quote:
Regarding your second question, in the original paper, the drug and blood are modeled as a multiphase mixture, while the solvent was modeled as a passive scalar and y_si(t) represents its concentration. What I have done was to define an additional variable as a specific scalar, that is fluid dependent with the drug. The value of this variable is specified as 1 at the inlet and 0 in the domain and at the outlet so it would vary from 0 to 1. I thereby tried to use the function max (0, name of additional variable) to obtain the concentration. 

November 22, 2022, 18:26 

#14 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143 
OK, thanks.
What form is the precipitated solid? Is it a fine solid which is emulsified into the liquid? How fine? You say it has the effect of increasing the viscosity, so it sounds like it is very fine. Is the precipitation reaction reversible? Or once you have the solid it never reverts back? Is the precipitation reaction between a component in the drug and a component in the blood? What controls the rate of this reaction?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. 

November 22, 2022, 18:37 

#15  
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Quote:
I have no idea regarding your questions on the precipitated solid. They did not mention any details since the actual solidification reaction was not modeled. Since the consequence of this solidification would lead to an increase in material viscosity so they just model the increase in viscosity of the drug. 

November 22, 2022, 18:44 

#16 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143 
I will assume the solid is an emulsion or something like it, where the solid particles are small, dispersed and do not agglomerate.
So isn't your viscosity function not correct, because it does not take into account that you need both the drug component and the blood component to produce the solid, and both of these components get consumed in the reaction? What describe here is still a multicomponent model, but one where the drug is a multicomponent mixture of solvent+drug, and blood is a multicomponent mixture of blood+reactant. Then there is chemistry between the drug and the reactant, they combine to produce a new species which is actually a solid but is taken here as a liquid component with a high viscosity.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. 

November 22, 2022, 18:51 

#17  
New Member
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5 
Quote:


Tags 
additional variables, cel expression, concentrations, transport equation 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Help with Expression in Ansys CFX  shubh1153  Main CFD Forum  0  March 6, 2019 19:46 
Expression in CFX  sina.safaei  CFX  1  August 11, 2018 01:30 
External Gear Pump  CEL expression query  Kummi  CFX  2  August 1, 2018 20:39 
Set "location" in CEL expression to local plotting location  Jonathan  CFX  0  July 1, 2015 07:21 
Error reading profile data in expression in cfx post  banu  CFX  4  March 27, 2015 09:03 