CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

CEL Expression in CFX

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2022, 12:48
Default CEL Expression in CFX
  #1
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
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.
Zhu is offline   Reply With Quote

Old   November 21, 2022, 13:08
Default
  #2
Senior Member
 
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 1,167
Rep Power: 23
evcelica is on a distinguished road
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.
evcelica is offline   Reply With Quote

Old   November 21, 2022, 13:38
Default
  #3
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Quote:
Originally Posted by evcelica View Post
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.
Hi Evcelica,

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 two-fluid 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
Zhu is offline   Reply With Quote

Old   November 21, 2022, 13:50
Default
  #4
Senior Member
 
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 1,167
Rep Power: 23
evcelica is on a distinguished road
I'm guessing you don't mean multi-phase? everything is a fluid, so perhaps you mean multi-component? 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.
evcelica is offline   Reply With Quote

Old   November 21, 2022, 14:14
Default
  #5
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Quote:
Originally Posted by evcelica View Post
I'm guessing you don't mean multi-phase? everything is a fluid, so perhaps you mean multi-component? 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.
Thanks again for your response.

I will dig into more to see if I should use a multiphase model or a multi-component 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.
Zhu is offline   Reply With Quote

Old   November 21, 2022, 16:27
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,716
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 21, 2022, 17:13
Default
  #7
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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.
Thanks, @ghorrocks, I have two further questions if you think this should be modeled as a multi-component mixture:

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.
Zhu is offline   Reply With Quote

Old   November 21, 2022, 17:28
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,716
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 22, 2022, 13:15
Default
  #9
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Hi @ghorrocks,

I double checked paper and confirmed that they used a multi-phase model rather than a multi-component 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.
Zhu is offline   Reply With Quote

Old   November 22, 2022, 16:40
Default
  #10
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,716
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 22, 2022, 17:07
Default
  #11
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
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.
Attached Images
File Type: png contour maps.PNG (154.5 KB, 8 views)
Zhu is offline   Reply With Quote

Old   November 22, 2022, 17:22
Default
  #12
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,716
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 22, 2022, 18:14
Default
  #13
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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)?
So basically the drug is a liquid consisting of a solvent and another substance. After injection, the solvent diffuses and dissipates into the blood which allows another substance to precipitate. Here, the solidification is just mimicked by increasing the viscosity of the drug. Therefore, regarding your first question, I think the solvent is mixed with the blood at the molecular level but the entire drug fluid is not, because the process starts on the surface of the drug while the core is still liquid.

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.
Zhu is offline   Reply With Quote

Old   November 22, 2022, 18:26
Default
  #14
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,716
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 22, 2022, 18:37
Default
  #15
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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?
Thanks again your replying!

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.
Zhu is offline   Reply With Quote

Old   November 22, 2022, 18:44
Default
  #16
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,716
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 22, 2022, 18:51
Default
  #17
Zhu
New Member
 
Yu Zhu
Join Date: Apr 2021
Posts: 9
Rep Power: 5
Zhu is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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.
Many thanks, ghorrocks for your suggestions and I will reconsider this as what you have described.
Zhu is offline   Reply With Quote

Reply

Tags
additional variables, cel expression, concentrations, transport equation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 10:10.