|
[Sponsors] |
Computing mass of fluid, sending it to host and working with it |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 20, 2018, 07:45 |
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 |
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 |
|
October 20, 2018, 08:34 |
|
#2 |
New Member
Marco
Join Date: Jul 2018
Posts: 5
Rep Power: 8 |
Or do i have to save the calculated mass in a user memory, C_UDMI?
|
|
|
|
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 |