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

UDF at the end

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 2, 2019, 02:47
Default UDF at the end
  #1
Member
 
Andrea
Join Date: Mar 2018
Posts: 62
Rep Power: 8
Andrea159357 is on a distinguished road
Hello,
i'm trying to define fluid density as a function of temperature and salinity (UDS0). Since has 2 parameters i need to define it at the end of the iteration.
i wrote this but it's not working.
Someone can help me?
thanks


#include "udf.h"
#define a0 999.842594
#define a1 6.793953e-2
#define a2 -9.095290e-3
#define a3 1.001685e-4
#define a4 -1.120083e-6
#define a5 6.536332e-9

#define b0 8.2449e-1
#define b1 -4.0899e-3
#define b2 7.6438e-5
#define b3 -8.2467e-7
#define b4 5.3875e-9

#define c0 -5.7246e-3
#define c1 1.0227e-4
#define c2 -1.6546e-6
#define d0 4.8314e-4



real Temp , S , rho0 , B1 , C1 , rho;

DEFINE_EXECUTE_AT_END(Density)

{
Domain *d;
Thread *t;
cell_t c;

d = Get_Domain(1);


thread_loop_c(t,d);

{
begin_c_loop(c,t);

{
Temp = C_T(c,t);

S = C_UDSI(c,t,0);

rho0 = a0 + a1*Temp + a2*pow(Temp,2) + a3*pow(Temp,3) + a4*pow(Temp,4) + a5*pow(Temp,5);

B1 = b0 + b1*Temp + b2*pow(Temp,2) + b3*pow(Temp,3) + b4*pow(Temp,4);

C1 = c0 + c1*Temp + c2*pow(Temp,2);

rho = rho0 + B1*S + C1*pow(S,1.5) + d0*pow(S,2);


end_c_loop(c,t);
}
}


}
Andrea159357 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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
CFD analaysis of Pelton turbine amodpanthee CFX 31 April 19, 2018 18:02
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 05:21
Centrifugal fan-reverse flow in outlet lesds to a mass in flow field xiexing CFX 3 March 29, 2017 10:00
Ansys CFX problem: unexpected very high temperatures in premix laminar combustion faizan_habib7 CFX 4 February 1, 2016 17:00


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