|
[Sponsors] |
June 13, 2020, 09:49 |
Inlet pressure profile as a function of the exit profile
|
#1 |
New Member
Join Date: Apr 2020
Posts: 26
Rep Power: 6 |
Background: I would like to create a udf pressure inlet that executes the following instruction at each iteration:
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. |
|
June 15, 2020, 01:26 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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) }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
June 15, 2020, 07:54 |
|
#3 |
New Member
Join Date: Apr 2020
Posts: 26
Rep Power: 6 |
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. |
|
June 15, 2020, 10:06 |
Outlet to Inlet Mapping
|
#4 |
Senior Member
|
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.
__________________
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. |
|
June 15, 2020, 16:01 |
|
#5 |
New Member
Join Date: Apr 2020
Posts: 26
Rep Power: 6 |
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. |
|
June 15, 2020, 17:09 |
1-to-1 Mapping
|
#6 |
Senior Member
|
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.
__________________
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. |
|
June 19, 2020, 14:27 |
|
#7 |
New Member
Join Date: Apr 2020
Posts: 26
Rep Power: 6 |
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. |
|
June 19, 2020, 15:29 |
Mapping
|
#8 |
Senior Member
|
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. |
|
Tags |
boundary condition, pressure inlet |
|
|
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 |