CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Rotating detonation simulation——boundary setting (https://www.cfd-online.com/Forums/openfoam/242689-rotating-detonation-simulation-boundary-setting.html)

studentchen May 5, 2022 09:16

Rotating detonation simulation——boundary setting
 
Dear friends,
I am doing 3D rotating detonation simulation,the difficulty is the inlet boundary depends on different pressure:

when pw > p0, the reactants can not be injected into the chamber.
when p0 >pw > pcr, the inlet flow is not choked,completes subsonic injection.
when pw < pcr < p0,it is a sonic injection .

I hava used groovyBC of swak4Foam,but the results is bad.

Could anyone give me some advices and help?

Thanks very much!

homeros April 21, 2024 18:17

#include "udf.h"
DEFINE_PROFILE(my_pressure_inlet_mf,thread,i)
{

face_t f;
cell_t c0;
Thread *tc0;

real p;
real po;
real pcr;
real To;
real gamma;
real R;

R = 368.9; // J/kg k
gamma = 1.29;

po = 1000000;
pcr = po * pow( (2/(gamma+1)), (gamma/(gamma-1)) );
To = 300;

begin_f_loop(f,thread)
{
c0 = F_C0(f,thread);
tc0 = THREAD_T0(thread);
p = C_P(c0,tc0); //pressure near wall

if(p >= po) // where boundary is gonna be set as wall
{
F_PROFILE(f,thread,i) = 0.0000001; // no source term case
F_U(f,thread)=0;
F_V(f,thread)=0;
F_W(f,thread)=0;
}

else if(p > pcr && p < po)
{
F_PROFILE(f,thread,i) = p;
F_U(f,thread) = sqrt( (2*gamma/(gamma-1)) *R*To * (1 - pow(p/po, (gamma-1)/gamma)) );
F_T(f,thread) = To*pow( p/po, (gamma-1)/gamma);
}

else if(p <= pcr)
{
F_PROFILE(f,thread,i) = pcr;
F_U(f,thread) = sqrt( (2*gamma/(gamma-1)) *R*To * (1 - pow(p/po, (gamma-1)/gamma)) );
F_T(f,thread) = To*pow( p/po, (gamma-1)/gamma) ;
}

}
end_f_loop(f,thread)

}

You can change parameters. This is an udf for fluent btw.


All times are GMT -4. The time now is 15:06.