function GeneratFluentParticlesInjectionFile()

%

% file format of Fluent injection file:

%The file has the format that you write

%((x y z u v w diameter temperature mass-flow) injection0:ID )

%((# # # # # # # # # # #) injection0:0 ) ((# # # # # # # # # # #) injection0:1 ) ((# # # # # # # # # # #) injection0:2 ) … … … ((# # # # # # # # # # #) injection0:n )

%where # is a number under the unit that you are using.

%

% Input parameter: x, y, z and vel as init condition, only for XYZ coordination

% Current implimentation : rectangular seeding region and linear distribution,

%techniques for debug error:

% 1) always read fresh case and data file without injection

% once reading the file, it will not read in next iteration

% 2) check if the mass-flow is bigger than 0,

% 3) check the injection time: start time and stop time for unsteady flow

% 4) check if the particles are in the domain

% 5) the InjectionName should match in fluent injection panel

x_start=0.0078; x_end=0.0178;

x_count=400;

y_start=0; y_end=0.005;

y_count=200;

x_det=(x_end – x_start)/x_count;

y_det=(y_end – y_start)/y_count;

z_start=0; z_end=0; z_count=1; % for 2D cases

z_det=(z_end – z_start)/z_count;

x_vel=0; % unit m/s

y_vel=0;

z_vel=0;

x_pos=x_start+x_det/2;

y_pos=y_start+y_det/2;

z_pos=z_start+z_det/2;

diameter=1.0e-6; % unit metre, make smallest, flow as

temperature = 293; % unit K default 293

density=997; % unit: kg/m3 this should be identical as flow to be track,

mass_flow =0;

injectionName=’RectangleInjection’;

id=0;

f=fopen(‘RectangleInjection.inj’,’w’);

% initial intro duction field

fprintf(f,'((x y z u v w temperature diameter mass-flow) %s :ID )’,injectionName);

fprintf(f,’n’);

for k=1:z_count

y_pos=y_start+y_det/2;

for j=1:y_count

x_pos=x_start+x_det/2;

for i=1:x_count

mass_flow = (1/6.0*pi)*diameter*diameter*diameter*density; %

fprintf(f,'((%e %e %e %f %f %f %f %f %e) %s : %i )’, x_pos ,y_pos ,z_pos ,x_vel,y_vel, z_vel, temperature,diameter, mass_flow, injectionName,id);

fprintf(f,’n’);

x_pos=x_pos+x_det;

id=id+1;

end

y_pos=y_pos+y_det;

end

z_pos=z_pos+z_det;

end

disp(id);

disp(‘t particles has been seeded’);

fclose(f);