-
-
July 31, 2019 at 9:32 am
AnthonyL
SubscriberHello,
I would like to set the initial condition of my model as a function in order to simulate the cooling of a cylinder with heterogeneous temperature.
The temperature of each point of the solid should be given by something like this:
f( sqrt((x)^2+(y)^2+(z)^2)) )
Where f is a user defined function and x,y,z are the coordinates of the point in 3D, in my case it is a text file containing temperature as a function of distance.
In Ansys AIM I can't find an option to set the temperature other than a fixed homogeneous temperature (see attached picture)
Any idea on how to proceed ?
Thanks
Anthony
-
August 2, 2019 at 12:40 pm
rachels1001
SubscriberHey AnthonyL,
I'd suggest creating a UDF to input this as a boundary condition.
Once you have that UDF, you can create a for loop that loops over the cells in the face. You can then define a coordinate system to the face, and define the temperature accordingly. So for example:
thread = Lookup_Thread(subdomain,ID);
face_t f;
real temper = 0.0;
real xL,yL,zL /*this defines coordinate system variables for you */
real xC{ND_ND]; /*this defines the array that the coordinate system function will fill for you */
begin_f_loop(f,thread)
{
F_CENTROID(xc,f,thread); /*this populates your array with the coordinate points of the centroid of one cell in your face thread */
xL = xc[0];
yL = xc[1];
zL = xc[2]; /*this retrieves the array values as variables you can now work with */
temper = sqrt((xL)^2 + (yL)^2 + (zL)^2)); /*this defines a temperature value based on the centroid coordinates */
after this point you would need a function that could define the temperature of the cell in that face, I don't know one off the top of my head but there should be one within the documentations, you would just use the temper variable you initialized earlier.
Does anyone else know a function that does this?
This is just a basic guess on my part, but let me know if this helps!
-
August 2, 2019 at 1:46 pm
rachels1001
SubscriberSo as an update, you could use the F_Profile function to define the temperature of the individual cell. Below is a sample UDF that does the same thing with pressure:
DEFINE_PROFILE(pressure_profile,t,i)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5;
}
end_f_loop(f,t)
} -
August 15, 2019 at 1:13 pm
AnthonyL
SubscriberThanks a lot for your answers it was very helpful,
I managed to set up the temperature as a function of position for my model with the UDF you provided above,
I also switched to fluent to solve the transient thermal problem
One thing that confuses me is if I set that function as boundary condition won't it be applied at all times ? I only want this function a t=0s the rest of the time the temperature is mostly controlled by radiation and thermal conduction.
-
August 16, 2019 at 2:00 pm
AnthonyL
SubscriberOk So I used your code above and changed DEFINE_PROFILE to DEFINE_INIT which is run once at the beginning of the simulation.
This gives me the case needed.
-
- You must be logged in to reply to this topic.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
2524
-
2066
-
1279
-
1096
-
457
© 2023 Copyright ANSYS, Inc. All rights reserved.