|
[Sponsors] |
August 10, 2023, 11:30 |
How to set bounds for additional variables
|
#1 |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Hi everyone,
I created an additional variable as a scalar value in CFX which represent a concentration running from 0-1, but after the run and I opened in CFX-post, the values were out of bound (it went down to -0.33 and up to 1.34 for instance). This will greatly affect the results because the expressions that use this additional variable run with the bound. Is there a way to set the additional variable to be within the bound [0,1]? Or are there any chapters in the theory/modeling guide that I can read and follow? Thanks. |
|
August 10, 2023, 17:17 |
|
#2 |
Senior Member
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33 |
It all depends on what equation you are solving for the additional variable.
Advice: do not bound/clip a solved variable ever. If you do, the non-linear equations can never be solved as stated; therefore, you are not solving the mathematical problem you formulated. If you bound/clip them, you must be 1000% sure that step goes away as the residual reaches convergence, i.e. 0. If you read the documentation theory for the transport of the species, you may find what you are looking for.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
August 17, 2023, 11:02 |
|
#3 | |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Quote:
In my case, I’m using the additional variable as a scalar quantity to solve the equation for viscosity. And this viscosity will be use to solve the transport equation. So I don’t think there’s a problem with setting the bounds in this case. I tried to read through the documents, but I still don’t find where it mentioned ways on how to bound additional variable. So, can you please give me an insight on how to do that or where exactly they mention it? That would be very helpful. Thank you. |
||
August 17, 2023, 12:13 |
|
#4 |
Senior Member
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33 |
Would you mind posting the transport equation you are trying to solve?
If your transport equation has sources and sinks, you need to improve the setup of the sources and sinks; otherwise, you will have convergence difficulties. Bounding will NOT help you but postpone the issue as I mentioned earlier. Even if you do not have sources and sink, but your mesh aspect ratio or skewness is on edge, you will get unexpected "out of bounds" values that ARE correct. Clipping is not the solution here either. In this situation, you have a mesh problem and need to fix your mesh. Summary: clipping is an overused approach, and needs to be understood deeply before is used; otherwise, you are hiding a problem
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
August 17, 2023, 13:06 |
|
#5 | |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Quote:
So this is some of the code that I'm using to solve for dynamic viscosity of a material called Onyx. This is a multiphase of continuous liquid btw. I don't know if this is enough or what your asking for, but hopefully it is. LIBRARY: CEL: EXPRESSIONS: On = 0.018[kg/m/s]* (1+ 500 * (1 - min(DMSO,1))) *** cannot go below 0.018 kg/m/s when DMSO is greater than 1 *** VisOnyx = (Blood.Mass Fraction*0.004[kg/m/s])+(Onyx.Mass Fraction*On) Visblood = (Blood.Volume Fraction* 0.004[kg/m/s])+((1-Blood.Volume \ Fraction)*On) END END ADDITIONAL VARIABLE: DMSO Option = Definition Tensor Type = SCALAR Units = [] Variable Type = Specific END ..... MATERIAL: Onyx Material Group = User Option = Pure Substance PROPERTIES: Option = General Material EQUATION OF STATE: Density = 1063 [kg m^-3] Molar Mass = 1.0 [kg kmol^-1] Option = Value END DYNAMIC VISCOSITY: Dynamic Viscosity = VisOnyx Option = Value END END END .... ANALYSIS TYPE: Option = Transient EXTERNAL SOLVER COUPLING: Option = None END INITIAL TIME: Option = Automatic with Value Time = 0 [s] END TIME DURATION: Option = Total Time Total Time = 2.5 [s] END TIME STEPS: Option = Timesteps Timesteps = 0.01 [s] END END DOMAIN: Default Domain Coord Frame = Coord 0 Domain Type = Fluid Location = B24 BOUNDARY: Default Domain Default Boundary Type = WALL Location = F73.24,F75.24 BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Option = Fluid Dependent END MASS AND MOMENTUM: Option = No Slip Wall END WALL CONTACT MODEL: Option = Use Volume Fraction END END FLUID: Blood BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Option = Zero Flux END END END FLUID: Onyx BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Option = Zero Flux END END END END BOUNDARY: Inlet Boundary Type = INLET Location = F72.24 BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Additional Variable Value = 1 [] Option = Value END FLOW REGIME: Option = Subsonic END MASS AND MOMENTUM: Normal Speed = 0.2 [m s^-1] Option = Normal Speed END END FLUID: Blood BOUNDARY CONDITIONS: VOLUME FRACTION: Option = Value Volume Fraction = 0 END END END FLUID: Onyx BOUNDARY CONDITIONS: VOLUME FRACTION: Option = Value Volume Fraction = 1 END END END END BOUNDARY: Outlet Boundary Type = OUTLET Location = F74.24 BOUNDARY CONDITIONS: FLOW REGIME: Option = Subsonic END MASS AND MOMENTUM: Option = Static Pressure Relative Pressure = 0 [Pa] END END END BOUNDARY: Wall Boundary Type = WALL Location = F25.24,F26.24,F27.24,F28.24,F29.24,F30.24,F54.24,F 82.24 BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Option = Fluid Dependent END MASS AND MOMENTUM: Option = No Slip Wall END WALL CONTACT MODEL: Option = Use Volume Fraction END END FLUID: Blood BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Option = Zero Flux END END END FLUID: Onyx BOUNDARY CONDITIONS: ADDITIONAL VARIABLE: DMSO Option = Zero Flux END END END END DOMAIN MODELS: BUOYANCY MODEL: Option = Non Buoyant END DOMAIN MOTION: Option = Stationary END MESH DEFORMATION: Option = None END REFERENCE PRESSURE: Reference Pressure = 0 [atm] END END FLUID DEFINITION: Blood Material = Blood Option = Material Library MORPHOLOGY: Option = Continuous Fluid END END FLUID DEFINITION: Onyx Material = Onyx Option = Material Library MORPHOLOGY: Option = Continuous Fluid END END FLUID MODELS: ADDITIONAL VARIABLE: DMSO Option = Fluid Dependent END FLUID: Blood ADDITIONAL VARIABLE: DMSO Kinematic Diffusivity = 10e-5 [m^2 s^-1] Option = Transport Equation END END FLUID: Onyx ADDITIONAL VARIABLE: DMSO Kinematic Diffusivity = 10e-5 [m^2 s^-1] Option = Transport Equation END END HEAT TRANSFER MODEL: Homogeneous Model = False Option = None END THERMAL RADIATION MODEL: Option = None END TURBULENCE MODEL: Homogeneous Model = False Option = Laminar END END FLUID PAIR: Blood | Onyx INTERPHASE TRANSFER MODEL: Interface Length Scale = 0.1 [mm] Option = Mixture Model END MASS TRANSFER: Option = Specified Mass Transfer SPECIFIED MASS TRANSFER: Fluid1to2 Mass Flow = 0.1 [kg s^-1 m^-3] Option = Interfacial Mass Flow END END MOMENTUM TRANSFER: DRAG FORCE: Drag Coefficient = 0.44 Option = Drag Coefficient END END END INITIALISATION: Coord Frame = Coord 0 Option = Automatic FLUID: Blood INITIAL CONDITIONS: Velocity Type = Cartesian ADDITIONAL VARIABLE: DMSO Additional Variable Value = 0 [] Option = Automatic with Value END CARTESIAN VELOCITY COMPONENTS: Option = Automatic with Value U = 0 [m s^-1] V = 0 [m s^-1] W = 0 [m s^-1] END VOLUME FRACTION: Option = Automatic with Value Volume Fraction = 1 END END END FLUID: Onyx INITIAL CONDITIONS: Velocity Type = Cartesian ADDITIONAL VARIABLE: DMSO Additional Variable Value = 0 [] Option = Automatic with Value END CARTESIAN VELOCITY COMPONENTS: Option = Automatic with Value U = 0 [m s^-1] V = 0 [m s^-1] W = 0 [m s^-1] END VOLUME FRACTION: Option = Automatic with Value Volume Fraction = 0 END END END INITIAL CONDITIONS: STATIC PRESSURE: Option = Automatic with Value Relative Pressure = 0 [Pa] END END END MULTIPHASE MODELS: Homogeneous Model = Off FREE SURFACE MODEL: Option = None END END END SOLVER CONTROL: ADVECTION SCHEME: Option = High Resolution END CONVERGENCE CONTROL: Maximum Number of Coefficient Loops = 10 Minimum Number of Coefficient Loops = 1 Timescale Control = Coefficient Loops END CONVERGENCE CRITERIA: Residual Target = 1.E-4 Residual Type = RMS END EQUATION CLASS: continuity ADVECTION SCHEME: Option = High Resolution END END EQUATION CLASS: momentum ADVECTION SCHEME: Option = High Resolution END END INTERRUPT CONTROL: Option = Any Interrupt CONVERGENCE CONDITIONS: Option = Default Conditions END END MULTIPHASE CONTROL: Initial Volume Fraction Smoothing = Volume-Weighted Volume Fraction Coupling = Segregated END TRANSIENT SCHEME: Option = Second Order Backward Euler TIMESTEP INITIALISATION: Option = Automatic END END VELOCITY PRESSURE COUPLING: Rhie Chow Option = High Resolution END END END |
||
August 17, 2023, 15:10 |
|
#6 |
Senior Member
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33 |
You are solving an additional variable for each fluid: Onyx and Blood.
The transport equation is extremely simple: transient + advection + diffusion The diffusion coefficient is set to 1.E-4 The inlet condition is simple. I see no reason why your AV can be anything but 1 wherever is advected to, and because your initial value inside the domain is 0, there would be some diffusion until it is advected out. Advice: 1 - disconnect the additional variable from the viscosities of Onyx and Blood. 2 - post-process the results to see if the solution makes any sense for the two phases, and if the additional variable is sensible (it has to be) 3 - Noticed you used .Mass Fraction for a simple material fluid. Check in CFD-Post that variable makes any sense. 4 - Once your vanilla setup makes sense, you can activate only 1 of your viscosities. 5 - Check and balances 6 - Activate next, check and balances. Summary: reduce your problem to simple verifiable steps before committing to complex problems where it is not clear what the interactions are.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
August 17, 2023, 22:14 |
|
#7 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
Also: You are modelling this as a multiphase model. Are you sure this is a multiphase model? If the fluid is better modelled as a single phase fluid with a variable concentration of components then a multicomponent model is model appropriate. You should only use a multiphase model when the two fluids are separable into different phases.
As this appears to be a model of blood it makes sense to model the platelets as multiphase particles (if that is relevant to what you want to do). But you appear to be modelling blood as a fluid and then a multicomponent mixture might be more appropriate.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
August 18, 2023, 05:25 |
|
#8 | |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Quote:
|
||
August 18, 2023, 05:29 |
|
#9 | |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Quote:
|
||
August 18, 2023, 06:10 |
|
#10 | |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
Quote:
Note that if you model this using mass fractions as you would in a multicomponent model I bet you will not have boundedness problems and require horrible fudges like clipping variables. Quoting the first line of the CFX Solver Modelling Guide, Ch 7: "Multiphase flow refers to the situation where more than one fluid is present. Each fluid may possess its own flow field, or all fluids may share a common flow field. Unlike multicomponent flow, the fluids are not mixed on a microscopic scale in multiphase flow. Rather, they are mixed on a macroscopic scale, with a discernible interface between the fluids." Aren't your materials mixed on a microscopic scale, and therefore you have a multicomponent fluid, not a multiphase one?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
August 18, 2023, 09:17 |
|
#11 | |
Senior Member
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33 |
Quote:
You need to differentiate the vocabulary in the papers from yours and use a "context-based translator". To know the exact differences, in my opinion, the mathematical equations MUST be written explicitly, not described in words.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
August 20, 2023, 11:13 |
|
#12 | |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Quote:
On = 0.018[kg/m/s]* (1+ 500 * (1 - min(DMSO,1))) *** equation from paper and cannot go below 0.018 kg/m/s when DMSO is greater than 1 *** VisOnyx = (Blood.Mass Fraction*0.004[kg/m/s])+(Onyx.Mass Fraction*On) ***I formulated it to put in dynamic viscosity for the Onyx (the other material not the blood while the blood have constant viscosity)*** And I'm just solely analyzing the qualitative aspects like the flow patterns. I looked into the governing equations as suggested by Opaque and I captured the equation from the paper. The description also said that they are solving for "six momentum equation, together with mass conservation and an equation for the phrase fraction." I still believe that it's multiphase flow based on the reasons above. Is it possible that they are mixing on macroscopic instead of microscopic? Or do you suggest otherwise? |
||
August 20, 2023, 20:39 |
|
#13 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
If the paper you are comparing against used 6 momentum equations (which is presumably XYZ momentum for two phases) that suggests they used a multiphase approach. But just because that is what they did does not mean it is correct. If the fluid is mixed at the microscopic level then there will be no interphase slip, and then the 6 momentum equations are redundant - the velocity field for both "phases" will be the same. So lots of wasted computing there. But more fundamentally, multiphase models do not combine the phases together to give an overall viscosity. You need a multicomponent model for that.
When you ran your model as multicomponent mixture, did you use your viscosity equation? The default viscosity calculation is ideal fluids which I recall is just mass fraction weighted. How confident are you that the flow predicted by the paper you are comparing to is correct?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
August 23, 2023, 09:17 |
|
#14 | |
New Member
Join Date: Aug 2023
Posts: 10
Rep Power: 3 |
Quote:
As for the confidentiality of the paper, I would say it’s a well established one, and their results makes sense. “When the onyx penetrates the meshed volume its viscosity changed first at the onyx-blood interphase and subsequently throughout the onyx volume as solvent(additional variable) diffuses further.” This quote reflects the property of the material really well. But the problem is the viscosity pattern, so I thought that maybe it’s my expression of ideal mixture to be put as the viscosity of onyx. Do you think this could be the case? The paper didn’t give any correlation between the two viscosity at all (I assumed that maybe the CFD-ACE+could solve for the dynamic viscosity of the two using ideal mixture), so I assumed ideal mixture for onyx. I also checked my mesh quality and it has no effect to the results or the convergence of the additional variable. As Opaque said that my code is very simple and shouldn’t have difficulty converging, but that’s not the case. What do you think could be the problem? |
||
August 23, 2023, 19:34 |
|
#15 | ||||
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
Quote:
Quote:
Quote:
Quote:
You have found that the paper you are referring to has made a fundamental mistake in how to model this. Do not copy their mistake.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|||||
Tags |
additional variable, cfx |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ParaFoam not responding on mac | Abhisek | OpenFOAM | 0 | May 7, 2022 13:15 |
Using gnuplot to plot probe data | Rotidpor | OpenFOAM | 3 | March 9, 2022 06:44 |
[surface handling] Decomposing Faces after Extrude2DMesh with autoPatch | JEBland | OpenFOAM Meshing & Mesh Conversion | 5 | December 6, 2021 08:28 |
Possible bug with stitchMesh and cyclics in OpenFoam | Jack001 | OpenFOAM Pre-Processing | 0 | May 21, 2016 09:00 |
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found | piprus | OpenFOAM Installation | 22 | February 25, 2010 14:43 |