1 #include "DriftModel.hxx"
5 int main(int argc, char** argv)
16 Mesh M(xinf,xsup,nx,yinf,ysup,ny);
19 double xcloison1=xinf+(xsup-xinf)/3;
20 double xcloison2=xinf+2*(xsup-xinf)/3;
21 Field barrierField("Barrier Field", FACES, M, 1);
23 M.setGroupAtPlan(xsup,0,eps,"wall");
24 M.setGroupAtPlan(xinf,0,eps,"wall");
25 M.setGroupAtPlan(ysup,1,eps,"outlet");
26 M.setGroupAtPlan(yinf,1,eps,"inlet");
27 double dy=(ysup-yinf)/ny;
30 while( i<= ncloison+1)
32 M.setGroupAtFaceByCoords(xcloison1,yinf+((ysup-yinf)/4)+(i+0.5)*dy,0,eps,"wall");
33 M.setGroupAtFaceByCoords(xcloison2,yinf+((ysup-yinf)/4)+(i+0.5)*dy,0,eps,"wall");
37 int nbFaces=M.getNumberOfFaces();
38 for( i=0;i<nbFaces;i++)
40 double x=M.getFace(i).x();
41 double y=M.getFace(i).y();
42 if (((y> yinf+(ysup-yinf)/4) && (abs(x-xcloison1)< eps or abs(x-xcloison2)< eps) ) || abs(x-xinf)< eps || abs(x-xsup)< eps)
48 barrierField.writeVTK("barrierField",true);
50 // set the limit field for each boundary
51 double wallVelocityX=0;
52 double wallVelocityY=0;
53 double wallTemperature=563;
55 double inletConcentration=0;
56 double inletVelocityX=0;
57 double inletVelocityY=1;
58 double inletTemperature=563;
60 double outletPressure=155e5;
63 vector<double> gravite(spaceDim,0.) ;
67 DriftModel myProblem(around155bars600K,spaceDim);
68 int nVar = myProblem.getNumberOfVariables();
70 // Prepare for the initial condition
71 vector<double> VV_Constant(nVar);
74 VV_Constant[1] = 155e5;
79 //Initial field creation
80 cout << "Building initial data" << endl;
81 myProblem.setInitialFieldConstant(M,VV_Constant);
83 //set the boundary conditions
84 vector<double>pressure_reference_point(2);
85 pressure_reference_point[0]=xsup;
86 pressure_reference_point[1]=ysup;
87 myProblem.setOutletBoundaryCondition("outlet", outletPressure,pressure_reference_point);
88 myProblem.setInletBoundaryCondition("inlet", inletTemperature, inletConcentration, inletVelocityX, inletVelocityY);
89 myProblem.setWallBoundaryCondition("wall", wallTemperature, wallVelocityX, wallVelocityY);
91 // set physical parameters
92 myProblem.setGravity(gravite);
94 // set the numerical method
95 myProblem.setNumericalScheme(upwind, Explicit);
96 myProblem.setWellBalancedCorrection(true);
97 myProblem.setNonLinearFormulation(VFFC);
99 // name of result file
100 string fileName = "2DInclinedChannelGravityBarriers";
102 // computation parameters
103 unsigned MaxNbOfTimeStep = 3 ;
106 double maxTime = 500;
107 double precision = 1e-6;
109 myProblem.setCFL(cfl);
110 myProblem.setPrecision(precision);
111 myProblem.setMaxNbOfTimeStep(MaxNbOfTimeStep);
112 myProblem.setTimeMax(maxTime);
113 myProblem.setFreqSave(freqSave);
114 myProblem.setFileName(fileName);
115 myProblem.usePrimitiveVarsInNewton(true);
118 myProblem.initialize();
120 bool ok = myProblem.run();
122 cout << "Simulation "<<fileName<<" is successful !" << endl;
124 cout << "Simulation "<<fileName<<" failed ! " << endl;
126 cout << "------------ End of calculation !!! -----------" << endl;
127 myProblem.terminate();