# 2D rotating detonation simulation - UDF inlet BC

Member

Hi guys,

I am doing 2D rotating detonation engine (RDE) simulation in ANSYS Fluent.
For pressure inlet boundary condition, there are three possible cases:
1. Pi > Po, where Pi is the pressure inside the domain immediately at the inlet and Po is the total inflow pressure. In this case the pressure inside the RDE at this point is very high and blocks inflow of new mixture through the inlet face. The inlet boundary acts as a wall.
2. Pcr < Pi < Po, where Pcr is the critical pressure. In this case the inlet is not chocked and new mixture flows into the RDE according to: mass flow rate = the integral of (rho*u*dA).
3. Pi < Pcr, in this case the pressure inside the domain is low. The inlet at this point is choked, so maximum flow rate of fuel is flowing into the domain. Pcr is calculated from isentropic relation.

My UDF (mass flow rate inlet BC) compiles successfully which means the code is grammatically correct. When I tried to initialise the solution, errors appeared.

I tried standalone mode of Fluent, it also didn't work...

Could someone help me with this?

## Comments

• Member
edited July 23

Errors are the following:

Node 0: Process 3524: Received signal SIGSEGV.

================================================== ============================
================================================== ============================

Node 1: Process 10032: Received signal SIGSEGV.

================================================== ============================
================================================== ============================

Node 2: Process 11508: Received signal SIGSEGV.

================================================== ============================
================================================== ============================

Node 3: Process 12336: Received signal SIGSEGV.

================================================== ============================

999999: mpt_accept: error: accept failed: No error

999999: mpt_accept: error: accept failed: No error

999999: mpt_accept: error: accept failed: No error

999999: mpt_accept: error: accept failed: No error

999999: mpt_accept: error: accept failed: No error
MPI Application rank 0 exited before MPI_Finalize() with status 2
The fl process could not be started.

• GermanyForum Coordinator
edited July 23

Code might compile good but be completely wrong and having un-allowed access. Try to debug your UDF line by line.

Moreover I do not understand: area you adjusting a pressure inlet condition or mass flow inlet?

• Member
edited July 23

Hi,

Thanks for the reply!

I'm adjusting a mass flow inlet.

• Member
edited July 23

Sorry for the confusion

• Member
edited July 23

Hi @Amine

The code is completely wrong, would you mind being more specific? Am I using wrong macro, or it's logically wrong? I'm quite helpless with this.

Sincerely,

Tianxu

• Member
edited July 23

Here is my code:

#include "udf.h"

DEFINE_PROFILE(inlet_mf,th,i)

{

face_t f;

cell_t c;

Domain *d = Get_Domain(1);

Thread * t = Lookup_Thread(d,5);

real pw;

real po;

real pcr;

real To;

real gamma;

real v;

real vmas;

real R;

real rho1;

real rho2;

real area;

real A[ND_ND];

R = 368.9;

gamma = 1.29;

po = 1013250;

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

To = 300;

vmax = sqrt( (2*gamma/(gamma+1)) *R*To );

begin_f_loop(f,th)

{

pw = F_P(f,th);

F_AREA(A,f,th);

area = NV_MAG(A);

if(pw >= po)

{

F_PROFILE(f,th,i) = 0.0000001;

}

else if(pw > pcr && pw < po)

{

v = sqrt( (2*gamma/(gamma-1)) *R*To * (1 - pow(pw/po, (gamma-1)/gamma)) );

rho1 = F_R(f,th);

F_PROFILE(f,th,i) = rho1*v*area;

}

else if(pw <= pcr)

{

rho2 = F_R(f,th);

F_PROFILE(f,th,i) = rho2*vmax*area;

}

}

end_f_loop(f,th)

}

• GermanyForum Coordinator
edited July 23

That is the right macro but does it make a sense to it for high compressible flow: I will general use pressure inlet for this cases. Does the crash occri right awy after starting the run or direct after initialization? Moreover I do not think you can use F_R: you need to get the value from the cell.

• Member
edited July 24

Hi,

The crash happened after initialization.

I also tried initialise the case with some constant mass flow at inlet boundary and then hook the UDF, but the same error appeared.

I modified the code to get the density value from the cell by using C_R, the same error appeared again...

• GermanyForum Coordinator
edited July 24

Last comment here as we do not debug UDF: you can add line in the beginning in your DEFINE_PROFILE checking if data is valid or not. if not try to use dummy values.

Sign In or Register to comment.