main.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. // THIS IS A RAW SPARSELIZARD CODE FILE!
  2. // VALIDATED CODE BUT NOT CLEANED
  3. // PLEASE REFER TO OTHER EXAMPLES FOR A SMOOTH SPARSELIZARD INTRODUCTION
  4. // CREDITS: R. HAOUARI
  5. // Time simulation of a thermaoacoustic wave propagation
  6. // Cylindrical wave created by a volumic heat source ( models laser beam)
  7. // Thermoviscouss acoustics assumed
  8. // Mechanical coupling with a glass membrane and radiation simulated as well
  9. #include "sparselizardbase.h"
  10. #include <iostream>
  11. #include <fstream>
  12. #include <string>
  13. using namespace std;
  14. using namespace mathop;
  15. // Arguments are:
  16. // r cavity, membrane radius
  17. // depth cavity depth
  18. // thick membrane thickness
  19. // BLth thickness of the boundary layer
  20. mesh createmesh(double rmb, double depth, double thick, double BLth);
  21. void sparselizard(void)
  22. {
  23. //Save folder
  24. std::string savefolder="./data/";
  25. wallclock clk;
  26. clock_t start=clock();
  27. // Axisymmetric assumption:
  28. setaxisymmetry();
  29. //Geometry
  30. //---------
  31. // Define the geometric dimensions [m]:
  32. double r = 500e-6, thick = 5e-6, depth = 750e-6, BLth=10e-6;
  33. //axis region set to avoid weird stuff in calculation
  34. double caxis=1e-6;
  35. // The domain regions as defined in 'createmesh':
  36. int membrane = 1, KviT = 2, topair = 3, wall=4, laser=5, BL=6 , clamp=8,axis=9 , outair=10,outrad=11,botcoupl=12, P1=13,P2=14, topcoupl=15; ;
  37. // Create the geometry and the mesh:
  38. mesh mymesh = createmesh(r,depth,thick,BLth);
  39. // Write the mesh for display:
  40. mymesh.write(savefolder+"geometry.msh");
  41. // Define additional regions:
  42. int fluid = regionunion({KviT,outair});
  43. int mechacoucoupl = regionintersection({fluid,membrane});
  44. int slip = regionunion({botcoupl,wall});
  45. //normal tracking (for better BC setting... if needed)
  46. normal(regionunion({axis,wall,botcoupl})).write(regionunion({axis,wall,botcoupl}),savefolder+"normal.vtu");
  47. parameter nsign;
  48. nsign|axis=1;
  49. nsign|wall=1;
  50. nsign|botcoupl=-1;
  51. expression nor=(nsign*normal(slip));
  52. nor.write(regionunion({axis,wall,botcoupl}),savefolder+"fixed_normal.vtu");
  53. //Unknown fields defintion
  54. //--------------------------
  55. field u("h1xyz"),v("h1xyz"), p("h1"),T("h1"), y("y"),x ("x"),L("h1xyz");
  56. //Setting interpolation order :
  57. u.setorder(membrane, 2);
  58. v.setorder(KviT, 2);
  59. p.setorder(fluid, 1);
  60. T.setorder(KviT, 2);
  61. //Lagragian multipliers , vectorial form
  62. L.setorder(botcoupl,2);
  63. //gas material properties around equilibrium ( 293 K and 1 Bar ) - Linear approximation in comment
  64. //---------------------------------------------------------------------------------------------
  65. expression rho0, muB,lmb,kappa,gamma,Cp,c,alpha_p,beta,rhot;
  66. double R_const=8.3144598,Rs=287;
  67. double p0=1.013e5,T0=293;
  68. rho0=(p0)*0.02897/(R_const*(T0));//(p+p0)*0.02897/(R_const*(T+T0));//-(T)*0.00431073+1.20494464330308;
  69. lmb=-8.38278E-7+8.35717342E-8*(T0)-7.69429583E-11*pow(T0,2)+4.6437266E-14*pow(T0,3)-1.06585607E-17*pow(T0,4);//(T)*4.99221E-08+1.81322817E-05;
  70. muB=0.6*lmb;//(T)*2.99532E-08+1.08793690E-05;
  71. kappa=-0.00227583562+1.15480022E-4*(T0)-7.90252856E-8*pow(T0,2)+4.11702505E-11*pow(T0,3)-7.43864331E-15*pow(T0,4);//(T)*7.96428E-05+2.57563324E-02;
  72. gamma=1.4;//-(T)*1.8214E-05+1.39948988;
  73. Cp=1047.63657-0.372589265*(T0)+9.45304214E-4*pow(T0,2)-6.02409443E-7*pow(T0,3)+1.2858961E-10*pow(T0,4);//(T)*0.032741694+1.00541619E+03;
  74. c=sqrt(1.4*R_const/0.02897*(T0));//(T)*0.589990819+343.051751;
  75. alpha_p=sqrt(Cp*(gamma-1)/T0)/c;
  76. beta=gamma/(rho0*pow(c,2));
  77. rhot=rho0*(beta*(p+p0)-alpha_p*(T+T0));
  78. // Membrane properties: Young modulus, Poisson's ratio and volumic mass
  79. //----------------------------------------------------------------------
  80. //parameter E, nu, rho;
  81. double Es = 73.1e9,nus= 0.17;
  82. parameter rho;
  83. rho|membrane = 2203;
  84. rho|fluid= rho0;
  85. //incorporates the fluid volumic mass in the "parameter" container
  86. //Creation of the weak form object
  87. //-----------------------------------
  88. formulation chambre;
  89. //Scaling factor for numerical conditionning (if needed)
  90. //-----------------------------------------------------------
  91. double scaling = 1e0;
  92. // Standard isotropic elasticity
  93. //-------------------------------
  94. chambre += integral(membrane, predefinedelasticity(dof(u), tf(u),Es, nus) );
  95. //Inertial term:
  96. chambre += integral(membrane, -rho*dtdt(dof(u))*tf(u) );
  97. //Mass conservation
  98. //--------------------
  99. chambre += integral(KviT,(rho*div(dof(v))+rho*(beta*(dt(dof(p)))-alpha_p*(dt(dof(T)))))*tf(p) );
  100. //Navier-Stokes
  101. //--------------
  102. chambre += integral(KviT,-rho*dt(dof(v))*tf(v));
  103. chambre += integral(KviT,-grad(dof(p))*tf(v));
  104. chambre += integral(KviT,-lmb*(frobeniusproduct(grad(dof(v)),grad(tf(v)))+frobeniusproduct(transpose(grad(dof(v))),grad(tf(v)))));
  105. chambre += integral(KviT,(2*lmb/3-muB)*div(dof(v))*trace(grad(tf(v))) );
  106. //non linearity terms of NS
  107. //expression(v).reuseit();
  108. //chambre += integral(fluid,-rho*( grad(v)*dof(v) + grad(dof(v))*v - grad(v)*v )*tf(v));
  109. //thermal process
  110. //----------------
  111. chambre+=integral(KviT,kappa*grad(dof(T))*grad(tf(T)));
  112. chambre+=integral(KviT,(-alpha_p*T0*dt(dof(p))+rho*Cp*dt(dof(T)))*tf(T));
  113. //laser heat source in the cavity volume
  114. //-----------------------------------------
  115. double shift=.5e-6,pulsewidth=1e-7,waist=100e-6,absp=1,power=1;
  116. //spatial shape
  117. expression laser_shape=power*2/(getpi()*pow(waist,2))*pow(2.71828,-2*pow(x/waist,2));
  118. //gausian time pulse
  119. expression time_shape=pow(2.71828,-pow(getpi()/pulsewidth*(t()-shift),2));//
  120. //square time pulse
  121. //expression time_shape(t()-(shift-pulsewidth/2),expression(-t()+(shift+pulsewidth/2),power/pulsewidth,0),0);
  122. //Beert-Lambert law for absorption
  123. chambre+=integral(KviT,-absp*pow(2.71828,absp*y)*laser_shape*time_shape*tf(T));
  124. // The elastic wave propagation equation
  125. //------------------------------------------
  126. chambre += integral(outair, -grad(dof(p))*grad(tf(p)) -1/pow(c,2)*dtdt(dof(p))*tf(p));
  127. // A Sommerfeld condition is used on the fluid boundary to have outgoing waves:
  128. chambre += integral(outrad, -1/c*dt(dof(p))*tf(p));
  129. // Elastoacoustic coupling terms.
  130. //-----------------------------------
  131. //stress transmission from fluid to solid along the normal (carreful normal direction for the sign !!!)
  132. chambre += integral(botcoupl, dof(p)*normal(mechacoucoupl)*tf(u) );
  133. //Use of Lagrange multipliers Lx and Ly to link membrane and fluid velocity
  134. //Vectorial form for ease of implementation
  135. chambre += integral(botcoupl, -dof(L)*tf(u));
  136. chambre += integral(botcoupl, dof(L)*tf(v));
  137. chambre += integral(botcoupl, (dt(dof(u))-dof(v))*tf(L));
  138. //Coupling for the upper region (pure mechanical)
  139. chambre += integral(topcoupl, -dof(p)*normal(topcoupl)*tf(u) * scaling);
  140. chambre += integral(topcoupl, rho0*normal(topcoupl)*dtdt(dof(u))*tf(p)/scaling);
  141. //Constrained type boundary conditions
  142. //--------------------------------------
  143. //membrane clamped on the clamp line:
  144. u.setconstraint(clamp);
  145. //no slip on the wall
  146. v.setconstraint(wall);
  147. //isothermal on the interfaces
  148. T.setconstraint(regionunion({botcoupl,wall}));
  149. //symmetry (axial case : for pure 2D, not in axisym)
  150. //v.compx().setconstraint(axis);
  151. //u.compx().setconstraint(axis);
  152. //No Lz Lagrange multiplier
  153. L.compz().setconstraint(mechacoucoupl);
  154. //Slip BC
  155. //------------
  156. //
  157. //set non-zero initial values : T0 and p0
  158. //-----------------------------------------
  159. //T.setvalue(fluid,T0);
  160. //p.setvalue(fluid,p0);
  161. vec init(chambre);
  162. //init.setdata(fluid,T);
  163. //init.setdata(fluid,p);
  164. // Define the Gen alpha object to time-solve formulation 'chambre'
  165. //------------------------------------------------------------------
  166. genalpha gena(chambre, init, vec(chambre), vec(chambre), {false,true,true,true});
  167. gena.setparameter(0.75);
  168. gena.settolerance(1e-10);
  169. //variable time stepping resolution
  170. //--------------------------------------
  171. //create as many vectors as different time steps
  172. //each time the last timestep is not computed, start the next one with the previous last one
  173. std::vector<std::vector<double>> timesteping;
  174. timesteping={
  175. //{0,10e-9,4e-6,10}
  176. // different time steps
  177. {0,.01e-6,4.999e-6,10}
  178. ,{5e-6,.05e-6,14.99e-6,2}
  179. ,{15e-6,.1e-6,24.99e-6,1}
  180. ,{25e-6,.25e-6,99.99e-6,1}
  181. //,{100e-6,1e-6,1e-3,10}
  182. };
  183. //parsing for file handling
  184. //------------------------------------
  185. //evaluate the total amount of steps to be computed and written
  186. int tot_steps=0;
  187. int tot_steps_rec=0;
  188. double temp;
  189. for(int i=0; i<timesteping.size() ; i++)
  190. {
  191. temp=(timesteping[i][2]-timesteping[i][0])/(timesteping[i][1]);
  192. tot_steps += 1+floor(temp);
  193. tot_steps_rec += 1+floor(temp/timesteping[i][3]);
  194. }
  195. std::cout<<"total time steps to be computed: "<< std::to_string(tot_steps)<< std::endl;
  196. std::cout<<"total time steps to be recorded: "<< std::to_string(tot_steps_rec)<< std::endl;
  197. //create a string with the same number of zeros as digits in the total amount of steps
  198. std::string init_num_file=std::to_string(tot_steps_rec);
  199. for(int i=0; i < init_num_file.size() ; i++)
  200. {
  201. init_num_file[i]='0';
  202. }
  203. //create probe object
  204. //-----------------------
  205. //create a record file for the probe and set it
  206. std::string filename=savefolder+"my_probes.txt";
  207. ofstream probes;
  208. probes.open(filename);
  209. //the 2 first column are reserved
  210. probes << "step "<<"time ";
  211. //define here the names of each of your probes, and use a tab after each name
  212. probes <<"max p " <<"max T "<<"max v_f "<<"max u_mb "<<"max v_mb "<<"norm v "<<"norm p "<<"norm T";
  213. probes << endl;
  214. probes.close();
  215. //Create time stepping pvd file which register each vtu file to its own time
  216. //-----------------------------------------------------------------------------
  217. std::string filename2=savefolder+"times.pvd";
  218. ofstream timeorder;
  219. timeorder.open(filename2);
  220. //the 2 first column are reserved
  221. timeorder << "<?xml version=\"1.0\"?>\n";
  222. timeorder << "<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
  223. timeorder << " <Collection>\n";
  224. probes.close();
  225. //initiate solution vectors
  226. std::vector<std::vector<vec>> ssol(timesteping.size());
  227. std::vector<std::vector<vec>> solution(timesteping.size());//this one is for the field F
  228. std::vector<std::vector<vec>> solution2(timesteping.size());//that one for dF/dt
  229. wallclock clk2;
  230. int index=0;
  231. //initiate a vector for tracking all the saved time steps
  232. std::vector<double> times(tot_steps);
  233. //extra field for display v_membrane
  234. field dtu("h1xyz");
  235. dtu.setorder(membrane, 2);
  236. for (int i=0;i<timesteping.size();i++)
  237. {
  238. clk2.tic();
  239. //Linear or Non-linear solvers
  240. ssol=gena.runlinear(timesteping[i][0], timesteping[i][1], timesteping[i][2], timesteping[i][3]);
  241. //ssol=gena.runnonlinear(timesteping[i][0], timesteping[i][1], timesteping[i][2],-1, timesteping[i][3],1);
  242. //assigning from vector solution for:
  243. //field F [0], [1] dF/dt [2] d2F/dt2
  244. solution[i]=ssol[0];
  245. solution2[i]=ssol[1];
  246. std::cout << "File_batch/probes written :"<< std::flush;
  247. for (int ts = 0; ts < solution[i].size(); ts++)
  248. {
  249. // Transfer the data to the field:
  250. u.setdata(membrane, solution[i][ts]);
  251. dtu.setdata(membrane,(solution2[i][ts]|u));
  252. v.setdata(KviT, solution[i][ts]);
  253. p.setdata(fluid, solution[i][ts]);
  254. T.setdata(KviT, solution[i][ts]);
  255. //L.setdata(mechacoucoupl, solution[i][ts]);
  256. //parsing file number
  257. std::string indecs=std::to_string(index);
  258. std::string num_file=init_num_file;
  259. //file number written
  260. for (int i=1;i<=indecs.size();i++)
  261. {
  262. num_file[num_file.size()-i]=indecs[indecs.size()-i];
  263. }
  264. // Write with an order 2 interpolation and with the name of your choice (the name is also the relative path)
  265. u.write(membrane, savefolder+"u"+num_file+".vtu",2);
  266. //dtu.write(membrane, savefolder+"dtu"+num_file+".vtu",2);
  267. v.write(KviT, savefolder+"v"+num_file+".vtu",2);
  268. p.write(KviT, savefolder+"pch"+num_file+".vtu",2);
  269. p.write(outair, savefolder+"pout"+num_file+".vtu",2);
  270. T.write(KviT, savefolder+"T"+num_file+".vtu",2);
  271. times[index]=timesteping[i][0]+ts*timesteping[i][3]*timesteping[i][1];
  272. timeorder.open(filename2, std::ios_base::app);
  273. timeorder << " <DataSet timestep=\"" << times[index] << "\" part=\"0\"\n";
  274. timeorder << " file=\"pch"+num_file+".vtu\"/>\n";
  275. timeorder << " <DataSet timestep=\"" << times[index] << "\" part=\"0\"\n";
  276. timeorder << " file=\"pout"+num_file+".vtu\"/>\n";
  277. timeorder << " <DataSet timestep=\"" << times[index] << "\" part=\"0\"\n";
  278. timeorder << " file=\"T"+num_file+".vtu\"/>\n";
  279. timeorder << " <DataSet timestep=\"" << times[index] << "\" part=\"0\"\n";
  280. timeorder << " file=\"v"+num_file+".vtu\"/>\n";
  281. timeorder << " <DataSet timestep=\"" << times[index] << "\" part=\"0\"\n";
  282. timeorder << " file=\"u"+num_file+".vtu\"/>\n";
  283. timeorder << " <DataSet timestep=\"" << times[index] << "\" part=\"0\"\n";
  284. timeorder << " file=\"dtu"+num_file+".vtu\"/>\n";
  285. timeorder.close();
  286. //compute probes values and record it in the file
  287. //open the file
  288. probes.open(filename, std::ios_base::app);
  289. probes.precision(15);
  290. //step and time index are first
  291. probes << index <<" "<< times[index] << " ";
  292. // put then each expression with the same order than their definition
  293. probes << expression(p).max(KviT,5)[0] <<" " ;
  294. probes << expression(T).max(KviT,5)[0] <<" " ;
  295. probes << expression(sqrt(v.compy()*v.compy()+v.compx()*v.compx())).max(KviT,5)[0] <<" " ;
  296. probes << norm(v).integrate(KviT, 5) << " " ;
  297. probes << norm(p).integrate(KviT, 5) << " " ;
  298. probes << norm(T).integrate(KviT, 5) ;
  299. //probes << expression(sqrt(u.compy()*u.compy()+u.compx()*u.compx())).max(membrane,5)[0]<<" " ;
  300. //probes << expression(dtu.compy()).max(membrane,5)[0] ;
  301. //end the line
  302. probes << endl;
  303. //close the file
  304. probes.close();
  305. index++;
  306. std::cout <<" "<< index << std::flush;
  307. }
  308. std::cout << std::endl;
  309. clk2.print("step took: ");
  310. }
  311. timeorder.open(filename2, std::ios_base::app);
  312. timeorder << "</Collection>\n";
  313. timeorder << "</VTKFile>\n";
  314. timeorder.close();
  315. clk.print("Total time elapsed: ");
  316. probes.open(filename, std::ios_base::app);
  317. probes << endl << endl <<"Total time elapsed: "<< clk.toc()/1e9 << " sec" << endl;
  318. probes.close();
  319. }
  320. // THE MESH BELOW IS FULLY STRUCTURED AND IS CREATED USING THE (BASIC) SPARSELIZARD GEOMETRY CREATION TOOL.
  321. // BOUNDARY LAYER IS ALSO INCLUDED AS WELL AS A CLOSE LINE TO THE Z-AXIS TO ACT AS THE REVOLUTION AXE
  322. mesh createmesh(double rmb, double depth, double thick, double BLth)
  323. {
  324. //closeness of the axis
  325. double caxis=1e-6, rarc=2e-3;
  326. // Give names to the physical region numbers:
  327. int membrane = 1, KviT = 2, topair = 3, wall=4, laser=5, BL=6 , clamp=8,axis=9 , outair=10,outrad=11,botcoupl=12, P1=13,P2=14, topcoupl=15; ;
  328. // Number of mesh layers:
  329. int nxmb = 49, nzmb = 4, nzKviT = 73, nair = 50, nBLth=10;
  330. // define a vector of nodes along a vertical line
  331. std::vector<double>KviT_vpoints(3*(nzKviT+2*nBLth+1));
  332. double step1=sqrt(BLth)/nBLth, step2=(depth-2*BLth)/nzKviT;
  333. // nodes are spaced accordignly to have a boundary layer mesh
  334. for( int i=0;i<KviT_vpoints.size()/3;i++)
  335. {
  336. if(i<=nBLth)
  337. {
  338. // if linear BL :/*i*BLth/nBLth*/
  339. KviT_vpoints[3*i]=0;KviT_vpoints[3*i+1]=-std::pow(i*step1,2);KviT_vpoints[3*i+2]=0;
  340. //std::cout<<i<<" "<<-std::pow(i*step1,2)<<std::endl;
  341. }
  342. else
  343. {
  344. if(i> nBLth && i<=nBLth+nzKviT)
  345. {
  346. KviT_vpoints[3*i]=0;KviT_vpoints[3*i+1]=-BLth-(i-nBLth)*step2;KviT_vpoints[3*i+2]=0;
  347. }
  348. else
  349. {
  350. // if linear BL :-(i-nzKviT-2*nBLth)*BLth/nBLth
  351. KviT_vpoints[3*i]=0;KviT_vpoints[3*i+1]=-depth+std::pow((i-nzKviT-2*nBLth)*step1,2);KviT_vpoints[3*i+2]=0;
  352. }
  353. }
  354. }
  355. KviT_vpoints[3*(nzKviT+2*nBLth)]=0;KviT_vpoints[3*(nzKviT+2*nBLth)+1]=-depth;KviT_vpoints[3*(nzKviT+2*nBLth)+2]=0;
  356. // define a vector of nodes along a horizontal line
  357. std::vector<double>KviT_hpoints(3*(2+nxmb+nBLth+1));
  358. step1=sqrt(BLth)/nBLth;
  359. step2=(rmb-BLth-caxis)/(nxmb);
  360. //special node for the axis ; should be smaller than one node
  361. KviT_hpoints[0]=0;KviT_hpoints[1]=0;KviT_hpoints[2]=0;
  362. KviT_hpoints[3]=caxis;KviT_hpoints[4]=0;KviT_hpoints[5]=0;
  363. for( int i=2;i<KviT_hpoints.size()/3;i++)
  364. {
  365. if(i<=nxmb)
  366. {
  367. KviT_hpoints[3*i]=caxis+(i-1)*step2;KviT_hpoints[3*i+1]=0;KviT_hpoints[3*i+2]=0;
  368. }
  369. else
  370. {
  371. // if linear BL : (i-2-nxmb-nBLth)*BLth/nBLth
  372. KviT_hpoints[3*i]=rmb-std::pow((i-2-nxmb-nBLth)*step1,2);KviT_hpoints[3*i+1]=0;KviT_hpoints[3*i+2]=0;
  373. }
  374. }
  375. // define lines with nodes predefined in previous vectors
  376. shape ligne1("line",axis,KviT_vpoints);
  377. shape ligne2("line",botcoupl,KviT_hpoints);
  378. shape ligne3("line",-1,KviT_vpoints);
  379. shape ligne4("line",-1,KviT_hpoints);
  380. ligne3.shift(rmb,0,0);
  381. ligne4.shift(0,-depth,0);
  382. //printvector(ligne1.getcoords());
  383. //printvector(ligne2.getcoords());
  384. // derive rectangle with boundary layer
  385. shape nK("quadrangle",KviT,{ligne1,ligne4,ligne3,ligne2});
  386. //shape nK("quadrangle",KviT,{0,0,0,0,-depth,0,rmb,-depth,0,rmb,0,0},{nzKviT,nxmb,nzKviT,nxmb});
  387. shape ligne5("line",topcoupl,KviT_hpoints);
  388. ligne5.shift(0,thick,0);
  389. shape ligne6("line",clamp,{rmb,0,0,rmb,thick,0},nzmb);
  390. shape ligne7("line",-1,{rmb,0,0,rmb,thick,0},nzmb);
  391. ligne7.shift(-rmb,0,0);
  392. // axis line defined for formulation
  393. shape mb("quadrangle",membrane,{ligne7,ligne2,ligne6,ligne5});
  394. //shape laxe=ligne1.duplicate();
  395. //laxe.shift(caxis,0,0);
  396. //laxe.setphysicalregion(axis);
  397. // walls definition
  398. shape walline("union",wall,{ligne4,ligne3});
  399. //std::cout<<KviT_hpoints.size()/3<<" "<< 3+nxmb+nBLth<<" "<<sin(3.14/4)<<endl;
  400. double angle=3.1415/20;
  401. shape quart("arc",outrad,{rarc*cos(angle),rarc*sin(angle)+thick,0,0,thick+rarc,0,0,thick,0},3+nxmb+nBLth);
  402. shape ligne8("line",-1,{0,thick,0,0,rarc,0},nair);
  403. shape ligne9("line",outrad,{rmb,thick,0,rarc*cos(angle),thick+rarc*sin(angle),0},nair);
  404. shape out("quadrangle",outair,{ligne8,ligne5,ligne9,quart});
  405. shape Po1 = ligne2.getsons()[0];
  406. Po1.setphysicalregion(P1);
  407. shape Po2 = ligne2.getsons()[1];
  408. Po2.setphysicalregion(P2);
  409. mesh mymesh({nK,mb,ligne1,ligne2,ligne5,ligne6,walline,quart,ligne9,out,Po1,Po2});
  410. //mymesh.write("test.msh");
  411. return mymesh;
  412. }
  413. int main(void)
  414. {
  415. SlepcInitialize(0,{},0,0);
  416. sparselizard();
  417. SlepcFinalize();
  418. return 0;
  419. }