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

How to fix value for some cells with UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2018, 01:34
Default How to fix value for some cells with UDF
  #1
New Member
 
Wang Fei-Long
Join Date: Apr 2015
Posts: 9
Rep Power: 11
husywfl is on a distinguished road
Hi everyone,

I want to use the fixed value function to fix the velocity of some cell (marked as C_UDM=0).

Once I used the fixed value function the velocity of whole zone was fixed, not the specified cell.

Please somebody help me how to realize it with UDF.

Thank you very much.

husywfl
husywfl is offline   Reply With Quote

Old   April 24, 2018, 01:45
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
How do you define the cell,where you want to fix velocity?
post your code here

best regards
AlexanderZ is offline   Reply With Quote

Old   April 24, 2018, 14:00
Default
  #3
New Member
 
Wang Fei-Long
Join Date: Apr 2015
Posts: 9
Rep Power: 11
husywfl is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
How do you define the cell,where you want to fix velocity?
post your code here

best regards
Hi Alexander,

Thank you for your reply.

My code:

DEFINE_ADJUST(adjust_fix,d)
{
Thread *t;
cell_t c;

thread_loop_c(t,d)
{
begin_c_loop_all(c,t)
{
if (C_UDMI(c,t,0) == 1.)
{
C_U(c,t) = 0.;
C_V(c,t) = 0.;

#if RP_3D
C_W(c,t) = 0.;
#endif

}
}
end_c_loop_all(c,t)
}
}

For example, I want to fix the red zone (Fig.1) marked as UDM=1 with zero velocity, whick means the flow will be blocked.

But the results (Fig.2) shows the marked zone still have velocity, and the flow before and after the zone is not effected.

Please help me.

Thank you.

Husywfl
Attached Images
File Type: png UDM.png (10.9 KB, 38 views)
File Type: png velocity.png (50.3 KB, 28 views)
husywfl is offline   Reply With Quote

Old   April 24, 2018, 21:42
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
is porous zone is suitable for your simulation?

best regards
AlexanderZ is offline   Reply With Quote

Old   October 9, 2020, 09:48
Default
  #5
New Member
 
Join Date: Oct 2019
Posts: 12
Rep Power: 6
ArikGuyz is on a distinguished road
Dear husywfl,

Would you be able to solve this problem? Do you succeed to specify zero velocity to this specific region?

If you, may you share with me how did you do that?

Thanks,
ArikGuyz is offline   Reply With Quote

Old   March 18, 2021, 10:31
Default
  #6
New Member
 
Join Date: Mar 2021
Posts: 1
Rep Power: 0
engie is on a distinguished road
I think following macro's

Quote:
Code:
C_U(c,t) = 0.;
C_V(c,t) = 0.;
are only available to access data.

In mem.h, they are defined as

Code:
#define C_U(c,t)C_STORAGE_R(c,t,SV_U)
and I assume the "R" stands for "Read", so my bet is that fixing variables this way is not possible.
engie is offline   Reply With Quote

Reply


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
[ICEM] Error in mesh writing helios ANSYS Meshing & Geometry 21 August 19, 2021 14:18
How to use a UDF to set the volume fraction in the cells next to a wall? DF15 Fluent UDF and Scheme Programming 33 August 20, 2020 13:36
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 07:26
snappyHexMesh in parallel - FOAM Fatal IO Error mturcios777 OpenFOAM Running, Solving & CFD 4 August 10, 2012 19:18
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 17:12


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