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

UDF for particle deposition in porous zone

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 1, 2021, 23:23
Default UDF for particle deposition in porous zone
  #1
New Member
 
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 4
Peter_Beshay is on a distinguished road
Hi,
I am very new in UDF and do not have much knowledge on C.
I need urgent help in a UDF to:
1- specify the porous zone ID
2- read the particle concentration in each cell
3- reduce it as a percentage from the initial concentration
4- store the new reduced concentration

I tried for many days but i am stuck, i really appreciate if anyone will help me.
The code i tried is below (probably it is very bad):

#include "udf.h"
#include "sg_mem.h"
# include "dpm.h"
# define domain_ID 4
DEFINE_ADJUST(adjust_UDS,domain)
{
Thread *t;
cell_t c;
domain = Get_Domain(domain_ID);
/*Fill UDS with the variable*/
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDSI(c,t,0) = C_DPMS_CONCENTRATION(c,t);
}
end_c_loop (c,t)
}
}
DEFINE_SOURCE(conc_source,c,t,dS,equ)
{
real x[ND_ND],c_source;
source= (C_UDSI(c,t,0) + C_UDSI(c,t,0));
return source;
}
Peter_Beshay is offline   Reply With Quote

Old   August 3, 2021, 03:58
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
compile following code,
in fluent GUI:
hook functions,
allocate 1 user define memory

Code:
#include "udf.h"
#include "sg_mem.h"
#include "dpm.h"

int porous_ID = 4;

DEFINE_INIT(my_init_func,d)
{
	cell_t c;
	Thread *t;
	/* loop over all cell threads in the domain */
	thread_loop_c(t,d)
	{
		/* loop over all cells */
		begin_c_loop(c,t)
		{
		C_UDMI(c,t,0) = 0.0;
		}
		end_c_loop_all(c,t)
	}
}

DEFINE_ADJUST(my_adjust,domain)
{
	Thread *t;
	cell_t c;
	t = Lookup_Thread(domain, porous_ID);
	/*Fill UDM with the variable*/

	begin_c_loop(c,t)
	{
		C_UDMI(c,t,0) = C_DPMS_CONCENTRATION(c,t);
	}
	end_c_loop (c,t)
}

DEFINE_SOURCE(conc_source,c,t,dS,equ)
{
	real x[ND_ND],c_source;
	source= (C_UDMI(c,t,0) + C_UDMI(c,t,0));
	return source;
}
Peter_Beshay likes this.
__________________
best regards


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

Old   August 3, 2021, 04:24
Default
  #3
New Member
 
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 4
Peter_Beshay is on a distinguished road
Hi Alexander,
Thank you so much for your help.
I will try this UDF.
Could you clarify what do you mean by hook function? (interpret or compile?)
And how do i allocate 1 user memory?
I am so sorry, i'm just beginner in this
Peter_Beshay is offline   Reply With Quote

Old   August 3, 2021, 04:41
Default
  #4
New Member
 
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 4
Peter_Beshay is on a distinguished road
I have one more question, if i want to also capture the axial velocity at each cell in the porous domain, and include it in the source equation at the end, what should i add more? i am so sorry, i really appreciate your help. you are saving me
Peter_Beshay is offline   Reply With Quote

Old   August 3, 2021, 07:14
Default
  #5
New Member
 
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 4
Peter_Beshay is on a distinguished road
I tried compiling the UDF, i got this error:
///////
Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).\n\nThe system cannot find the file specified.
\n\nD:\NUS\pollutant_study_Prof_Bala\chinese_garde ns_1m_thick_DM_geometry\udf_inlet_trying_depositio n_injecting_from_road_and_inlet\libudf\win64\3ddp_ host\libudf.dll
Error Object: #f
////////
When i interpret the udf, it doesnt generate errors but the solution of the case is the same, it didnt change any numbers.
Could you please help me in this issue?
Thank you
Peter_Beshay is offline   Reply With Quote

Old   August 3, 2021, 11:30
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Check my signature below.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   August 3, 2021, 23:13
Default
  #7
New Member
 
Peter
Join Date: Aug 2021
Posts: 6
Rep Power: 4
Peter_Beshay is on a distinguished road
Hi Pakk,
Thanks for your response.
So how can i solve this issue?
Even when i try "Serial" not parrallel, it generates a similar error, but instead of "(libudf) is not compiled for parallel use on the current platform (win64)." it says not compiled for 3ddp
Peter_Beshay is offline   Reply With Quote

Old   August 4, 2021, 01:45
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
My suggestion is to look at the errors during compiling, and if you need help share them with us.

I can't see what went wrong during compiling from the word during loading. Show the errors that come after you click 'build'.

(and can you suggest an improvement for my signature? Apparently it is not clear enough, but I can't see the problem...)
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Reply

Tags
dpm concentration, particle deposition


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
how fluent calculate terms of momentum equation in porous zone? Weiqiang Liu FLUENT 0 December 4, 2020 02:23
Porous Media Zone Thickness TheKitchenCleaner FLUENT 0 October 5, 2020 00:42
UDF for Species Mass Fraction Gradient *IN SPECIFIC ZONE * -- e.g. along axis of sym. ksiegs2 Fluent UDF and Scheme Programming 0 February 27, 2011 12:55
Problem in IMPORT of ICEM input file in FLUENT csvirume FLUENT 2 September 9, 2009 01:08
Sliding mesh error Karl Kevala FLUENT 4 February 21, 2001 15:52


All times are GMT -4. The time now is 02:05.