assigning specific value for mass in domain
Is there an option in Fluent where I can assign a Specific value for the mass in the domain? To be more specific, I am trying to supply mass in the domain (exactly 0.04 KG) of the particle into the system and trying to stop the simulation to see the exact time step needed for that time.
How can I do that so that I don't supply more mass to the system than I wanted.?
Thanks
Answers
Through a UDF
Make a global variable to save the amount of mass injected ... and pass a variable to the solver, and set a convergence criteria based on this variable.
there was a post here before where someone wanted to stop the simulation from the UDF .. search for it
I never did the UDF before. I want to stop it when the mass in the domain reaches 0.04 kg.
I tried this UDF . Does this look even right???
#include "udf.h"
#include "var.h"
DEFINE_MASS_IN_DOMAIN(interrupt_sim,d)
{
Thread*t= Lookup_Thread(domain.ID);
cell_t c;
int x = 0;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if (c_t(c,t)=0.04)
{
x=1;
break;
}
}
end_f_loop(f,t)
break;
}
x=PRF_GIHIGH1(X);
if(X==1)
RP_set_integer(interrupt/flag",1);
}
First, is there a macro called DEFINE_MASS_IN_DOMAIN ?? there are tons of macros that loops over the DPM ... go to the manual and select the one that fits your function. I am not sure which one, but if you did not find one, define adjust would be your last choice
Second, and I will try to explain this clearly because of the forum closure, I will not be able to reply in the coming day ... in the scheme, create a real variable let's say you call it "stop_order" ... and in your UDF you create a global variable .. let's say "order_to_stop" ... and in your function you put IF statement to change this variable every timestep ... and when the condition is met, you keep this variable without change. And pass this variable to the solver every time step using RP_Set_Real ... Now in the monitors, residuals, add convergence criteria for this variable to stop iterations when this variable converge
Third PRF_GRSUM1(x) is the macro you need to parallelize global sum, not PRF_GIHIGH1(X) .
Hello @YasserSelima ,
Thank you very much for your support and help. I appreciate your help.
I totally understand about the forum disclosure thing. we all have to maintain that forum policy as well.