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

Computing mass of fluid, sending it to host and working with it

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2018, 07:45
Default Computing mass of fluid, sending it to host and working with it
  #1
New Member
 
Marco
Join Date: Jul 2018
Posts: 5
Rep Power: 8
Kabador is on a distinguished road
Hello guys,

here is my UDF:

#include "udf.h"

real mass=0.0;

DEFINE_EXECUTE_AT_END(calcm)
{

#if !RP_HOST
cell_t c;
Domain *domain = Get_Domain(1);
int id_cellvolume = 3;
Thread *g = Lookup_Thread(domain, id_cellvolume);

begin_c_loop(c, g)
{
mass += C_R(c, g) * C_VOLUME(c, g);
}
end_c_loop(c, g)

mass = PRF_GRSUM1(mass);

#endif //Host

node_to_host_real_1(mass);

printf("Masse: %g\n", mass);
fflush(stdout);
}




DEFINE_PROFILE(p_input_Formen, t, i)
{
face_t f;
cell_t c;
real time = CURRENT_TIME;

begin_f_loop(f, t)
{
if (mass < 0.026)
F_PROFILE(f, t, i) = 101325;
else
F_PROFILE(f, t, i) = 1000;
}
end_f_loop(f, t)
}

i want to adjust the pressure of the pressure inlet depending on the accumulated mass in the volume.
I have one problem:
host is initialized with mass = 0.0, but this data is used as input in the define_profile UDF. I thought i could circumvent this by just sending the summed mass to the host.
But now the mass is summed with every time step and not set to zero, so after 3 time steps it accumulates to an mass amount thats not realistic.

How can i exclude the host from being used here?

Thanks
Kabador is offline   Reply With Quote

Old   October 20, 2018, 08:34
Default
  #2
New Member
 
Marco
Join Date: Jul 2018
Posts: 5
Rep Power: 8
Kabador is on a distinguished road
Or do i have to save the calculated mass in a user memory, C_UDMI?
Kabador 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
[mesh manipulation] Dynamic remeshing (mequite) in parallel not working [foam-extend-4.0] Peter_600 OpenFOAM Meshing & Mesh Conversion 4 August 1, 2017 07:07
Error in Two phase (condensation) modeling adilsyyed CFX 15 June 24, 2015 20:42
Single Bubble Gerrit Senger CFX 4 March 12, 2007 17:29


All times are GMT -4. The time now is 13:45.