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

c_udmi solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2015, 16:32
Default c_udmi solver
  #1
New Member
 
zahraorveh
Join Date: Oct 2014
Posts: 5
Rep Power: 12
zahraorveh is on a distinguished road
i write this udf

#include "udf.h"
#include "sg.h"
#include "sg_mphase.h"
#include "flow.h"
#include "mem.h"
#include "metric.h"
#include "unsteady.h"

#define K 3.65e-4
#define gama 0.146
#define sigma 4.796e-4
#define alpha 1.935e-3
#define beta 5.7848e-7
#define kx 0.27318
#define kw 0.2
DEFINE_ADJUST(adjust_for_force, domain)
{
Thread **pt;
Thread *t;
cell_t c;
Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,1);
real x,D;
real xc[ND_ND];
begin_c_loop(c,t)
C_CENTROID(xc,c,t);
C_UDMI(c,t,0)=500*exp(-1*(kx*(C_UDSI(c,t,0))+kw)*(0.04-xc[1]));
D=alpha*beta*pow(C_UDMI(c,t,0),2)+(alpha+beta)*sig ma*C_UDMI(c,t,0)+sigma*gama;
C_UDMI(c,t,1)=(sigma*gama+C_UDMI(c,t,0)*beta*sigma )/D;
C_UDMI(c,t,2)=alpha*sigma*C_UDMI(c,t,0)/D;
C_UDMI(c,t,3)=(alpha*beta*pow(C_UDMI(c,t,0),2))/D;
C_UDMI(c,t,4)=K*gama*C_UDMI(c,t,2);

end_c_loop(c,t)

}



it has to calculate 5 c_udmi for each cell of cfd computational cell. but it doesn't work
Attached Images
File Type: jpg ax.jpg (65.5 KB, 18 views)
Attached Files
File Type: c Bioreactor1.c (850 Bytes, 1 views)
zahraorveh is offline   Reply With Quote

Old   August 28, 2015, 19:58
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Is this DEFINE_ADJUST macro being called by the solver; have you hooked it?
`e` is offline   Reply With Quote

Old   August 28, 2015, 21:19
Default
  #3
New Member
 
zahraorveh
Join Date: Oct 2014
Posts: 5
Rep Power: 12
zahraorveh is on a distinguished road
Quote:
Originally Posted by `e` View Post
Is this DEFINE_ADJUST macro being called by the solver; have you hooked it?
Yes,i hooked it and i defined memory location!!!
zahraorveh is offline   Reply With Quote

Old   August 28, 2015, 23:00
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Check which value is being assigned to the UDM with:

Code:
Message("udm-0 = %e\n",500*exp(-1*(kx*(C_UDSI(c,t,0))+kw)*(0.04-xc[1])));
`e` is offline   Reply With Quote

Old   August 29, 2015, 01:21
Default
  #5
New Member
 
zahraorveh
Join Date: Oct 2014
Posts: 5
Rep Power: 12
zahraorveh is on a distinguished road
Quote:
Originally Posted by `e` View Post
Check which value is being assigned to the UDM with:

Code:
Message("udm-0 = %e\n",500*exp(-1*(kx*(C_UDSI(c,t,0))+kw)*(0.04-xc[1])));
Value below 500 has to be assigned to udmi_0!!!!!
But udmi isnt calculated!!!!
zahraorveh is offline   Reply With Quote

Old   September 1, 2015, 05:17
Default
  #6
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
I think you need to add a " thread_loop_c " to your code.
Bruno Machado is offline   Reply With Quote

Old   September 2, 2015, 05:13
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by Bruno Machado View Post
I think you need to add a " thread_loop_c " to your code.
Good observation.
Zahraorveh, didn't you see any compilation warnings/errors? Similar to "warning: variable t undefined"?
pakk is offline   Reply With Quote

Old   September 2, 2015, 05:51
Default
  #8
New Member
 
zahraorveh
Join Date: Oct 2014
Posts: 5
Rep Power: 12
zahraorveh is on a distinguished road
Quote:
Originally Posted by pakk View Post
good observation.
Zahraorveh, didn't you see any compilation warnings/errors? Similar to "warning: Variable t undefined"?
when i compiled it no error i saw!!!!
Can you send me your email to i send my case and data to you???
Have you free time?
zahraorveh is offline   Reply With Quote

Old   September 2, 2015, 06:23
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
No, please don't send me case and data. That will not help anybody.

When I compile it, I see the following:
Quote:
test.c: In function adjust_for_force:
test.c:27: error: sig undeclared (first use in this function)
test.c:27: error: (Each undeclared identifier is reported only once
test.c:27: error: for each function it appears in.)
test.c:27: error: expected ; before ma
test.c:22: warning: unused variable x
test.c:21: warning: unused variable pDomain
test.c:18: warning: unused variable pt
So, no warning/error about t. The biggest problem from here is that you wrote "sig ma" in stead of "sigma".

But that does not change that t is never defined, it only means that the compiler did not catch this problem. Bruno Machado already gave you the solution.
pakk 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
Fluent Adjoint Solver? ex10148 FLUENT 16 September 28, 2018 09:11
thobois class engineTopoChangerMesh error Peter_600 OpenFOAM 4 August 2, 2014 10:52
Divergence problem Smaras FLUENT 13 February 21, 2013 06:03
3d vof Smaras FLUENT 2 February 19, 2013 07:58
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 15:08


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