|
[Sponsors] |
Different Initial Conditions Within a Single Body |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Nurzhan
Join Date: Jan 2014
Posts: 56
Rep Power: 12 ![]() |
Dear CFX experts,
I am trying to set different initial temperatures within one geometry and look how the temperature will achieve the equilibrium within the body. I built all eight parts separately (using DM) and meshed the parts in ANSYS meshing application. Then, I represent each part as a separate domain and made interface connections between the domains. Was my philosophy is right? Is it possible to set different initial conditions within a single body in any other way? I was advised to try "IF" statement, where I have to specify coordinates of each part (e.g. IF x<0.5 and y<0.4 than T=50). Any help and advise will be highly appreciated. Best regards, Nurzhan |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22 ![]() |
You can use nested if statements or step functions to get what you want.
"IF x<0.5 and y<0.4 than T=50" can be written in a CEL expression as Code:
if(X < 0.5 [m],(if(Y< 0.4 [m], 50 [C],0 [C])),0 [C]) |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Nurzhan
Join Date: Jan 2014
Posts: 56
Rep Power: 12 ![]() |
Hi Lance,
Thanks for quick response and it is exactly what I wanted. In addition I want to ask: If I want to specify temperatures for another parts of a geometry , for example: 1st part of the geometry: x<0.5 and y<0.4 then T= 50oC 2nd part of the geometry: x<1 and y< 0.6 then T= 60oC 3d part of the geometry: x<1.2 and y<0.7 then T= 70oC 4th part of the geometry: x<1.5 and y<0.8 then T= 80oC Will the expression look like this: if(X < 0.5 [m],(if(Y< 0.4 [m], 50 [C],if(X < 1 [m],(if(Y< 0.6 [m], 60 [C],if(X < 1.2 [m],(if(Y< 0.7 [m], 70 [C],80 [C])),80 [C]))),80 [C]))),80 [C]) ? Thanks again Lance. Regards, Nurzhan |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,816
Rep Power: 144 ![]() ![]() ![]() ![]() |
Your expression is becoming pretty messy. If you have lots of regions like this I would consider using a 1D interpolation function instead.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Member
Nurzhan
Join Date: Jan 2014
Posts: 56
Rep Power: 12 ![]() |
Hi Glenn,
I got your idea, but does 1-D interpolation will work for my case (see attached photo)? As per my understanding if temperature was uniform at given x value than 1-D interpolations make a sense. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,816
Rep Power: 144 ![]() ![]() ![]() ![]() |
No, 1D interpolation would not work for your 2D case.
You could use a 3D interpolation where you set the 3rd dimension to zeros. That would be a single function, but note it uses nearest neighbour interpolation and that means the transitions between temperature regions can be a little weird sometimes. Maybe your nested if statements are the best way to go. |
|
![]() |
![]() |
![]() |
![]() |
#7 |
Member
Nurzhan
Join Date: Jan 2014
Posts: 56
Rep Power: 12 ![]() |
Thank you guys for given advises. I will try IF expression then.
|
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
Nurzhan
Join Date: Jan 2014
Posts: 56
Rep Power: 12 ![]() |
I found mistake IF function for my case perfectly.
Regards, Nurzhan Last edited by Nurzhan; May 8, 2014 at 00:27. Reason: Mistake is found |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Senior Member
Join Date: Jun 2009
Posts: 1,850
Rep Power: 33 ![]() |
I am bit confused by your description. If you already meshed the parts, I imagine they show up as mesh entities under Mesh in CFX-Pre. If you already created the domains using such parts, the domains should also show up on the outline tree, correct ?
If you want to set the initial temperature distribution within one of the domain you have defined, you can open the Domain Editor, Click on the Domain Initialization tab, and input your temperature (x,y,z) distribution via a CEL expression. If you want to set the initial temperature distribution within a mesh region (2D, or 3D), you can do so by creating your CEL expression for the distribution, and multiply it by the "inside()@Locator" function. For example, let's assume you have mesh regions named "Part 1", and "Part 2", and you want to specify the temperature as a quadratic function in "Part 1", and cubic in "Part 2", you will input Temperature = (x * x + y * y) * inside()@Part 1 + (x * x * x + y * y * y) * inside()@Part 2. If you want to do so for domains, the syntax is similar: Temperature = (x * x + y * y) * inside()@Domain 1 + (x * x + y * y) * inside()@Domain 2 or on 2D locators Temperature = (x * x + y * y) * inside()@TheInlet + (x * x + y * y) * inside()@MyWall In summary, if the coordinates describing your expressions match the mesh region boundaries, there is no need for IF statements anywhere. Hope the above helps, |
|
![]() |
![]() |
![]() |
![]() |
#10 | |
Member
Nurzhan
Join Date: Jan 2014
Posts: 56
Rep Power: 12 ![]() |
Quote:
Your idea with "inside()@Locator" also sounds interesting, as "IF" function is quite "messy". Moreover, I personally found "IF" function quite inconvenient and limited, as its principle is IF(test, res1, res2) and I have to specify only one condition at test parameter. |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
buoyantSimpleFoam and watertank | Tobi | OpenFOAM Running, Solving & CFD | 100 | December 18, 2022 08:15 |
a problem with convergence in buoyantSimpleFoam | skuznet | OpenFOAM Running, Solving & CFD | 6 | November 15, 2017 12:12 |
Extremely slow simulation with interDyMFoam | jrrygg | OpenFOAM Running, Solving & CFD | 9 | April 23, 2013 10:14 |
SLTS+rhoPisoFoam: what is rDeltaT??? | nileshjrane | OpenFOAM Running, Solving & CFD | 4 | February 25, 2013 04:13 |
Problems with simulating TurbFOAM | barath.ezhilan | OpenFOAM | 13 | July 16, 2009 05:55 |