CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Adjust Inlet Pressure Profile

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By AlexanderZ
  • 1 Post By vinerm
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2020, 09:49
Question Inlet pressure profile as a function of the exit profile
  #1
New Member
 
Join Date: Apr 2020
Posts: 26
Rep Power: 6
cfdEng_ is on a distinguished road
Background: I would like to create a udf pressure inlet that executes the following instruction at each iteration:
  • Inlet Pressure Profile = Exit Pressure Profile * Constant

I was thinking about something like this but I can't make it work:

DEFINE_PROFILE(pressure_profile,t,i)
{
...
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = Exit Profile * Constant;
}
end_f_loop(f,t)
}


Question: Would you have any suggestions?

Last edited by cfdEng_; June 14, 2020 at 19:04.
cfdEng_ is offline   Reply With Quote

Old   June 15, 2020, 01:26
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
there are several similar threads regarding your issue. Make a search through forum

in few words, you can use DEFINE_PROFILE to set boundary condition to inlet
you can use DEFINE_EXECUTE_AT_END macro to get pressure value from outlet at the end of iteration(or timestep in case of transient)

if you want to apply some average value, you can create some global variable inside UDF to store and transfer pressure value between macros.

if you want to capture the whole variation of pressure in outlet, you wanna use UDMI. But it would be much easier to transfer pressure (or any other UDMI) if your mesh in inlet and outlet is exactly same (if its not, you may llink your data to coordinates, for example)

your logic here is right, you can use it as a basis
Code:
DEFINE_PROFILE(pressure_profile,t,i)
{
...
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = Exit Profile * Constant;
}
end_f_loop(f,t)
}
cfdEng_ likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 15, 2020, 07:54
Default
  #3
New Member
 
Join Date: Apr 2020
Posts: 26
Rep Power: 6
cfdEng_ is on a distinguished road
Thank you very much for your reply.

I read a few similar discussions but I still do not fully understand how to transfer a UDMI from exit to inlet.
My outlet and inlet are identified by different face threads and I cannot loop at the same time over two different threads. My mesh at inlet and outlet is the same.

DEFINE_PROFILE(pressure_profile,in_t,i)
{
...
begin_f_loop(f,in_t)
{
F_PROFILE(f,in_t,i) = F_UDMI(f,out_t,i) * Constant;
}
end_f_loop(f,in_t)
}

Therefore, if I simply loop over the inlet thread I get the following error:

Node 0: Process 12192: Received signal SIGSEGV.

================================================== ============================

The fluent process could not be started.


Thank you in advance.

Last edited by cfdEng_; June 15, 2020 at 09:07.
cfdEng_ is offline   Reply With Quote

Old   June 15, 2020, 10:06
Default Outlet to Inlet Mapping
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
You cannot transfer UDMs. Each boundary has its own thread and UDMs are identified using indices. The solution is to interpolate. Even if you have same mesh on both, inlet and outlet, you need to do some interpolation; could be just 0th order. In other words, you need to decide what kind of mapping do you want from the outlet to the inlet. If there are equal number of faces on each boundary, then you can do 1-to-1 mapping. For identification, you can compare the coordinates.
cfdEng_ likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 15, 2020, 16:01
Default
  #5
New Member
 
Join Date: Apr 2020
Posts: 26
Rep Power: 6
cfdEng_ is on a distinguished road
Many thanks, that was very helpful.

I tried to look up ways to perform a 1-to-1 mapping but I wasn't able to find anything clear.

Would you have an article/script to suggest?

Thank you in advance.
cfdEng_ is offline   Reply With Quote

Old   June 15, 2020, 17:09
Default 1-to-1 Mapping
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
1-to-1 mapping is possible only if you have same number of faces on each boundary. You will have to write the code yourself. One approach would be to compare the coordinates of the face centroids and assign some common IDs to matching faces. Then, you can use these to transfer data, say, via a UDM. The common IDs can be used as first argument of the UDM or array.
cfdEng_ likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 19, 2020, 14:27
Default
  #7
New Member
 
Join Date: Apr 2020
Posts: 26
Rep Power: 6
cfdEng_ is on a distinguished road
Thank you for your suggestion.

In the end, I have adopted a straightforward approach that seems to work: I have simply stored the exit pressure profile in a vector.


DEFINE_PROFILE(total_pressure_profile,t,i)
{
.
.
.
t = Lookup_Thread(d,Exit_ID);
k = 0;
begin_f_loop(f,t)
{
. . .
store[k] = Total_Pressure;
k = k + 1;
}
end_f_loop(f,t)

/*update inlet pressure profile*/
k = 0;
t = Lookup_Thread(d,Inlet_ID);
begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = store[k]*Constant;
k = k+1;
}
end_f_loop(f,t)
}


Question: At the moment I am trying to parallelize my code and I am wondering what would be the best strategy. Would it be possible, in a parallel run, to make a single CPU calculate the inlet pressure profile?

Thank you in advance.
cfdEng_ is offline   Reply With Quote

Old   June 19, 2020, 15:29
Default Mapping
  #8
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The code will not give you expected results. Lets assume that the case is 2D and both boundaries, inlet and outlet, are straight lines along y-axis. The vector saved from outlet could start from minimum y while that for inlet might start from maximum y. Then, the profile will be applied in the opposite direction. Therefore, you should use coordinates to ensure that the profile is applied correctly.

You cannot use single CPU to do the calculation because single core does not have all the information. Host does not have mesh and field variables available and the nodes always have more or less equal number of cells partitioned. Therefore, you have to either use serial Fluent or parallelize the code. Parallelization is not difficult once the code is working as expected.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Reply

Tags
boundary condition, pressure inlet


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
Pressure Inlet Boundary Conditions Mr.Goodcat FLUENT 5 June 20, 2019 02:47
Pressure inlet vs outlet position, transient, time dependent pressure and gravity silent2608 FLUENT 0 February 6, 2016 11:19
Pressure loss Velocity coupling CFXMUFFIN CFX 1 February 6, 2016 05:43
sonicFoam - pressure driven pipe: flow continuity violation and waveTransmissive BC Endel OpenFOAM Running, Solving & CFD 3 September 11, 2014 17:29
Assign static pressure at inlet Tanjina FLUENT 0 November 3, 2013 12:34


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