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

Temperature Gradient UDF file not compiling

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 14, 2021, 00:43
Default
  #21
New Member
 
Join Date: Mar 2021
Posts: 15
Rep Power: 5
SugarOnichan is on a distinguished road
Thanks for your reply but I have already solved that part.
SugarOnichan is offline   Reply With Quote

Old   March 14, 2021, 00:44
Default
  #22
New Member
 
Join Date: Mar 2021
Posts: 15
Rep Power: 5
SugarOnichan is on a distinguished road
Thanks for your reply but I have already corrected that part.
SugarOnichan is offline   Reply With Quote

Old   March 14, 2021, 00:47
Default
  #23
New Member
 
Join Date: Mar 2021
Posts: 15
Rep Power: 5
SugarOnichan is on a distinguished road
Right now I think I have solved that nmake error. Now whenever I build and load the file I am getting following messages :

https://imgur.com/shobqf9
SugarOnichan is offline   Reply With Quote

Old   March 14, 2021, 01:55
Post Define mass source on boundary cells used UDF
  #24
New Member
 
ssetay
Join Date: Aug 2020
Posts: 6
Rep Power: 5
ssetay is on a distinguished road
Hi, friends

I am using UDF to define a mass source on the boundary cells, here's my code.
My case is this: particles and water flow in a pipe, and I want to define a mass source for the particle phase in the pipe wall cells.
When I compile this UDF, it works normally, but the volume fraction of particles at the wall has not changed. According to my UDF, the volume fraction of the particle phase in the pipe wall cells should be reduced. I don't know where the error is, but the UDF can work well after compilation. Can anyone help me?

//* You are storing source in User defined memory under DEFINE_ON_DEMAND. Then you are using UDMI(c0,t0,0) in DEFINE_SOURCE *//
#include "udf.h"
//get the boundary cells
DEFINE_ON_DEMAND(selecting_the_cells)
{
#if !RP_HOST
Domain *d;
Thread *t, *tc, *t0;
face_t f;
cell_t c, c0;
d = Get_Domain(1);
tc = Lookup_Thread(d, 9); //Get boundary thread, wall zone ID is 9
//Loop through all the cell threads in the domain
thread_loop_c(t, d)
{
//Loop through the cells in each cell thread
begin_c_loop(c, t)
{
C_UDMI(c, t, 0) = 0;
}
end_c_loop(c, t)
}

begin_f_loop(f, tc)
{
c0 = F_C0(f, tc);
t0 = THREAD_T0(tc);
C_UDMI(c0, t0, 0) = 1;
}
end_f_loop(f, tc)
#endif
}

DEFINE_SOURCE(mass_source, c, t, dS, eqn)
{
real source;
if (C_UDMI(c, t, 0) > 0.)
{
source = -1000.;
dS[eqn] = 0.;
}
else
{
source = 0.;
dS[eqn] = 0.;
}
return source;
}
ssetay is offline   Reply With Quote

Old   March 14, 2021, 04:23
Default
  #25
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
You forgot to tell what kind of variable d is.

Domain *d; (if I remember correctly)
__________________
"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   March 14, 2021, 06:00
Default
  #26
New Member
 
Join Date: Mar 2021
Posts: 15
Rep Power: 5
SugarOnichan is on a distinguished road
It is the variable which is used to get the domain in DEFINE_ON_DEMAND macro.
SugarOnichan is offline   Reply With Quote

Old   March 14, 2021, 06:20
Default
  #27
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Yes I know that, but you did not tell Fluent, so you have to add that code.
__________________
"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   March 14, 2021, 08:42
Default
  #28
Member
 
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 19
Yasser is on a distinguished road
Look in your photo ... the error is coming from the 4 lines above "Done"
Yasser is offline   Reply With Quote

Old   March 15, 2021, 00:04
Default
  #29
New Member
 
Join Date: Mar 2021
Posts: 15
Rep Power: 5
SugarOnichan is on a distinguished road
I have solved this error and it is working perfectly. Thank you for all of your help. This is the final code.

Code:
#include "udf.h"

DEFINE_ADJUST(tempgrad,d)
{
	Thread *t;
	cell_t c;
	face_t f;

	thread_loop_c(t, d)
	{
		begin_c_loop(c,t)
		{
			C_UDSI(c,t,0)=NV_MAG(C_T_G(c,t));
		}
		end_c_loop(c,t)
	}
}

DEFINE_ON_DEMAND(store_gradient)
{ 
	Domain *d;
	d = Get_Domain(1);
	cell_t c;
	Thread *t;
	
	thread_loop_c (t,d)
	{
		begin_c_loop (c,t)	
		{
		C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0));
		}
		end_c_loop (c,t)
	}
}
SugarOnichan is offline   Reply With Quote

Old   March 15, 2021, 00:38
Default
  #30
New Member
 
Join Date: Mar 2021
Posts: 15
Rep Power: 5
SugarOnichan is on a distinguished road
UDF is loading and compiling perfectly but I can't seem to find this variable anywhere. Do you know where to look for ?
SugarOnichan is offline   Reply With Quote

Old   March 17, 2021, 21:37
Default
  #31
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
results -> contours -> contours of: user-defined scalar/user-defined memory -> select surface or zone
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 06:47
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44


All times are GMT -4. The time now is 15:22.