62 typedef shared_ptr<VectorT3Array>
VT3Ptr;
78 typedef shared_ptr<StorageSite>
SSPtr;
79 typedef shared_ptr<CRConnectivity>
CRPtr;
97 typedef pair<const StorageSite*, const StorageSite*>
SSPair;
99 typedef map<EntryIndex,shared_ptr<Matrix> >
MatrixMap;
102 typedef map<const StorageSite*,StorageSite*>
SiteMap;
143 const int numMeshes =
_meshes.size();
144 for (
int n=0; n<numMeshes; n++)
149 const int faceCount=faces.
getCount();
188 const int numMeshes =
_meshes.size();
189 for (
int n=0; n<numMeshes; n++)
203 initialVelocity[0] =
_options[
"initialXVelocity"];
204 initialVelocity[1] =
_options[
"initialYVelocity"];
205 initialVelocity[2] =
_options[
"initialZVelocity"];
206 *vCell = initialVelocity;
209 shared_ptr<IntArray> fineToCoarseCell(
new IntArray(nCells));
210 *fineToCoarseCell = -1;
218 for(
int k=0;k<25;k++)
220 *finestToCoarseCell = initialIndex;
224 for(
int c=0;c<nCells;c++)
225 FinestToCoarse[c][
_level]=c;
228 shared_ptr<TArray> pCell(
new TArray(nCells));
229 *pCell =
_options[
"operatingPressure"];
232 shared_ptr<TArray> rhoCell(
new TArray(nCells));
237 shared_ptr<TArray> muCell(
new TArray(nCells));
242 shared_ptr<TArray> tempCell(
new TArray(nCells));
243 *tempCell =
_options[
"operatingTemperature"];
246 shared_ptr<TArray> collFreqCell(
new TArray(nCells));
252 shared_ptr<VectorT5Array> coeffCell(
new VectorT5Array(nCells));
254 initialCoeff[0] = 1.0;
255 initialCoeff[1] = 1.0;
256 initialCoeff[2] = 0.0;
257 initialCoeff[3] = 0.0;
258 initialCoeff[4] = 0.0;
259 *coeffCell = initialCoeff;
263 shared_ptr<VectorT10Array> coeffgCell(
new VectorT10Array(nCells));
265 initialCoeffg[0] = 1.0;
266 initialCoeffg[1] = 1.0;
267 initialCoeffg[2] = 0.0;
268 initialCoeffg[3] = 1.0;
269 initialCoeffg[4] = 0.0;
270 initialCoeffg[5] = 1.0;
271 initialCoeffg[6] = 0.0;
272 initialCoeffg[7] = 0.0;
273 initialCoeffg[8] = 0.0;
274 initialCoeffg[9] = 0.0;
275 *coeffgCell = initialCoeffg;
280 *tempxxCell =
_options[
"operatingTemperature"]/3;
284 *tempyyCell =
_options[
"operatingTemperature"]/3;
288 *tempzzCell =
_options[
"operatingTemperature"]/3;
309 *EntropyGenRateCell = 0.0;
313 *EntropyGenRateColl = 0.0;
317 shared_ptr<VectorT6Array> stressCell(
new VectorT6Array(nCells));
319 initialstress[0] = 1.0;
320 initialstress[1] = 1.0;
321 initialstress[2] = 1.0;
322 initialstress[3] = 0.0;
323 initialstress[4] = 0.0;
324 initialstress[5] = 0.0;
325 *stressCell = initialstress;
354 const int numDirections =
_quadrature.getDirCount();
363 if((
_bcMap[fg.
id]->bcType ==
"SymmetryBC")||(
_bcMap[fg.
id]->bcType ==
"RealWallBC")||(
_bcMap[fg.
id]->bcType ==
"VelocityInletBC")){
368 const TArray& faceAreaMag =
dynamic_cast<const TArray &
>(areaMagField[faces]);
372 const VectorT3 en = faceArea[0]/faceAreaMag[0];
373 vector<int> tempVec(numDirections);
375 for (
int j=0; j<numDirections; j++){
376 const T c_dot_en = cx[j]*en[0]+cy[j]*en[1]+cz[j]*en[2];
377 const T cx_incident = cx[j] - 2.0*c_dot_en*en[0];
378 const T cy_incident = cy[j] - 2.0*c_dot_en*en[1];
379 const T cz_incident = cz[j] - 2.0*c_dot_en*en[2];
380 int direction_incident=0;
383 for (
int js=0; js<numDirections; js++){
384 dotprod=pow(cx_incident-cx[js],2)+pow(cy_incident-cy[js],2)+pow(cz_incident-cz[js],2);
385 if (dotprod< Rdotprod){
387 direction_incident=js;}
389 tempVec[j] = direction_incident;
393 const int fgid=fg.
id;
405 InterfaceVelFace ->zero();
409 InterfaceStressFace ->zero();
412 shared_ptr<TArray> InterfacePressFace(
new TArray(Intfaces.
getCount()));
413 *InterfacePressFace =
_options[
"operatingPressure"];
416 shared_ptr<TArray> InterfaceDensityFace(
new TArray(Intfaces.
getCount()));
417 *InterfaceDensityFace =vc[
"density"];
434 if((
_bcMap[fg.
id]->bcType ==
"WallBC")||(
_bcMap[fg.
id]->bcType ==
"RealWallBC"))
438 const int faceCount=faces.
getCount();
441 for(
int i=offSet;i<offSet+faceCount;i++)
444 for(
int i=0;i<faceCount;i++)
446 int cell1=BfaceCells(i,0);
450 else if(
_bcMap[fg.
id]->bcType ==
"VelocityInletBC")
454 const int faceCount=faces.
getCount();
457 for(
int i=offSet;i<offSet+faceCount;i++)
460 for(
int i=0;i<faceCount;i++)
462 int cell1=BfaceCells(i,0);
466 else if(
_bcMap[fg.
id]->bcType ==
"ZeroGradBC")
470 const int faceCount=faces.
getCount();
473 for(
int i=offSet;i<offSet+faceCount;i++)
476 for(
int i=0;i<faceCount;i++)
478 int cell1=BfaceCells(i,0);
482 else if((
_bcMap[fg.
id]->bcType ==
"PressureInletBC")||(
_bcMap[fg.
id]->bcType ==
"PressureOutletBC"))
486 const int faceCount=faces.
getCount();
489 for(
int i=offSet;i<offSet+faceCount;i++)
492 else if(
_bcMap[fg.
id]->bcType ==
"SymmetryBC")
496 const int faceCount=faces.
getCount();
499 for(
int i=offSet;i<offSet+faceCount;i++)
502 for(
int i=0;i<faceCount;i++)
504 int cell1=BfaceCells(i,0);
511 const int faceCount=faces.
getCount();
514 for(
int i=offSet;i<offSet+faceCount;i++)
523 const int faceCount=faces.
getCount();
526 for(
int i=offSet;i<offSet+faceCount;i++)
538 const int faceCount = faces.
getCount();
541 for(
int i=0;i<faceCount;i++)
543 const int c0 = faceCells(i,0);
544 const int c1 = faceCells(i,1);
559 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE, &count, 1, MPI::INT, MPI::SUM);
560 if((MPI::COMM_WORLD.Get_rank()==0)&&(
_level==0))
561 cout<<
"number of non-fluid cells in mesh at level "<<
_level<<
" = "<<count<<endl;
566 cout<<
"number of non-fluid cells in mesh at level "<<
_level<<
" = "<<count<<endl;
578 if(
_options.AgglomerationMethod==
"FaceArea")
580 int maxLevs=finerModel->
getOptions().maxLevels;
581 int thisLevel=(finerModel->
getLevel())+1;
583 if(thisLevel<maxLevs)
598 const int nCells = cells.
getCount();
600 const IntArray& coarseIndex=
dynamic_cast<const IntArray&
>(FineToCoarseField[cells]);
611 const int numMeshes =
_meshes.size();
612 for (
int n=0; n<numMeshes; n++)
621 foreach(
const StorageSite::ScatterMap::value_type& pos, fineScatterMap)
630 shared_ptr<StorageSite> ghostSite
634 ghostSite->setTag( fineOSite.
getTag() );
643 SSPair sskey(&fineSite,&fineOSite);
647 foreach(
const StorageSite::ScatterMap::value_type& pos, fineScatterMapLevel1)
650 SSPair sskey(&fineSite,&fineOSite);
659 shared_ptr<StorageSite> ghostSite
663 ghostSite->setTag( fineOSite.
getTag() );
679 foreach(
const StorageSite::GatherMap::value_type& pos, fineGatherMap)
683 SSPair sskey(&fineSite,&fineOSite);
688 foreach(
const StorageSite::GatherMap::value_type& pos, fineGatherMapLevel1)
691 SSPair sskey(&fineSite,&fineOSite);
694 foreach(SiteMap::value_type tempPos,
_siteMap)
715 *newMacroPtr,*newQuadPtr);
717 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE, &newCount, 1, MPI::INT, MPI::SUM);
718 if(MPI::COMM_WORLD.Get_rank()==0)
719 cout<<
"Number of cells in level "<<thisLevel<<
" is "<<newCount<<endl;
723 cout<<
"Number of cells in level "<<thisLevel<<
" is "<<newCount<<endl;
726 newModelPtr->setFinerLevel(finerModel);
728 newModelPtr->getOptions()=finerModel->
getOptions();
729 newModelPtr->getBCMap()=finerModel->
getBCMap();
730 newModelPtr->getVCMap()=finerModel->
getVCMap();
733 newModelPtr->InitializeMacroparameters();
734 newModelPtr->initializeMaxwellian();
735 newModelPtr->initializeCoarseMaxwellian();
736 newModelPtr->ComputeMacroparameters();
737 newModelPtr->ComputeCoarseMacroparameters();
738 newModelPtr->ComputeCollisionfrequency();
739 newModelPtr->initializeMaxwellianEq();
742 newModelPtr->MakeCoarseModel(newModelPtr);
744 _options.maxLevels=newModelPtr->getLevel();
747 else if(
_options.AgglomerationMethod==
"AMG")
748 throw CException(
"Have not implemented AMG agglomeration method.");
750 throw CException(
"Unknown agglomeration method.");
756 if(
_options.AgglomerationMethod==
"FaceArea")
758 int maxLevs=finerModel->
getOptions().maxLevels;
759 int thisLevel=(finerModel->
getLevel())+1;
761 if(thisLevel<maxLevs)
776 const int nCells = cells.
getCount();
778 const IntArray& coarseIndex=
dynamic_cast<const IntArray&
>(FineToCoarseField[cells]);
789 const int numMeshes =
_meshes.size();
790 for (
int n=0; n<numMeshes; n++)
799 foreach(
const StorageSite::ScatterMap::value_type& pos, fineScatterMap)
808 shared_ptr<StorageSite> ghostSite
812 ghostSite->setTag( fineOSite.
getTag() );
821 SSPair sskey(&fineSite,&fineOSite);
825 foreach(
const StorageSite::ScatterMap::value_type& pos, fineScatterMapLevel1)
828 SSPair sskey(&fineSite,&fineOSite);
837 shared_ptr<StorageSite> ghostSite
841 ghostSite->setTag( fineOSite.
getTag() );
857 foreach(
const StorageSite::GatherMap::value_type& pos, fineGatherMap)
861 SSPair sskey(&fineSite,&fineOSite);
865 foreach(
const StorageSite::GatherMap::value_type& pos, fineGatherMapLevel1)
868 SSPair sskey(&fineSite,&fineOSite);
871 foreach(SiteMap::value_type tempPos,
_siteMap)
896 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE, &newCount, 1, MPI::INT, MPI::SUM);
897 if(MPI::COMM_WORLD.Get_rank()==0)
898 cout<<
"Number of cells in level "<<thisLevel<<
" is "<<newCount<<endl;
902 cout<<
"Number of cells in level "<<thisLevel<<
" is "<<newCount<<endl;
911 for (
int n=0; n<numMeshes; n++)
921 const TArray& fIB =
dynamic_cast<const TArray&
>(fnd[fineIBFaces]);
927 TArray& cIB =
dynamic_cast<TArray&
>(cfnd[coarseIBFaces]);
928 for(
int i=0;i<coarseIBFaces.
getCount();i++)
935 *coarseSolidVel = fineSolidVel;
938 shared_ptr<TArray> coarseSolidDensity(
new TArray(solidFaces.
getCount()));
940 *coarseSolidDensity = fineSolidDensity;
943 shared_ptr<TArray> coarseSolidTemperature(
new TArray(solidFaces.
getCount()));
945 *coarseSolidTemperature = fineSolidTemperature;
964 else if(
_options.AgglomerationMethod==
"AMG")
965 throw CException(
"Have not implemented AMG agglomeration method.");
967 throw CException(
"Unknown agglomeration method.");
973 const int maxLevs=
_options.maxLevels;
978 const int nCells = cells.
getCount();
981 const int nFCells = fCells.
getCount();
983 const IntArray& FineToCoarse=
dynamic_cast<const IntArray&
>(FineToCoarseField[cells]);
1000 if(thisLevel<maxLevs)
1002 for(
int c=0;c<nFCells;c++)
1003 FinestToCoarse[c][
_level+1]=FineToCoarse[FinestToCoarse[c][
_level]];
1013 for(
int dir=0;dir<
_quadrature.getDirCount();dir++)
1022 {
const int numMeshes =
_meshes.size();
1023 for (
int n=0; n<numMeshes; n++)
1027 const int nCells = cells.
getCount();
1049 for(
int c=0; c<nCells;c++)
1056 pressure[c]=temperature[c]*density[c];
1059 coeff[c][0]=density[c]/pow((pi*temperature[c]),1.5);
1060 coeff[c][1]=1/temperature[c];
1061 coeff[c][2]=0.0;coeff[c][3]=0.0;coeff[c][4]=0.0;
1066 coeffg[c][0]=coeff[c][0];
1067 coeffg[c][1]=coeff[c][1];
1068 coeffg[c][2]=coeff[c][2];
1069 coeffg[c][3]=coeff[c][1];
1070 coeffg[c][4]=coeff[c][3];
1071 coeffg[c][5]=coeff[c][1];
1072 coeffg[c][6]=coeff[c][4];
1091 const int numMeshes =
_meshes.size();
1092 for (
int n=0; n<numMeshes; n++)
1096 const int nCells = cells.
getCount();
1111 for(
int c=0; c<nCells;c++)
1115 coeff[c][0]=density[c]/pow((pi*temperature[c]),1.5);
1116 coeff[c][1]=1/temperature[c];
1117 coeff[c][2]=0.0;coeff[c][3]=0.0;coeff[c][4]=0.0;
1121 coeffg[c][0]=coeff[c][0];
1122 coeffg[c][1]=coeff[c][1];
1123 coeffg[c][2]=coeff[c][2];
1124 coeffg[c][3]=coeff[c][1];
1125 coeffg[c][4]=coeff[c][3];
1126 coeffg[c][5]=coeff[c][1];
1127 coeffg[c][6]=coeff[c][4];
1132 Txx[c]=0.5*temperature[c];
1133 Tyy[c]=0.5*temperature[c];
1134 Tzz[c]=0.5*temperature[c];
1147 const int numMeshes =
_meshes.size();
1148 for (
int n=0; n<numMeshes; n++)
1153 const int nCells = cells.
getCount();
1170 for(
int c=0; c<nCells;c++)
1177 stress[c][0]=0.0;stress[c][1]=0.0;stress[c][2]=0.0;
1178 stress[c][3]=0.0;stress[c][4]=0.0;stress[c][5]=0.0;
1183 for(
int j=0;j<N123;j++){
1186 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1190 for(
int c=0; c<nCells;c++){
1191 density[c] = density[c]+wts[j]*f[c];
1192 v[c][0]= v[c][0]+(cx[j]*f[c])*wts[j];
1193 v[c][1]= v[c][1]+(cy[j]*f[c])*wts[j];
1194 v[c][2]= v[c][2]+(cz[j]*f[c])*wts[j];
1195 temperature[c]= temperature[c]+(pow(cx[j],2.0)+pow(cy[j],2.0)
1196 +pow(cz[j],2.0))*f[c]*wts[j];
1204 for(
int c=0; c<nCells;c++){
1205 v[c][0]=v[c][0]/density[c];
1206 v[c][1]=v[c][1]/density[c];
1207 v[c][2]=v[c][2]/density[c];
1208 temperature[c]=temperature[c]-(pow(v[c][0],2.0)
1210 +pow(v[c][2],2.0))*density[c];
1211 temperature[c]=temperature[c]/(1.5*density[c]);
1212 pressure[c]=density[c]*temperature[c];
1217 for(
int j=0;j<N123;j++){
1219 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1220 for(
int c=0; c<nCells;c++){
1221 stress[c][0] +=pow((cx[j]-v[c][0]),2.0)*f[c]*wts[j];
1222 stress[c][1] +=pow((cy[j]-v[c][1]),2.0)*f[c]*wts[j];
1223 stress[c][2] +=pow((cz[j]-v[c][2]),2.0)*f[c]*wts[j];
1224 stress[c][3] +=(cx[j]-v[c][0])*(cy[j]-v[c][1])*f[c]*wts[j];
1225 stress[c][4] +=(cy[j]-v[c][1])*(cz[j]-v[c][2])*f[c]*wts[j];
1226 stress[c][5] +=(cz[j]-v[c][2])*(cx[j]-v[c][0])*f[c]*wts[j];
1239 const int numMeshes =
_meshes.size();
1240 for (
int n=0; n<numMeshes; n++)
1245 const int nCells = cells.
getCount();
1262 for(
int c=0; c<nCells;c++)
1266 stress[c][0]=0.0;stress[c][1]=0.0;stress[c][2]=0.0;
1267 stress[c][3]=0.0;stress[c][4]=0.0;stress[c][5]=0.0;
1272 for(
int j=0;j<N123;j++){
1275 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1279 for(
int c=0; c<nCells;c++){
1280 density[c] = density[c]+wts[j]*f[c];
1281 temperature[c]= temperature[c]+(pow(cx[j],2.0)+pow(cy[j],2.0)
1282 +pow(cz[j],2.0))*f[c]*wts[j];
1290 for(
int c=0; c<nCells;c++){
1291 temperature[c]=temperature[c]-(pow(v[c][0],2.0)
1293 +pow(v[c][2],2.0))*density[c];
1294 temperature[c]=temperature[c]/(1.5*density[c]);
1295 pressure[c]=density[c]*temperature[c];
1300 for(
int j=0;j<N123;j++){
1302 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1303 for(
int c=0; c<nCells;c++){
1304 stress[c][0] +=pow((cx[j]-v[c][0]),2.0)*f[c]*wts[j];
1305 stress[c][1] +=pow((cy[j]-v[c][1]),2.0)*f[c]*wts[j];
1306 stress[c][2] +=pow((cz[j]-v[c][2]),2.0)*f[c]*wts[j];
1307 stress[c][3] +=(cx[j]-v[c][0])*(cy[j]-v[c][1])*f[c]*wts[j];
1308 stress[c][4] +=(cy[j]-v[c][1])*(cz[j]-v[c][2])*f[c]*wts[j];
1309 stress[c][5] +=(cz[j]-v[c][2])*(cx[j]-v[c][0])*f[c]*wts[j];
1320 const int numMeshes =
_meshes.size();
1322 for (
int n=0; n<numMeshes; n++)
1327 const int nCells = cells.
getCount();
1330 zeroVelocity[0] = zero;
1331 zeroVelocity[1] = zero;
1332 zeroVelocity[2] = zero;
1334 shared_ptr<VectorT3Array> vRCell(
new VectorT3Array(nCells));
1335 *vRCell = zeroVelocity;
1355 const int numMeshes =
_meshes.size();
1357 for (
int n=0; n<numMeshes; n++)
1362 const int nCells = cells.
getCount();
1365 zeroVelocity[0] = zero;
1366 zeroVelocity[1] = zero;
1367 zeroVelocity[2] = zero;
1369 shared_ptr<VectorT3Array> vRCell(
new VectorT3Array(nCells));
1370 *vRCell = zeroVelocity;
1373 shared_ptr<VectorT3Array> vICell(
new VectorT3Array(nCells));
1374 *vICell = zeroVelocity;
1377 shared_ptr<VectorT3Array> vFCell(
new VectorT3Array(nCells));
1378 *vFCell = zeroVelocity;
1409 const int numMeshes =
_meshes.size();
1410 for (
int n=0; n<numMeshes; n++)
1414 const int nCells = cells.
getCount();
1437 for(
int c=0; c<nCells;c++)
1446 for(
int j=0;j<N123;j++){
1449 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1451 const TArray& fgam =
dynamic_cast<const TArray&
>(fndEq[cells]);
1452 for(
int c=0; c<nCells;c++){
1453 Txx[c]=Txx[c]+pow(cx[j]-v[c][0],2)*((1-1/Pr)*f[c]+1/Pr*fgam[c])*wts[j];
1454 Tyy[c]=Tyy[c]+pow(cy[j]-v[c][1],2)*((1-1/Pr)*f[c]+1/Pr*fgam[c])*wts[j] ;
1455 Tzz[c]=Tzz[c]+pow(cz[j]-v[c][2],2)*((1-1/Pr)*f[c]+1/Pr*fgam[c])*wts[j];
1460 Txy[c]=Txy[c]+(cx[j]-v[c][0])*(cy[j]-v[c][1])*((1-1/Pr)*f[c]+1/Pr*fgam[c])*wts[j];
1461 Tyz[c]=Tyz[c]+(cy[j]-v[c][1])*(cz[j]-v[c][2])*((1-1/Pr)*f[c]+1/Pr*fgam[c])*wts[j];
1462 Tzx[c]=Tzx[c]+(cz[j]-v[c][2])*(cx[j]-v[c][0])*((1-1/Pr)*f[c]+1/Pr*fgam[c])*wts[j];
1466 for(
int c=0; c<nCells;c++){
1467 Txx[c]=Txx[c]/density[c];
1468 Tyy[c]=Tyy[c]/density[c];
1469 Tzz[c]=Tzz[c]/density[c];
1470 Txy[c]=Txy[c]/density[c];
1471 Tyz[c]=Tyz[c]/density[c];
1472 Tzx[c]=Tzx[c]/density[c];
1487 const int numMeshes =
_meshes.size();
1488 for (
int n=0; n<numMeshes; n++)
1491 const T rho_init=
_options[
"rho_init"];
1492 const T T_init=
_options[
"T_init"];
1494 const T Tmuref=
_options[
"Tmuref"];
1496 const T R=8314.0/
_options[
"molecularWeight"];
1497 const T nondim_length=
_options[
"nonDimLt"];
1499 const T mu0=rho_init*R* T_init*nondim_length/pow(2*R* T_init,0.5);
1504 const int nCells = cells.
getCount();
1511 for(
int c=0; c<nCells;c++)
1513 viscosity[c]= muref*pow(temperature[c]*T_init/ Tmuref,mu_w);
1514 collisionFrequency[c]=density[c]*temperature[c]/viscosity[c]*mu0;
1518 for(
int c=0; c<nCells;c++)
1519 collisionFrequency[c]=
_options.Prandtl*collisionFrequency[c];
1526 const int numMeshes =
_meshes.size();
1527 for (
int n=0; n<numMeshes; n++)
1529 const int Knq_dir=
_options.Knq_direction;
1532 const int nCells = cells.
getCount();
1539 const int num_directions =
_quadrature.getDirCount();
1541 for(
int j=0;j<num_directions;j++){
1543 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1544 for(
int c=0; c<nCells;c++){
1545 Knq[c]=Knq[c]+0.5*f[c]*wts[j]*(pow(cx[j]-v[c][0],3.0)+(cx[j]-v[c][0])*pow(cy[j]-v[c][1],2.0)+(cx[j]-v[c][0])*pow(cz[j]-v[c][2],2.0));
1548 else if(Knq_dir ==1){
1549 for(
int j=0;j<num_directions;j++){
1551 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1552 for(
int c=0; c<nCells;c++){
1553 Knq[c]=Knq[c]+0.5*f[c]*wts[j]*(pow(cy[j]-v[c][1],3.0)+(cy[j]-v[c][1])*pow(cx[j]-v[c][0],2.0)+(cy[j]-v[c][1])*pow(cz[j]-v[c][2],2.0));
1557 else if(Knq_dir ==2){
1558 for(
int j=0;j<num_directions;j++){
1560 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1561 for(
int c=0; c<nCells;c++){
1562 Knq[c]=Knq[c]+0.5*f[c]*wts[j]*(pow(cz[j]-v[c][2],3.0)+(cz[j]-v[c][2])*pow(cx[j]-v[c][0],2.0)+(cz[j]-v[c][2])*pow(cy[j]-v[c][1],2.0));
1568 const int numMeshes =
_meshes.size();
1569 for (
int n=0; n<numMeshes; n++)
1571 const T rho_init=
_options[
"rho_init"];
1572 const T T_init=
_options[
"T_init"];
1573 const T molwt=
_options[
"molecularWeight"]*1E-26/6.023;
1574 const T R=8314.0/
_options[
"molecularWeight"];
1575 const T u_init=pow(2.0*R*T_init,0.5);
1577 const T h3bm4u3=pow(Planck,3)/ pow(molwt,4)*rho_init/pow(u_init,3);
1582 const int nCells = cells.
getCount();
1587 for(
int c=0; c<nCells;c++){
1588 Entropy[c]=0.0;EntropyGenRate_Collisional[c]=0.0;
1590 const int num_directions =
_quadrature.getDirCount();
1592 for(
int j=0;j<num_directions;j++){
1595 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1596 const TArray& fgam =
dynamic_cast<const TArray&
>(feqES[cells]);
1597 for(
int c=0; c<nCells;c++){
1598 Entropy[c]=Entropy[c]+f[c]*wts[j]*(1-log(h3bm4u3*f[c]));
1599 EntropyGenRate_Collisional[c]+= (f[c]-fgam[c])*collisionFrequency[c]*log(h3bm4u3*f[c])*wts[j];
1604 for(
int j=0;j<num_directions;j++){
1607 const TArray& f =
dynamic_cast<const TArray&
>(fnd[cells]);
1608 const TArray& fgam =
dynamic_cast<const TArray&
>(feq[cells]);
1609 for(
int c=0; c<nCells;c++){
1610 Entropy[c]=Entropy[c]+f[c]*wts[j]*(1-log(h3bm4u3*f[c]));
1611 EntropyGenRate_Collisional[c]+=(f[c]-fgam[c])*collisionFrequency[c]*(log(h3bm4u3*f[c]))*wts[j];
1622 const int numMeshes =
_meshes.size();
1623 for (
int n=0; n<numMeshes; n++)
1627 const int nCells = cells.
getCount();
1637 for(
int j=0;j< numFields;j++){
1640 for(
int c=0; c<nCells;c++){
1641 fEq[c]=coeff[c][0]*exp(-coeff[c][1]*(pow(cx[j]-v[c][0],2)+pow(cy[j]-v[c][1],2)
1642 +pow(cz[j]-v[c][2],2))+coeff[c][2]*(cx[j]-v[c][0])
1643 +coeff[c][3]*(cy[j]-v[c][1])+coeff[c][4]*(cz[j]-v[c][2]));
1649 for(
int j=0;j< numFields;j++){
1651 TArray& fEqES =
dynamic_cast< TArray&
>(fndEqES[cells]);
1652 for(
int c=0; c<nCells;c++){
1653 T Cc1=(cx[j]-v[c][0]);
1654 T Cc2=(cy[j]-v[c][1]);
1655 T Cc3=(cz[j]-v[c][2]);
1656 fEqES[c]=coeffg[c][0]*exp(-coeffg[c][1]*pow(Cc1,2)+coeffg[c][2]*Cc1
1657 -coeffg[c][3]*pow(Cc2,2)+coeffg[c][4]*Cc2
1658 -coeffg[c][5]*pow(Cc3,2)+coeffg[c][6]*Cc3
1659 +coeffg[c][7]*cx[j]*cy[j]+coeffg[c][8]*cy[j]*cz[j]
1660 +coeffg[c][9]*cz[j]*cx[j]);
1672 const int numMeshes =
_meshes.size();
1673 for (
int n=0; n<numMeshes; n++)
1676 const T tolx=
_options[
"ToleranceX"];
1677 const T tolf=
_options[
"ToleranceF"];
1681 const int nCells = cells.
getCount();
1689 for(
int c=0; c<nCells;c++){
1691 for (
int trial=0;trial<ktrial;trial ++){
1698 fvec[1]=density[c]*v[c][0];
1699 fvec[2]=density[c]*v[c][1];
1700 fvec[3]=density[c]*v[c][2];
1701 fvec[4]=1.5*density[c]*temperature[c]+density[c]*(pow(v[c][0],2)+pow(v[c][1],2)+pow(v[c][2],2.0));
1708 for (
int row=0;row<sizeC;row++){errf+=
fabs(fvec[row]);}
1713 for (
int row=0;row<sizeC;row++){pvec[row]=-fvec[row];}
1723 for (
int row=0;row<sizeC;row++){
1725 for (
int col=0;col<sizeC;col++){
1726 xvec[row]+=fjacinv(row,col)*pvec[col];}
1731 for (
int row=0;row<sizeC;row++){
1732 errx +=
fabs(xvec[row]);
1733 coeff[c][row]+= xvec[row];
1750 const int ktrial=
_options.NewtonsMethod_ktrial;
1751 const int numMeshes =
_meshes.size();
1752 for (
int n=0; n<numMeshes; n++)
1756 const int nCells = cells.
getCount();
1785 for(
int j=0;j< numFields;j++){
1788 for(
int c=0; c<nCells;c++){
1789 fEq[c]=coeff[c][0]*exp(-coeff[c][1]*(pow(cx[j]-v[c][0],2)+pow(cy[j]-v[c][1],2)
1790 +pow(cz[j]-v[c][2],2))+coeff[c][2]*(cx[j]-v[c][0])
1791 +coeff[c][3]*(cy[j]-v[c][1])+coeff[c][4]*(cz[j]-v[c][2]));
1812 for(
int j=0;j< numFields;j++){
1813 T Cconst=pow(cx[j]-v[0],2.0)+pow(cy[j]-v[1],2.0)+pow(cz[j]-v[2],2.0);
1814 T Econst=xn[0]*exp(-xn[1]*Cconst+xn[2]*(cx[j]-v[0])+xn[3]*(cy[j]-v[1])+xn[4]*(cz[j]-v[2]))*wts[j];
1816 for (
int row=0;row<5;row++){
1817 fvec[row]+= -Econst*malphaBGK(j,row);
1822 mexp[0]=-Econst/xn[0];
1823 mexp[1]=Econst*Cconst;
1824 mexp[2]=-Econst*(cx[j]-v[0]);
1825 mexp[3]=-Econst*(cy[j]-v[1]);
1826 mexp[4]=-Econst*(cz[j]-v[2]);
1827 for (
int row=0;row<5;row++){
1828 for (
int col=0;col<5;col++){
1829 fjac(row,col)+=malphaBGK(j,row)*mexp[col];
1843 const int numMeshes =
_meshes.size();
1844 for (
int n=0; n<numMeshes; n++)
1846 const T tolx=
_options[
"ToleranceX"];
1847 const T tolf=
_options[
"ToleranceF"];
1851 const int nCells = cells.
getCount();
1866 for(
int c=0; c<nCells;c++){
1868 for (
int trial=0;trial<ktrial;trial ++){
1875 fvec[1]=density[c]*v[c][0];
1876 fvec[2]=density[c]*v[c][1];
1877 fvec[3]=density[c]*v[c][2];
1878 fvec[4]=density[c]*(pow(v[c][0],2)+Txx[c]);
1879 fvec[5]=density[c]*(pow(v[c][1],2)+Tyy[c]);
1880 fvec[6]=density[c]*(pow(v[c][2],2)+Tzz[c]);
1881 fvec[7]=density[c]*(v[c][0]*v[c][1]+Txy[c]);
1882 fvec[8]=density[c]*(v[c][1]*v[c][2]+Tyz[c]);
1883 fvec[9]=density[c]*(v[c][2]*v[c][0]+Tzx[c]);
1891 for (
int row=0;row<sizeC;row++){errf+=
fabs(fvec[row]);}
1895 for (
int row=0;row<sizeC;row++){pvec[row]=-fvec[row];}
1902 for (
int row=0;row<sizeC;row++){
1904 for (
int col=0;col<sizeC;col++){
1905 xvec[row]+=fjacinv(row,col)*pvec[col];
1940 for (
int row=0;row<sizeC;row++){
1941 errx +=
fabs(xvec[row]);
1942 coeffg[c][row]+= xvec[row];
1956 const int ktrial=
_options.NewtonsMethod_ktrial;
1957 const int numMeshes =
_meshes.size();
1958 for (
int n=0; n<numMeshes; n++)
1962 const int nCells = cells.
getCount();
1990 for(
int j=0;j< numFields;j++){
1992 TArray& fEqES =
dynamic_cast< TArray&
>(fndEqES[cells]);
1993 for(
int c=0; c<nCells;c++){
1994 T Cc1=(cx[j]-v[c][0]);
1995 T Cc2=(cy[j]-v[c][1]);
1996 T Cc3=(cz[j]-v[c][2]);
1997 fEqES[c]=coeffg[c][0]*exp(-coeffg[c][1]*pow(Cc1,2)+coeffg[c][2]*Cc1
1998 -coeffg[c][3]*pow(Cc2,2)+coeffg[c][4]*Cc2
1999 -coeffg[c][5]*pow(Cc3,2)+coeffg[c][6]*Cc3
2000 +coeffg[c][7]*cx[j]*cy[j]+coeffg[c][8]*cy[j]*cz[j]
2001 +coeffg[c][9]*cz[j]*cx[j]);
2019 for(
int j=0;j< numFields;j++){
2023 T Econst=xn[0]*exp(-xn[1]*pow(Cc1,2)+xn[2]*Cc1-xn[3]*pow(Cc2,2)+ xn[4]*Cc2
2024 -xn[5]*pow(Cc3,2)+xn[6]*Cc3
2025 +xn[7]*cx[j]*cy[j]+xn[8]*cy[j]*cz[j]+xn[9]*cz[j]*cx[j])*wts[j];
2027 for (
int row=0;row<10;row++){
2028 fvec[row]+= -Econst*malphaESBGK(j,row);
2031 mexp[0]=-Econst/xn[0];
2032 mexp[1]=Econst*pow(Cc1,2);
2033 mexp[2]=-Econst*Cc1;
2034 mexp[3]=Econst*pow(Cc2,2);
2035 mexp[4]=-Econst*Cc2;
2036 mexp[5]=Econst*pow(Cc3,2);
2037 mexp[6]=-Econst*Cc3;
2039 mexp[7]=-Econst*cx[j]*cy[j];
2040 mexp[8]=-Econst*cy[j]*cz[j];
2041 mexp[9]=-Econst*cz[j]*cx[j];
2043 for (
int row=0;row<10;row++){
2044 for (
int col=0;col<10;col++){
2045 fjac(row,col)+=malphaESBGK(j,row)*mexp[col];
2059 const int numMeshes =
_meshes.size();
2060 for (
int n=0; n<numMeshes; n++)
2064 const int nCells = cells.
getCount();
2076 for(
int j=0;j< numFields;j++){
2079 for(
int c=0; c<nCells;c++){
2080 f[c]=density[c]/pow((pi*temperature[c]),1.5)*
2081 exp(-(pow((cx[j]-v[c][0]),2.0)+pow((cy[j]-v[c][1]),2.0)+
2082 pow((cz[j]-v[c][2]),2.0))/temperature[c]);
2093 for (
int c=0;c<nCells;c++)
2096 if (
_options.timeDiscretizationOrder > 1)
2100 for (
int c=0;c<nCells;c++)
2112 const int numMeshes =
_meshes.size();
2114 for (
int n=0; n<numMeshes; n++)
2118 const int nCells = cells.
getCount();
2130 for(
int j=0;j< numFields;j++){
2135 for(
int c=0; c<nCells;c++){
2136 f0[c]=density[c]/pow((pi*temperature[c]),1.5)*
2137 exp(-(pow((cx[j]-v[c][0]),2.0)+pow((cy[j]-v[c][1]),2.0)+
2138 pow((cz[j]-v[c][2]),2.0))/temperature[c]);
2148 const int numMeshes =
_meshes.size();
2150 for (
int n=0; n<numMeshes; n++)
2154 const int nCells = cells.
getCount();
2157 for(
int j=0;j< numFields;j++){
2164 for(
int c=0; c<nCells;c++){
2174 void weightedMaxwellian(
double weight1,
double uvel1,
double vvel1,
double wvel1,
double uvel2,
double vvel2,
double wvel2,
double temp1,
double temp2)
2176 const int numMeshes =
_meshes.size();
2177 for (
int n=0; n<numMeshes; n++)
2181 const int nCells = cells.
getCount();
2189 for(
int j=0;j< numFields;j++){
2192 for(
int c=0; c<nCells;c++){
2193 f[c]=weight1*1.0/pow((pi*1.0),1.5)*exp(-(pow((cx[j]-uvel1),2.0)+pow((cy[j]-vvel1),2.0)+pow((cz[j]-wvel1),2.0))/temp1)
2194 +(1-weight1)*1.0/pow((pi*1.0),1.5)*exp(-(pow((cx[j]-uvel2),2.0)+pow((cy[j]-vvel2),2.0)+pow((cz[j]-wvel2),2.0))/temp2);
2200 for (
int c=0;c<nCells;c++)
2203 if (
_options.timeDiscretizationOrder > 1)
2207 for (
int c=0;c<nCells;c++)
2216 const double vvel1=0.0;
2217 const double wvel1=0.0;
2218 const double vvel2=0.0;
2219 const double wvel2=0.0;
2220 const int numMeshes =
_meshes.size();
2221 for (
int n=0; n<numMeshes; n++)
2225 const int nCells = cells.
getCount();
2233 for(
int j=0;j< numFields;j++){
2236 for(
int c=0; c<nCells;c++){
2237 f[c]=weight1*1.0/pow((pi*1.0),1.5)*exp(-(pow((cx[j]-uvel1),2.0)+pow((cy[j]-vvel1),2.0)+pow((cz[j]-wvel1),2.0))/temp1)
2238 +(1-weight1)*1.0/pow((pi*1.0),1.5)*exp(-(pow((cx[j]-uvel2),2.0)+pow((cy[j]-vvel2),2.0)+pow((cz[j]-wvel2),2.0))/temp2);
2244 for (
int c=0;c<nCells;c++)
2247 if (
_options.timeDiscretizationOrder > 1)
2251 for (
int c=0;c<nCells;c++)
2267 map<string,shared_ptr<ArrayBase> >&
2315 const int numMeshes =
_meshes.size();
2316 for (
int n=0; n<numMeshes; n++)
2337 bc->
bcType =
"RealWallBC";
2339 else if (fg.
groupType ==
"velocity-inlet")
2341 bc->
bcType =
"VelocityInletBC";
2343 else if (fg.
groupType ==
"pressure-inlet")
2345 bc->
bcType =
"PressureInletBC";
2347 else if (fg.
groupType ==
"pressure-outlet")
2349 bc->
bcType =
"PressureOutletBC";
2353 bc->
bcType =
"SymmetryBC";
2356 else if((fg.
groupType ==
"zero-gradient "))
2358 bc->
bcType =
"ZeroGradBC";
2361 throw CException(
"COMETModel: unknown face group type "
2386 const int numMeshes =
_meshes.size();
2387 for (
int n=0;n<numMeshes;n++)
2394 for (
int direction = 0; direction < numFields; direction++)
2400 if (
_options.timeDiscretizationOrder > 1)
2409 if ( MPI::COMM_WORLD.Get_rank() == 0 )
2410 {cout <<
"updated time" <<endl;}
2413 #ifndef FVM_PARALLEL
2414 cout <<
"updated time" <<endl;
2428 const int numMeshes =
_meshes.size();
2429 for (
int n=0; n<numMeshes; n++)
2441 bc.
getVal(
"specifiedYVelocity"),
2442 bc.
getVal(
"specifiedZVelocity"),
2447 if(bc.
bcType==
"PressureInletBC")
2451 else if(bc.
bcType==
"PressureOutletBC")
2455 else if (bc.
bcType ==
"RealWallBC")
2459 const vector<int>& vecReflection=(*pos).second;
2471 else if(bc.
bcType==
"ZeroGradBC")
2496 pFile = fopen(filename,
"w");
2500 fprintf(pFile,
"%s \n",
"VARIABLES= cx, cy, cz, f,fEq,fES");
2501 fprintf(pFile,
"%s %i %s %i %s %i \n",
"ZONE I=", N3,
",J=",N2,
",K=",N1);
2502 fprintf(pFile,
"%s \n",
"F=BLOCK, VARLOCATION=(NODAL,NODAL,NODAL,NODAL,NODAL,NODAL)");
2503 const int numMeshes =
_meshes.size();
2504 const int cellno=
_options.printCellNumber;
2505 for (
int n=0; n<numMeshes; n++){
2510 for(
int j=0;j< numFields;j++){fprintf(pFile,
"%E \n",cx[j]);}
2511 for(
int j=0;j< numFields;j++){fprintf(pFile,
"%E \n",cy[j]);}
2512 for(
int j=0;j< numFields;j++){fprintf(pFile,
"%E \n",cz[j]);}
2516 for(
int j=0;j< numFields;j++){
2519 fprintf(pFile,
"%E\n",f[cellno]);
2521 for(
int j=0;j< numFields;j++){
2524 fprintf(pFile,
"%E\n",fEq[cellno]);
2527 for(
int j=0;j< numFields;j++){
2530 TArray& fEqES =
dynamic_cast< TArray&
>(fndEqES[cells]);
2531 fprintf(pFile,
"%E\n",fEqES[cellno]);
2534 for(
int j=0;j< numFields;j++){
2538 fprintf(pFile,
"%E\n",fEq[cellno]);
2549 int smallestMesh=-1;
2550 const int numMeshes=inMeshes.size();
2552 for(
int n=0;n<numMeshes;n++)
2554 const Mesh& mesh=*inMeshes[n];
2558 outMeshes.push_back(newMeshPtr);
2565 const int inCellTotal=inCells.
getCount();
2566 const int inFaceCount=inFaces.
getCount();
2567 const int inGhost=inCellTotal-inCellCount;
2571 IntArray& FineToCoarse=
dynamic_cast<IntArray&
>(FineToCoarseField[inCells]);
2577 const TArray& areaMagArray=
dynamic_cast<const TArray&
>(areaMagField[inFaces]);
2588 for(
int c=0;c<inCellCount;c++)
2593 const int neibCount=inCellinFaces.
getCount(c);
2597 for(
int i=0; i<inFaceCount; i++)
2601 for(
int i=0; i<inCellCount; i++)
2605 for(
int neib=0;neib<neibCount;neib++)
2607 const int f=inCellinFaces(c,neib);
2609 if(inBCfArray[f]==0)
2611 if(c==inFaceinCells(f,1))
2612 c2=inFaceinCells(f,0);
2614 c2=inFaceinCells(f,1);
2620 if((FineToCoarse[c2]==-1)&&(!marked[c2]))
2624 for(
int face=0;face<inFaceCount;face++)
2626 if((c==inFaceinCells(face,0))&&(c2==inFaceinCells(face,1)))
2627 tempArea+=areaArray[face];
2628 else if((c2==inFaceinCells(face,0))&&(c==inFaceinCells(face,1)))
2629 tempArea-=areaArray[face];
2633 if((FineToCoarse[c2]==-1)&&(marker[f]))
2634 if(
mag(tempArea)>maxArea)
2637 maxArea=
mag(tempArea);
2653 FineToCoarse[c]=coarseCount;
2654 FineToCoarse[pairWith]=coarseCount;
2661 for(
int c=0;c<inCellCount;c++)
2665 const int neibCount=inCellinFaces.
getCount(c);
2669 for(
int i=0; i<inFaceCount; i++)
2673 for(
int i=0; i<inCellCount; i++)
2678 for(
int neib=0;neib<neibCount;neib++)
2680 const int f=inCellinFaces(c,neib);
2682 if(inBCfArray[f]==0)
2684 if(c==inFaceinCells(f,1))
2685 c2=inFaceinCells(f,0);
2687 c2=inFaceinCells(f,1);
2697 for(
int face=0;face<inFaceCount;face++)
2699 if((c==inFaceinCells(face,0))&&(c2==inFaceinCells(face,1)))
2700 tempArea+=areaArray[face];
2701 else if((c2==inFaceinCells(face,0))&&(c==inFaceinCells(face,1)))
2702 tempArea-=areaArray[face];
2707 if(
mag(tempArea)>maxArea)
2709 pairWith=FineToCoarse[c2];
2711 maxArea=
mag(tempArea);
2727 FineToCoarse[c]=coarseCount;
2732 if(FineToCoarse[c2perm]==-1)
2734 FineToCoarse[c]=coarseCount;
2735 FineToCoarse[c2perm]=coarseCount;
2739 FineToCoarse[c]=pairWith;
2744 for(
int c=0;c<inCellCount;c++)
2748 FineToCoarse[c]=coarseCount;
2753 int coarseGhost=coarseCount;
2766 const int nFaces = faces.
getCount();
2770 for(
int f=0; f< nFaces; f++)
2772 const int c1= faceCells(f,1);
2773 FineToCoarse[c1]=coarseGhost;
2790 int smallestMesh=-1;
2791 const int numMeshes=inMeshes.size();
2792 for(
int n=0;n<numMeshes;n++)
2794 const Mesh& mesh=*inMeshes[n];
2799 Mesh& newMeshPtr=*outMeshes[n];
2809 const int inCellTotal=inCells.
getCount();
2810 const int inFaceCount=inFaces.
getCount();
2811 const int inGhost=inCellTotal-inCellCount;
2815 const IntArray& FineToCoarse=
dynamic_cast<const IntArray&
>(FineToCoarseField[inCells]);
2819 const TArray& areaMagArray=
dynamic_cast<const TArray&
>(areaMagField[inFaces]);
2831 const int nFaces = faces.
getCount();
2835 for(
int f=0; f< nFaces; f++)
2837 const int c1= faceCells(f,1);
2838 if(boundaryCell<FineToCoarse[c1])
2839 boundaryCell=FineToCoarse[c1];
2844 boundaryCell-=coarseCount;
2850 if(outGhost<FineToCoarse[c])
2851 outGhost=FineToCoarse[c];
2854 outGhost-=coarseCount;
2856 int interfaceCells = outGhost - boundaryCell;
2869 outCells.
setCount(coarseCount,boundaryCell+interfaceCellsLevel0);
2876 CoarseToFineCells->initCount();
2879 CoarseToFineCells->addCount(FineToCoarse[c],1);
2881 CoarseToFineCells->finishCount();
2884 CoarseToFineCells->add(FineToCoarse[c],c);
2886 CoarseToFineCells->finishAdd();
2892 FineFacesCoarseCells->initCount();
2895 int survivingFaces=0;
2896 int coarse0, coarse1;
2897 for(
int f=0;f<inFaceCount;f++)
2899 coarse0=FineToCoarse[inFaceinCells(f,0)];
2900 coarse1=FineToCoarse[inFaceinCells(f,1)];
2901 if(coarse0!=coarse1)
2904 FineFacesCoarseCells->addCount(f,2);
2908 FineFacesCoarseCells->finishCount();
2911 int fc0,fc1,cc0,cc1;
2912 for(
int f=0;f<inFaceCount;f++)
2914 fc0=inFaceinCells(f,0);
2915 fc1=inFaceinCells(f,1);
2916 cc0=FineToCoarse[fc0];
2917 cc1=FineToCoarse[fc1];
2920 FineFacesCoarseCells->add(f,cc0);
2921 FineFacesCoarseCells->add(f,cc1);
2925 FineFacesCoarseCells->finishAdd();
2927 CRPtr CoarseCellsFineFaces=FineFacesCoarseCells->getTranspose();
2928 CRPtr CellCellCoarse=CoarseCellsFineFaces->multiply(*FineFacesCoarseCells,
true);
2953 for(
int f=0;f<inFaceCount;f++)
2955 cCell0=FineToCoarse[inFaceinCells(f,0)];
2956 cCell1=FineToCoarse[inFaceinCells(f,1)];
2965 int inFaceGhost = 0;
2967 inFaceGhost+=(*fgPtr).site.getCount();
2969 inFaceGhost+=(*fgPtr).site.getCount();
2970 const int inInteriorFaces = inFaceCount - inFaceGhost;
2972 const int del = inFaceCount - outFaces.
getCount();
2975 const int interiorCount=inInteriorFaces-del;
2980 int inOffset=interiorCount;
2998 CoarseFaceCoarseCell->initCount();
3001 for(
int f=0;f<inFaceCount;f++)
3003 coarse0=FineToCoarse[inFaceinCells(f,0)];
3004 coarse1=FineToCoarse[inFaceinCells(f,1)];
3005 if(coarse0!=coarse1)
3007 CoarseFaceCoarseCell->addCount(survivingFaces,2);
3012 CoarseFaceCoarseCell->finishCount();
3016 for(
int f=0;f<inFaceCount;f++)
3018 fc0=inFaceinCells(f,0);
3019 fc1=inFaceinCells(f,1);
3020 cc0=FineToCoarse[fc0];
3021 cc1=FineToCoarse[fc1];
3024 CoarseFaceCoarseCell->add(survivingFaces,cc0);
3025 CoarseFaceCoarseCell->add(survivingFaces,cc1);
3030 CoarseFaceCoarseCell->finishAdd();
3032 CRPtr CoarseCellCoarseFace=CoarseFaceCoarseCell->getTranspose();
3040 coarseIbTypeField.
addArray(outCells,ibTypePtr);
3044 for(
int c=0;c<inCellCount;c++)
3046 coarseIBType[FineToCoarse[c]]=ibType[c];
3052 *ibFaceIndexPtr = -1;
3059 CoarseFacesFineFaces->initCount();
3062 for(
int f=0;f<inFaceCount;f++)
3064 int fc0=inFaceinCells(f,0);
3065 int fc1=inFaceinCells(f,1);
3066 const int cc0=FineToCoarse[fc0];
3067 const int cc1=FineToCoarse[fc1];
3071 CoarseFacesFineFaces->addCount(survivingFaces,1);
3076 CoarseFacesFineFaces->finishCount();
3079 for(
int f=0;f<inFaceCount;f++)
3081 int fc0=inFaceinCells(f,0);
3082 int fc1=inFaceinCells(f,1);
3083 const int cc0=FineToCoarse[fc0];
3084 const int cc1=FineToCoarse[fc1];
3087 CoarseFacesFineFaces->add(survivingFaces,f);
3088 coarseIBFaceIndex[survivingFaces]=fineIBFaceIndex[f];
3093 CoarseFacesFineFaces->finishAdd();
3110 TArray& outCV=*outCellVolumePtr;
3115 const TArray& inCV=
dynamic_cast<const TArray&
>(VolumeField[inCells]);
3117 for(
int c=0;c<outCellsCount;c++)
3119 const int fineCount=CoarseToFineCells->getCount(c);
3120 for(
int i=0;i<fineCount;i++)
3122 int fc=(*CoarseToFineCells)(c,i);
3127 coarseVolumeField.
addArray(outCells,outCellVolumePtr);
3131 const int outFacesCount=outFaces.
getCount();
3135 TArray& outFAMag=*outFaceAreaMagPtr;
3138 Field& coarseFaceAreaField=coarseGeomFields.
area;
3150 for(
int f=0;f<outFacesCount;f++)
3152 const int fineCount=CoarseFacesFineFaces->getCount(f);
3153 const int cCell0=(*CoarseFaceCoarseCell)(f,0);
3154 for(
int i=0;i<fineCount;i++)
3156 const int fFace=(*CoarseFacesFineFaces)(f,i);
3157 const int fCell0=inFaceinCells(fFace,0);
3158 const int CCell0=FineToCoarse[fCell0];
3163 outFA[f]+=inFA[fFace];
3165 outFA[f]-=inFA[fFace];
3166 outFAMag[f]+=areaMagArray[fFace];
3170 coarseFaceAreaField.
addArray(outFaces,outFaceAreaPtr);
3171 coarseAreaMagField.
addArray(outFaces,outFaceAreaMagPtr);
3210 return smallestMesh;
3220 const int numMeshes=inMeshes.size();
3221 for(
int n=0;n<numMeshes;n++)
3223 const Mesh& mesh=*inMeshes[n];
3225 Mesh& newMeshPtr=*outMeshes[n];
3231 const int inCellTotal=inCells.
getCount();
3237 tempIndex[c]=coarseIndex[c];
3239 int coarseGhostSize=0;
3240 int tempGhostSize=0;
3243 int coarseSize = -1;
3251 const int nFaces = faces.
getCount();
3255 for(
int f=0; f< nFaces; f++)
3257 const int c1= faceCells(f,1);
3260 if(boundaryCell<coarseIndex[c1])
3261 boundaryCell=coarseIndex[c1];
3266 coarseSize = boundaryCell;
3276 typedef map<const StorageSite*, vector<const Array<int>* > > IndicesMap;
3277 IndicesMap toIndicesMap;
3278 IndicesMap tempIndicesMap;
3280 foreach(
const StorageSite::GatherMap::value_type pos, gatherMap)
3286 tempIndicesMap[&oSite].push_back(&tempIndices);
3287 toIndicesMap[&oSite].push_back(&toIndices);
3290 foreach(
const StorageSite::GatherMap::value_type pos, gatherMapLevel1)
3296 foreach(
const StorageSite::GatherMap::value_type posLevel0, gatherMap)
3298 const StorageSite& oSiteLevel0 = *posLevel0.first;
3301 toIndicesMap[&oSiteLevel0].push_back(&toIndices);
3307 toIndicesMap[&oSite].push_back(&toIndices);
3310 foreach(IndicesMap::value_type pos, tempIndicesMap)
3313 const vector<const Array<int>* > tempIndicesArrays = pos.second;
3316 map<int,int> otherToMyMapping;
3319 foreach(
const Array<int>* tempIndicesPtr, tempIndicesArrays)
3321 const Array<int>& tempIndices = *tempIndicesPtr;
3322 const int nGhostRows = tempIndices.
getLength();
3323 for(
int ng=0; ng<nGhostRows; ng++)
3325 const int fineIndex = tempIndices[ng];
3326 const int coarseOtherIndex = tempIndex[fineIndex];
3328 if (coarseOtherIndex < 0)
3332 if (otherToMyMapping.find(coarseOtherIndex) !=
3333 otherToMyMapping.end())
3336 tempIndex[fineIndex] = otherToMyMapping[coarseOtherIndex];
3340 tempIndex[fineIndex] = tempGhostSize+coarseSize;
3341 otherToMyMapping[coarseOtherIndex] = tempIndex[fineIndex];
3342 gatherSet.
insert( tempIndex[fineIndex] );
3349 foreach(IndicesMap::value_type pos, toIndicesMap)
3352 const vector<const Array<int>* > toIndicesArrays = pos.second;
3355 map<int,int> otherToMyMapping;
3358 foreach(
const Array<int>* toIndicesPtr, toIndicesArrays)
3361 const int nGhostRows = toIndices.
getLength();
3362 for(
int ng=0; ng<nGhostRows; ng++)
3364 const int fineIndex = toIndices[ng];
3365 const int coarseOtherIndex = coarseIndex[fineIndex];
3367 if (coarseOtherIndex < 0)
3370 if (otherToMyMapping.find(coarseOtherIndex) !=
3371 otherToMyMapping.end())
3373 coarseIndex[fineIndex] = otherToMyMapping[coarseOtherIndex];
3377 coarseIndex[fineIndex] = coarseGhostSize+coarseSize;
3378 otherToMyMapping[coarseOtherIndex] = coarseIndex[fineIndex];
3379 gatherSet.
insert( coarseIndex[fineIndex] );
3389 const int coarseMappersSize = otherToMyMapping.size();
3391 shared_ptr<Array<int> > coarseToIndices(
new Array<int>(coarseMappersSize));
3393 for(
int n = 0; n < gatherSet.
size(); n++)
3395 (*coarseToIndices)[n] = gatherSet.
getData().at(n);
3398 SSPair sskey(&site,&oSite);
3405 IndicesMap fromIndicesMap;
3407 foreach(
const StorageSite::GatherMap::value_type pos, scatterMap)
3412 fromIndicesMap[&oSite].push_back(&fromIndices);
3415 foreach(
const StorageSite::GatherMap::value_type pos, scatterMapLevel1)
3421 foreach(
const StorageSite::ScatterMap::value_type posLevel0, scatterMap)
3423 const StorageSite& oSiteLevel0 = *posLevel0.first;
3426 fromIndicesMap[&oSiteLevel0].push_back(&fromIndices);
3432 fromIndicesMap[&oSite].push_back(&fromIndices);
3435 foreach(IndicesMap::value_type pos, fromIndicesMap)
3438 const vector<const Array<int>* > fromIndicesArrays = pos.second;
3442 foreach(
const Array<int>* fromIndicesPtr, fromIndicesArrays)
3444 const Array<int>& fromIndices = *fromIndicesPtr;
3445 const int nGhostRows = fromIndices.
getLength();
3446 for(
int ng=0; ng<nGhostRows; ng++)
3448 const int fineIndex = fromIndices[ng];
3449 const int coarseOtherIndex = coarseIndex[fineIndex];
3450 if (coarseOtherIndex >= 0)
3451 scatterSet.
insert( coarseOtherIndex );
3456 const int coarseMappersSize = scatterSet.
size();
3458 shared_ptr<Array<int> > coarseFromIndices(
new Array<int>(coarseMappersSize));
3460 for(
int n = 0; n < scatterSet.
size(); n++ ) {
3461 (*coarseFromIndices)[n] = scatterSet.
getData().at(n);
3464 SSPair sskey(&site,&oSite);
3478 const int numMeshes =
_meshes.size();
3480 for (
int direction = 0; direction < numFields; direction++)
3484 dynamic_cast<const TArray&
>(fnd[solidFaces]);
3486 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE,pV.
getData(),solidFaces.
getCount() , MPI::DOUBLE, MPI::SUM);
3489 for (
int n=0; n<numMeshes; n++)
3501 const IMatrix& mIC =
3502 dynamic_cast<const IMatrix&
>
3509 const IMatrix& mIP =
3510 dynamic_cast<const IMatrix&
>
3522 dynamic_cast<const TArray&
>(fnd[cells]);
3525 cFV[c]=cV[FinestToCoarse[c][
_level]];
3529 mICV.multiplyAndAdd(*ibV,cFV);
3530 mIPV.multiplyAndAdd(*ibV,pV);
3534 stringstream ss(stringstream::in | stringstream::out);
3535 ss << MPI::COMM_WORLD.Get_rank();
3536 string fname1 =
"IBVelocity_proc" + ss.str() +
".dat";
3537 debugFile.open(fname1.c_str());
3544 const double angV = 1.0;
3550 for(
int f=0; f<ibFaces.
getCount();f++){
3551 int fID = ibFaceList[f];
3552 debugFile <<
"f=" << f << setw(10) <<
" fID = " << fID <<
" faceCentroid = " << faceCentroid[fID] <<
" ibV = " << (*ibV)[f] << endl;
3609 const int numMeshes =
_meshes.size();
3610 const int nSolidFaces = solidFaces.
getCount();
3612 shared_ptr<TArray> muSolid(
new TArray(nSolidFaces));
3616 shared_ptr<TArray> nueSolid(
new TArray(nSolidFaces));
3620 const T rho_init=
_options[
"rho_init"];
3621 const T T_init=
_options[
"T_init"];
3623 const T Tmuref=
_options[
"Tmuref"];
3625 const T R=8314.0/
_options[
"molecularWeight"];
3626 const T nondim_length=
_options[
"nonDimLt"];
3628 const T mu0=rho_init*R* T_init*nondim_length/pow(2*R* T_init,0.5);
3635 for(
int c=0; c<nSolidFaces;c++)
3637 viscosity[c]= muref*pow(temperature[c]*T_init/ Tmuref,mu_w);
3638 collisionFrequency[c]=density[c]*temperature[c]/viscosity[c]*mu0;
3642 for(
int c=0; c<nSolidFaces;c++)
3643 collisionFrequency[c]=
_options.Prandtl*collisionFrequency[c];
3649 for (
int n=0; n<numMeshes; n++)
3661 const IMatrix& mIC =
3662 dynamic_cast<const IMatrix&
>
3666 IMatrixV3 mICV3(mIC);
3669 const IMatrix& mIP =
3670 dynamic_cast<const IMatrix&
>
3674 IMatrixV3 mIPV3(mIP);
3712 for(
int c=0;c<fCells.
getCount();c++)
3714 cFTemp[c]=cTemp[FinestToCoarse[c][
_level]];
3715 cFVel[c]=cVel[FinestToCoarse[c][
_level]];
3716 cFDensity[c]=cDensity[FinestToCoarse[c][
_level]];
3717 cFNue[c]=cNue[FinestToCoarse[c][
_level]];
3721 mICV.multiplyAndAdd(*ibVnue,cFNue);
3722 mIPV.multiplyAndAdd(*ibVnue,sNue);
3725 mICV.multiplyAndAdd(*ibVtemp,cFTemp);
3726 mIPV.multiplyAndAdd(*ibVtemp,sTemp);
3729 mICV.multiplyAndAdd(*ibVdensity,cFDensity);
3730 mIPV.multiplyAndAdd(*ibVdensity,sDensity);
3733 mICV3.multiplyAndAdd(*ibVvel,cFVel);
3734 mIPV3.multiplyAndAdd(*ibVvel,sVel);
3741 const int f_out = 3;
3744 const int numMeshes =
_meshes.size();
3745 for (
int n=0; n<numMeshes; n++)
3749 const int numDirections =
_quadrature.getDirCount();
3751 const int nibFaces=ibFaces.
getCount();
3757 const TArray& ibDensity =
3760 for (
int j=0; j<numDirections; j++)
3762 shared_ptr<TArray> ibFndPtrEqES(
new TArray(nibFaces));
3763 TArray& ibFndEqES= *ibFndPtrEqES;
3764 ibFndPtrEqES->
zero();
3767 for (
int i=0; i<nibFaces; i++)
3772 const T ibu = ibVel[i][0];
3773 const T ibv = ibVel[i][1];
3774 const T ibw = ibVel[i][2];
3775 ibFndEqES[i]=ibDensity[i]/pow(pi*ibTemp[i],1.5)*exp(-(pow(cx[j]-ibu,2.0)+pow(cy[j]-ibv,2.0)+pow(cz[j]-ibw,2.0))/ibTemp[i]);
3777 fndEqES.
addArray(ibFaces,ibFndPtrEqES);
3785 for (
int n=0; n<numMeshes; n++)
3788 for (
int direction = 0; direction < numFields; direction++)
3798 const IMatrix& mIC =
3799 dynamic_cast<const IMatrix&
>
3805 const IMatrix& mIP =
3806 dynamic_cast<const IMatrix&
>
3814 dynamic_cast<const TArray&
>(fndEqES[cells]);
3819 mICV.multiplyAndAdd(*ibVf,cf);
3827 for (
int n=0; n<numMeshes; n++)
3829 const int numDirections =
_quadrature.getDirCount();
3830 for (
int j=0; j<numDirections; j++)
3836 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE,dsf.
getData(),solidFaces.
getCount() , MPI::DOUBLE, MPI::SUM);
3845 TArray& dsfEqES =
dynamic_cast< TArray&
>(fndEqES[ibFaces]);
3855 const int nibFaces = ibFaces.
getCount();
3856 const int nFaces = faces.
getCount();
3862 for(
int f=0; f<nibFaces; f++)
3865 double distIBSolidInvSum(0.0);
3866 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
3868 const int c = sFCCol[nc];
3869 const int faceIB= ibFaceIndices[f];
3875 double distIBSolid (0.0);
3877 distIBSolid =
sqrt(pow((faceCentroid[faceIB][0]-solidFaceCentroid[c][0]),2)+
3878 pow((faceCentroid[faceIB][1]-solidFaceCentroid[c][1]),2)+
3879 pow((faceCentroid[faceIB][2]-solidFaceCentroid[c][2]),2));
3880 distIBSolidInvSum += 1/pow(distIBSolid,RelaxDistribution);
3882 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
3884 const int c = sFCCol[nc];
3891 const int faceIB= ibFaceIndices[f];
3893 double time_to_wall (0.0);
3894 double distIBSolid (0.0);
3895 const T uwall = v[c][0];
3896 const T vwall = v[c][1];
3897 const T wwall = v[c][2];
3899 distIBSolid =
sqrt(pow((faceCentroid[faceIB][0]-solidFaceCentroid[c][0]),2)+
3900 pow((faceCentroid[faceIB][1]-solidFaceCentroid[c][1]),2)+
3901 pow((faceCentroid[faceIB][2]-solidFaceCentroid[c][2]),2));
3902 time_to_wall = -1*(pow(distIBSolid,2)/((cx[j]-uwall)*(faceCentroid[faceIB][0]-solidFaceCentroid[c][0])+(cy[j]-vwall)*(faceCentroid[faceIB][1]-solidFaceCentroid[c][1])+(cz[j]-wwall)*(faceCentroid[faceIB][2]-solidFaceCentroid[c][2])));
3906 dsfIB[f] += (dsfEqES[f]-(dsfEqES[f]-dsf[c])*exp(-time_to_wall*nue[f]))/(pow(distIBSolid,RelaxDistribution)*distIBSolidInvSum);
3916 const int numMeshes =
_meshes.size();
3917 for (
int n=0; n<numMeshes; n++)
3926 const IMatrix& mIC =
3927 dynamic_cast<const IMatrix&
>
3930 IMatrixV3 mICV3(mIC);
3933 const IMatrix& mIP =
3934 dynamic_cast<const IMatrix&
>
3937 IMatrixV3 mIPV3(mIP);
3950 mICV3.multiplyAndAdd(*ibVvel,cVel);
3951 mIPV3.multiplyAndAdd(*ibVvel,sVel);
3957 const int nSolidFaces = solidFaces.
getCount();
3959 shared_ptr<TArray> muSolid(
new TArray(nSolidFaces));
3963 shared_ptr<TArray> nueSolid(
new TArray(nSolidFaces));
3967 const T rho_init=
_options[
"rho_init"];
3968 const T T_init=
_options[
"T_init"];
3970 const T Tmuref=
_options[
"Tmuref"];
3972 const T R=8314.0/
_options[
"molecularWeight"];
3973 const T nondim_length=
_options[
"nonDimLt"];
3975 const T mu0=rho_init*R* T_init*nondim_length/pow(2*R* T_init,0.5);
3982 for(
int c=0; c<nSolidFaces;c++)
3984 viscosity[c]= muref*pow(temperature[c]*T_init/ Tmuref,mu_w);
3985 collisionFrequency[c]=density[c]*temperature[c]/viscosity[c]*mu0;
3989 for(
int c=0; c<nSolidFaces;c++)
3990 collisionFrequency[c]=
_options.Prandtl*collisionFrequency[c];
3995 for (
int direction = 0; direction < numFields; direction++)
4000 for (
int n=0; n<numMeshes; n++)
4009 const IMatrix& mIC =
4010 dynamic_cast<const IMatrix&
>
4016 dynamic_cast<const TArray&
>(fndEqES[cells]);
4021 mICV.multiplyAndAdd(*ibVf,cf);
4026 for (
int n=0; n<numMeshes; n++)
4028 const int numDirections =
_quadrature.getDirCount();
4029 for (
int j=0; j<numDirections; j++)
4034 TArray& dsfEqES =
dynamic_cast< TArray&
>(fndEqES[solidFaces]);
4036 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE,dsf.
getData(),solidFaces.
getCount() , MPI::DOUBLE, MPI::SUM);
4037 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE,dsfEqES.
getData(),solidFaces.
getCount() , MPI::DOUBLE, MPI::SUM);
4052 const int nibFaces = ibFaces.
getCount();
4053 const int nFaces = faces.
getCount();
4061 for(
int f=0; f<nibFaces; f++)
4063 double distIBSolidInvSum(0.0);
4064 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
4066 const int c = sFCCol[nc];
4067 const int faceIB= ibFaceIndices[f];
4073 double distIBSolid (0.0);
4075 distIBSolid =
sqrt(pow((faceCentroid[faceIB][0]-solidFaceCentroid[c][0]),2)+
4076 pow((faceCentroid[faceIB][1]-solidFaceCentroid[c][1]),2)+
4077 pow((faceCentroid[faceIB][2]-solidFaceCentroid[c][2]),2));
4078 distIBSolidInvSum += 1/pow(distIBSolid,RelaxDistribution);
4080 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
4082 const int c = sFCCol[nc];
4091 const int faceIB= ibFaceIndices[f];
4092 const T uwall = v[c][0];
4093 const T vwall = v[c][1];
4094 const T wwall = v[c][2];
4096 double time_to_wall (0.0);
4097 double distIBSolid (0.0);
4099 distIBSolid =
sqrt(pow((faceCentroid[faceIB][0]-solidFaceCentroid[c][0]),2)+
4100 pow((faceCentroid[faceIB][1]-solidFaceCentroid[c][1]),2)+
4101 pow((faceCentroid[faceIB][2]-solidFaceCentroid[c][2]),2));
4102 time_to_wall = -1*(pow(distIBSolid,2)/((cx[j]-uwall)*(faceCentroid[faceIB][0]-solidFaceCentroid[c][0])+(cy[j]-vwall)*(faceCentroid[faceIB][1]-solidFaceCentroid[c][1])+(cz[j]-wwall)*(faceCentroid[faceIB][2]-solidFaceCentroid[c][2])));
4105 ibVfA[f] += (dsfEqES[c]-(dsfEqES[c]-dsf[c])*exp(-time_to_wall*nue[c]))/(pow(distIBSolid,RelaxDistribution)*distIBSolidInvSum);
4120 const int numMeshes =
_meshes.size();
4121 for (
int n=0; n<numMeshes; n++)
4131 const IMatrix& mIC =
4132 dynamic_cast<const IMatrix&
>
4144 mICV.multiplyAndAdd(*ibP,cP);
4150 MPI::COMM_WORLD.Allreduce( MPI::IN_PLACE,pressure.
getData(),solidFaces.
getCount() , MPI::DOUBLE, MPI::SUM);
4160 const int numMeshes =
_meshes.size();
4161 for (
int direction = 0; direction < numFields; direction++) {
4165 for (
int n=0; n<numMeshes; n++)
4175 const IMatrix& mIC =
4176 dynamic_cast<const IMatrix&
>
4185 dynamic_cast<const TArray&
>(fnd[cells]);
4188 cFV[c]=cV[FinestToCoarse[c][
_level]];
4192 mICV.multiplyAndAdd(*ibV,cFV);
4195 stringstream ss(stringstream::in | stringstream::out);
4196 ss << MPI::COMM_WORLD.Get_rank();
4197 string fname1 =
"IBVelocity_proc" + ss.str() +
".dat";
4198 debugFile.open(fname1.c_str());
4205 const double angV = 1.0;
4211 for(
int f=0; f<ibFaces.getCount();f++){
4212 int fID = ibFaceList[f];
4213 debugFile <<
"f=" << f << setw(10) <<
" fID = " << fID <<
" faceCentroid = " << faceCentroid[fID] <<
" ibV = " << (*ibV)[f] << endl;
4228 const int numMeshes =
_meshes.size();
4229 for (
int n=0; n<numMeshes; n++)
4235 for (
int direction = 0; direction < numFields; direction++)
4252 const IMatrix& mIC =
4253 dynamic_cast<const IMatrix&
>
4259 dynamic_cast<const TArray&
>(fnd[cells]);
4261 dynamic_cast<const TArray&
>(fndEqES[cells]);
4269 for(
int c=0;c<fCells.
getCount();c++)
4271 cFf[c]=cf[FinestToCoarse[c][
_level]];
4272 cFfEq[c]=cfEq[FinestToCoarse[c][
_level]];
4280 mICV.multiplyAndAdd(*ibVfEq,cFfEq);
4283 mICV.multiplyAndAdd(*ibVf,cFf);
4289 const int nSolidFaces = solidFaces.
getCount();
4291 shared_ptr<TArray> muSolid(
new TArray(nSolidFaces));
4295 shared_ptr<TArray> nueSolid(
new TArray(nSolidFaces));
4299 const T rho_init=
_options[
"rho_init"];
4300 const T T_init=
_options[
"T_init"];
4302 const T Tmuref=
_options[
"Tmuref"];
4304 const T R=8314.0/
_options[
"molecularWeight"];
4305 const T nondim_length=
_options[
"nonDimLt"];
4307 const T mu0=rho_init*R* T_init*nondim_length/pow(2*R* T_init,0.5);
4314 for(
int c=0; c<nSolidFaces;c++)
4316 viscosity[c]= muref*pow(temperature[c]*T_init/ Tmuref,mu_w);
4317 collisionFrequency[c]=density[c]*temperature[c]/viscosity[c]*mu0;
4321 for(
int c=0; c<nSolidFaces;c++)
4322 collisionFrequency[c]=
_options.Prandtl*collisionFrequency[c];
4326 for (
int n=0; n<numMeshes; n++)
4338 const IMatrix& mIC =
4339 dynamic_cast<const IMatrix&
>
4343 IMatrixV3 mICV3(mIC);
4346 const IMatrix& mIP =
4347 dynamic_cast<const IMatrix&
>
4351 IMatrixV3 mIPV3(mIP);
4389 for(
int c=0;c<fCells.
getCount();c++)
4391 cFTemp[c]=cTemp[FinestToCoarse[c][
_level]];
4392 cFVel[c]=cVel[FinestToCoarse[c][
_level]];
4393 cFDensity[c]=cDensity[FinestToCoarse[c][
_level]];
4394 cFNue[c]=cNue[FinestToCoarse[c][
_level]];
4398 mICV.multiplyAndAdd(*ibVnue,cFNue);
4399 mIPV.multiplyAndAdd(*ibVnue,sNue);
4402 mICV.multiplyAndAdd(*ibVtemp,cFTemp);
4403 mIPV.multiplyAndAdd(*ibVtemp,sTemp);
4406 mICV.multiplyAndAdd(*ibVdensity,cFDensity);
4407 mIPV.multiplyAndAdd(*ibVdensity,sDensity);
4410 mICV3.multiplyAndAdd(*ibVvel,cFVel);
4411 mIPV3.multiplyAndAdd(*ibVvel,sVel);
4419 const int numMeshes =
_meshes.size();
4420 for (
int n=0; n<numMeshes; n++)
4424 const int numDirections =
_quadrature.getDirCount();
4426 const int nibFaces=ibFaces.
getCount();
4432 const TArray& ibDensity =
4435 for (
int j=0; j<numDirections; j++)
4437 shared_ptr<TArray> ibFndPtrEqES(
new TArray(nibFaces));
4438 TArray& ibFndEqES= *ibFndPtrEqES;
4440 ibFndPtrEqES->
zero();
4444 for (
int i=0; i<nibFaces; i++)
4449 const T ibu = ibVel[i][0];
4450 const T ibv = ibVel[i][1];
4451 const T ibw = ibVel[i][2];
4452 ibFndEqES[i]=ibDensity[i]/pow(pi*ibTemp[i],1.5)*exp(-(pow(cx[j]-ibu,2.0)+pow(cy[j]-ibv,2.0)+pow(cz[j]-ibw,2.0))/ibTemp[i]);
4454 fndEqES.
addArray(ibFaces,ibFndPtrEqES);
4461 const int numDirections =
_quadrature.getDirCount();
4462 for (
int j=0; j<numDirections; j++)
4464 const int nSolidFaces = solidFaces.
getCount();
4465 shared_ptr<TArray> solidFndPtr(
new TArray(nSolidFaces));
4466 solidFndPtr->zero();
4467 TArray& solidFnd= *solidFndPtr;
4473 for (
int n=0; n<numMeshes; n++)
4486 TArray& dsfEqES =
dynamic_cast< TArray&
>(fndEqES[ibFaces]);
4489 for(
int f=0; f<nSolidFaces; f++)
4491 double distIBSolidInvSum(0.0);
4492 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
4495 const int c = sFCCol[nc];
4496 const int faceIB= ibFaceIndices[c];
4502 double distIBSolid (0.0);
4504 distIBSolid =
sqrt(pow((faceCentroid[faceIB][0]-solidFaceCentroid[f][0]),2)+
4505 pow((faceCentroid[faceIB][1]-solidFaceCentroid[f][1]),2)+
4506 pow((faceCentroid[faceIB][2]-solidFaceCentroid[f][2]),2));
4507 distIBSolidInvSum += 1/pow(distIBSolid,RelaxDistribution);
4509 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
4511 const int c = sFCCol[nc];
4517 const int faceIB= ibFaceIndices[c];
4518 T time_to_wall (0.0);
4519 T distIBSolid (0.0);
4520 distIBSolid =
sqrt(pow((faceCentroid[faceIB][0]-solidFaceCentroid[f][0]),2)+
4521 pow((faceCentroid[faceIB][1]-solidFaceCentroid[f][1]),2)+
4522 pow((faceCentroid[faceIB][2]-solidFaceCentroid[f][2]),2));
4524 const T uwall = v[f][0];
4525 const T vwall = v[f][1];
4526 const T wwall = v[f][2];
4529 time_to_wall = (pow(distIBSolid,2)/((cx[j]-uwall)*(faceCentroid[faceIB][0]-solidFaceCentroid[f][0])+(cy[j]-vwall)*(faceCentroid[faceIB][1]-solidFaceCentroid[f][1])+(cz[j]-wwall)*(faceCentroid[faceIB][2]-solidFaceCentroid[f][2])));
4533 solidFnd[f] += (dsfEqES[c]-(dsfEqES[c]-dsf[c])*exp(-time_to_wall*nue[c]))/(pow(distIBSolid,RelaxDistribution)*distIBSolidInvSum);
4539 fnd.
addArray(solidFaces,solidFndPtr);
4543 const int numDirections =
_quadrature.getDirCount();
4544 for (
int j=0; j<numDirections; j++)
4546 const int nSolidFaces = solidFaces.
getCount();
4547 shared_ptr<TArray> solidFndPtr(
new TArray(nSolidFaces));
4548 solidFndPtr->zero();
4549 TArray& solidFnd= *solidFndPtr;
4555 const int numMeshes =
_meshes.size();
4556 for (
int n=0; n<numMeshes; n++)
4567 TArray& dsfEqES =
dynamic_cast< TArray&
>(fndEqES[cells]);
4570 for(
int f=0; f<nSolidFaces; f++)
4572 double distIBSolidInvSum(0.0);
4573 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
4576 const int c = sFCCol[nc];
4582 double distIBSolid (0.0);
4584 distIBSolid =
sqrt(pow((faceCentroid[c][0]-solidFaceCentroid[f][0]),2)+
4585 pow((faceCentroid[c][1]-solidFaceCentroid[f][1]),2)+
4586 pow((faceCentroid[c][2]-solidFaceCentroid[f][2]),2));
4587 distIBSolidInvSum += 1/pow(distIBSolid,RelaxDistribution);
4589 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
4591 const int c = sFCCol[nc];
4597 T time_to_wall (0.0);
4598 T distIBSolid (0.0);
4599 const T uwall = v[f][0];
4600 const T vwall = v[f][1];
4601 const T wwall = v[f][2];
4602 distIBSolid =
sqrt(pow((faceCentroid[c][0]-solidFaceCentroid[f][0]),2)+
4603 pow((faceCentroid[c][1]-solidFaceCentroid[f][1]),2)+
4604 pow((faceCentroid[c][2]-solidFaceCentroid[f][2]),2));
4609 time_to_wall = (pow(distIBSolid,2)/((cx[j]-uwall)*(faceCentroid[c][0]-solidFaceCentroid[f][0])+(cy[j]-vwall)*(faceCentroid[c][1]-solidFaceCentroid[f][1])+(cz[j]-wwall)*(faceCentroid[c][2]-solidFaceCentroid[f][2])));
4613 solidFnd[f] += (dsfEqES[c]-(dsfEqES[c]-dsf[c])*exp(-time_to_wall*nue[c]))/(pow(distIBSolid,RelaxDistribution)*distIBSolidInvSum);
4619 fnd.
addArray(solidFaces,solidFndPtr);
4631 const int numMeshes =
_meshes.size();
4634 for (
int n=0; n<numMeshes; n++)
4645 const int numDirections =
_quadrature.getDirCount();
4649 const TArray& faceAreaMag =
4652 const int nibFaces = ibFaces.
getCount();
4654 for(
int f=0; f<nibFaces; f++)
4656 const int c0 = faceCells(f,0);
4657 const int c1 = faceCells(f,1);
4661 const int ibFace = ibFaceIndex[f];
4666 const VectorT3 en = faceArea[f]/faceAreaMag[f];
4667 for (
int j=0; j<numDirections; j++)
4669 const T c_dot_en = cx[j]*en[0]+cy[j]*en[1]+cz[j]*en[2];
4673 netFlux -= dsf[f]*c_dot_en*wts[j]/abs(c_dot_en);
4679 const VectorT3 en = faceArea[f]/faceAreaMag[f];
4680 for (
int j=0; j<numDirections; j++)
4682 const T c_dot_en = cx[j]*en[0]+cy[j]*en[1]+cz[j]*en[2];
4686 netFlux += dsf[f]*c_dot_en*wts[j]/abs(c_dot_en);
4694 MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &netFlux, 1, MPI::DOUBLE, MPI::SUM);
4699 for (
int n=0; n<numMeshes; n++)
4707 volumeSum += cellVolume[c];
4710 MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &volumeSum, 1, MPI::DOUBLE, MPI::SUM);
4713 netFlux /= volumeSum;
4714 for (
int n=0; n<numMeshes; n++)
4725 const int numDirections =
_quadrature.getDirCount();
4727 for (
int j=0; j<numDirections; j++)
4731 cellMass += wts[j]*dsf[c];
4734 for (
int j=0; j<numDirections; j++)
4740 fgam[c] = fgam[c]*(1+netFlux*cellVolume[c]/cellMass);
4741 dsf[c] = dsf[c]*(1+netFlux*cellVolume[c]/cellMass);
4752 const int numMeshes =
_meshes.size();
4759 for (
int n=0; n<numMeshes; n++)
4767 volumeSum += cellVolume[c];
4770 MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &volumeSum, 1, MPI::DOUBLE, MPI::SUM);
4773 netFlux /= volumeSum;
4774 for (
int n=0; n<numMeshes; n++)
4785 const int numDirections =
_quadrature.getDirCount();
4787 for (
int j=0; j<numDirections; j++)
4791 cellMass += wts[j]*dsf[c];
4794 for (
int j=0; j<numDirections; j++)
4800 fgam[c] = fgam[c]*(1+netFlux*cellVolume[c]/cellMass);
4801 dsf[c] = dsf[c]*(1+netFlux*cellVolume[c]/cellMass);
4810 const int numMeshes =
_meshes.size();
4813 for (
int n=0; n<numMeshes; n++)
4820 const int numDirections =
_quadrature.getDirCount();
4824 const TArray& faceAreaMag =
4827 const int nFaces = faces.
getCount();
4833 for (
int j=0; j<numDirections; j++)
4837 ndens_tot += wts[j]*dsf[c];
4842 cout <<
"Hello, I have" << ndens_tot <<
"number density";
4850 const int nSolidFaces = solidFaces.
getCount();
4851 for (
int i=0; i<nSolidFaces; i++)
4853 const int numDirections =
_quadrature.getDirCount();
4861 const TArray& solidFaceAreaMag =
4867 const T uwall = v[i][0];
4868 const T vwall = v[i][1];
4869 const T wwall = v[i][2];
4870 const T Twall = temperature[i];
4875 for (
int j=0; j<numDirections; j++)
4879 const VectorT3 en = solidFaceArea[i]/solidFaceAreaMag[i];
4880 const T c_dot_en = cx[j]*en[0]+cy[j]*en[1]+cz[j]*en[2];
4881 const T wallV_dot_en = uwall*en[0]+vwall*en[1]+wwall*en[2];
4882 const T fwall = 1.0/pow(pi*Twall,1.5)*exp(-(pow(cx[j]-uwall,2.0)+pow(cy[j]-vwall,2.0)+pow(cz[j]-wwall,2.0))/Twall);
4884 if (c_dot_en-wallV_dot_en > 0)
4886 Dmr = Dmr - fwall*wts[j]*(c_dot_en-wallV_dot_en);
4887 incomFlux=incomFlux-dsf[i]*wts[j]*(c_dot_en-wallV_dot_en);
4891 Nmr = Nmr + dsf[i]*wts[j]*(c_dot_en-wallV_dot_en);
4894 const T nwall = Nmr/Dmr;
4898 for (
int j=0; j<numDirections; j++)
4902 const VectorT3 en = solidFaceArea[i]/solidFaceAreaMag[i];
4903 const T c_dot_en = cx[j]*en[0]+cy[j]*en[1]+cz[j]*en[2];
4904 const T wallV_dot_en = uwall*en[0]+vwall*en[1]+wwall*en[2];
4905 if (c_dot_en-wallV_dot_en > 0)
4907 dsf[i] = nwall/pow(pi*Twall,1.5)*exp(-(pow(cx[j]-uwall,2.0)+pow(cy[j]-vwall,2.0)+pow(cz[j]-wwall,2.0))/Twall);
4917 for(
int sweepNo=0;sweepNo<sweeps;sweepNo++)
4923 for(
int sweepNo=0;sweepNo<sweeps;sweepNo++)
4930 const int numMeshes=
_meshes.size();
4931 for(
int msh=0;msh<numMeshes;msh++)
4964 if((num==1)||(num==0&&
_level==0))
4984 const int numMeshes=
_meshes.size();
4985 for(
int msh=0;msh<numMeshes;msh++)
4991 shared_ptr<StorageSite> solidFaces(
new StorageSite(-1));
5024 if((num==1)||(num==0&&
_level==0))
5040 const int numMeshes=
_meshes.size();
5043 for(
int msh=0;msh<numMeshes;msh++)
5049 shared_ptr<StorageSite> solidFaces(
new StorageSite(-1));
5070 lowResid=currentResid;
5072 if(currentResid<lowResid)
5073 lowResid=currentResid;
5080 const int numMeshes=
_meshes.size();
5083 for(
int msh=0;msh<numMeshes;msh++)
5105 lowResid=currentResid;
5107 if(currentResid<lowResid)
5108 lowResid=currentResid;
5149 else if(
_options.postCoarsestSweeps>1)
5199 else if(
_options.postCoarsestSweeps>1)
5206 const int numMeshes =
_meshes.size();
5208 for (
int n=0; n<numMeshes; n++)
5221 const TArray& coarserVol=
dynamic_cast<TArray&
>(coarserGeomFields.
volume[coarserCells]);
5226 for(
int dir=0;dir<numDir;dir++)
5230 Field& cfnd = *coarserdsf.
dsf[dir];
5231 Field& cfndInj = *coarserdsf0.
dsf[dir];
5232 Field& cfndFAS = *coarserdsfFAS.
dsf[dir];
5233 TArray& coarserVar=
dynamic_cast<TArray&
>(cfnd[coarserCells]);
5234 TArray& coarserInj=
dynamic_cast<TArray&
>(cfndInj[coarserCells]);
5235 TArray& coarserFAS=
dynamic_cast<TArray&
>(cfndFAS[coarserCells]);
5236 TArray& finerVar=
dynamic_cast<TArray&
>(fnd[finerCells]);
5237 TArray& finerRes=
dynamic_cast<TArray&
>(fndRes[finerCells]);
5239 for(
int c=0;c<cellCount;c++)
5241 const int fineCount=CoarserToFiner.
getCount(c);
5245 for(
int fc=0;fc<fineCount;fc++)
5247 const int cell=CoarserToFiner(c,fc);
5248 coarserVar[c]+=finerVar[cell]*finerVol[cell];
5249 coarserFAS[c]+=finerRes[cell];
5251 coarserVar[c]/=coarserVol[c];
5252 coarserInj[c]=coarserVar[c];
5262 for(
int c=0;c<cellCount;c++)
5264 const int fineCount=CoarserToFiner.
getCount(c);
5268 for(
int fc=0;fc<fineCount;fc++)
5270 const int cell=CoarserToFiner(c,fc);
5271 coarserVar[c]+=finerVar[cell]*finerVol[cell];
5272 coarserFAS[c]+=finerRes[cell];
5274 coarserVar[c]/=coarserVol[c];
5275 coarserInj[c]=coarserVar[c];
5284 const int numMeshes =
_meshes.size();
5285 for (
int n=0; n<numMeshes; n++)
5291 for(
int dir=0;dir<numDir;dir++)
5312 const int numMeshes =
_meshes.size();
5313 for (
int n=0; n<numMeshes; n++)
5319 for(
int dir=0;dir<numDir;dir++)
5338 const int numMeshes =
_meshes.size();
5340 for (
int n=0; n<numMeshes; n++)
5354 for(
int dir=0;dir<numDir;dir++)
5357 Field& cfnd = *coarserdsf.
dsf[dir];
5358 Field& cfndInj = *coarserdsf0.
dsf[dir];
5359 TArray& finerArray =
dynamic_cast<TArray&
>(fnd[finerCells]);
5360 TArray& coarserArray =
dynamic_cast<TArray&
>(cfnd[coarserCells]);
5361 TArray& injArray =
dynamic_cast<TArray&
>(cfndInj[coarserCells]);
5363 for(
int c=0;c<cellCount;c++)
5365 const int fineCount=CoarserToFiner.
getCount(c);
5366 const T correction=coarserArray[c]-injArray[c];
5368 for(
int fc=0;fc<fineCount;fc++)
5369 finerArray[CoarserToFiner(c,fc)]+=correction;
5377 for(
int c=0;c<cellCount;c++)
5379 const int fineCount=CoarserToFiner.
getCount(c);
5380 const VectorT3 correction=coarserArray[c]-injArray[c];
5382 for(
int fc=0;fc<fineCount;fc++)
5383 finerArray[CoarserToFiner(c,fc)]+=correction;
5393 T residualRatio(1.0);
5396 if ( MPI::COMM_WORLD.Get_rank() == 0 )
5397 cout<<
"Initial Residual:"<<
_initialResidual<<
" ResidualRatio: "<<residualRatio<<endl;
5401 #ifndef FVM_PARALLEL
5402 cout <<
"Initial Residual:"<<
_initialResidual<<
" ResidualRatio: "<<residualRatio<<endl;
5408 const T absTol=
_options.absoluteTolerance;
5409 const T relTol=
_options.relativeTolerance;
5410 const int show=
_options.showResidual;
5412 while((niters<iters) && ((
_residual>absTol)&&(residualRatio>relTol)))
5421 if((niters%show==0)&&(MPI::COMM_WORLD.Get_rank()==0))
5422 cout<<
"Iteration:"<<niters<<
" Residual:"<<
_residual<<
" ResidualRatio: "<<residualRatio<<endl;
5425 #ifndef FVM_PARALLEL
5427 cout<<
"Iteration:"<<niters<<
" Residual:"<<
_residual<<
" ResidualRatio: "<<residualRatio<<endl;
5439 T residualRatio(1.0);
5442 if ( MPI::COMM_WORLD.Get_rank() == 0 )
5443 cout<<
"Initial Residual:"<<
_initialResidual<<
" ResidualRatio: "<<residualRatio<<endl;
5447 #ifndef FVM_PARALLEL
5448 cout <<
"Initial Residual:"<<
_initialResidual<<
" ResidualRatio: "<<residualRatio<<endl;
5454 const T absTol=
_options.absoluteTolerance;
5455 const T relTol=
_options.relativeTolerance;
5456 const int show=
_options.showResidual;
5458 while((niters<iters) && ((
_residual>absTol)&&(residualRatio>relTol)))
5467 if((niters%show==0)&&(MPI::COMM_WORLD.Get_rank()==0))
5468 cout<<
"Iteration:"<<niters<<
" Residual:"<<
_residual<<
" ResidualRatio: "<<residualRatio<<endl;
5471 #ifndef FVM_PARALLEL
5473 cout<<
"Iteration:"<<niters<<
" Residual:"<<
_residual<<
" ResidualRatio: "<<residualRatio<<endl;
5485 const int nSolidFaces = solidFaces.
getCount();
5487 boost::shared_ptr<VectorT3Array>
5497 const TArray& solidFaceAreaMag =
5500 const int numMeshes =
_meshes.size();
5501 for (
int n=0; n<numMeshes; n++)
5525 for(
int f=0; f<nSolidFaces; f++){
5532 const IMatrix& mIC =
5533 dynamic_cast<const IMatrix&
>
5535 const Array<T>& iCoeffs = mIC.getCoeff();
5536 for(
int j=0;j<N123;j++){
5538 const TArray& f_dsf =
dynamic_cast<const TArray&
>(fnd[cells]);
5539 const TArray& fs_dsf =
dynamic_cast<const TArray&
>(fnd[solidFaces]);
5540 stress[0] -=pow((cx[j]-vs[f][0]),2.0)*fs_dsf[f]*wts[j];
5541 stress[1] -=pow((cy[j]-vs[f][1]),2.0)*fs_dsf[f]*wts[j];
5542 stress[2] -=pow((cz[j]-vs[f][2]),2.0)*fs_dsf[f]*wts[j];
5543 stress[3] -=(cx[j]-vs[f][0])*(cy[j]-vs[f][1])*fs_dsf[f]*wts[j];
5544 stress[4] -=(cy[j]-vs[f][1])*(cz[j]-vs[f][2])*fs_dsf[f]*wts[j];
5545 stress[5] -=(cx[j]-vs[f][0])*(cz[j]-vs[f][2])*fs_dsf[f]*wts[j];
5564 for(
int j=0;j<N123;j++){
5566 const TArray& f_dsf =
dynamic_cast<const TArray&
>(fnd[cells]);
5567 for(
int nc = sFCRow[f]; nc<sFCRow[f+1]; nc++)
5570 const int c = sFCCol[nc];
5571 if ( c < selfCount ){
5572 stress[0] +=pow((cx[j]-v[c][0]),2.0)*f_dsf[c]*wts[j];
5573 stress[1] +=pow((cy[j]-v[c][1]),2.0)*f_dsf[c]*wts[j];
5574 stress[2] +=pow((cz[j]-v[c][2]),2.0)*f_dsf[c]*wts[j];
5575 stress[3] +=(cx[j]-v[c][0])*(cy[j]-v[c][1])*f_dsf[c]*wts[j];
5576 stress[4] +=(cy[j]-v[c][1])*(cz[j]-v[c][2])*f_dsf[c]*wts[j];
5577 stress[5] +=(cx[j]-v[c][0])*(cz[j]-v[c][2])*f_dsf[c]*wts[j];
5585 const VectorT3& Af = solidFaceArea[f];
5586 force[f][0] = Af[0]*Ly*Lz*stress[0] + Af[1]*Lz*Lx*stress[3] + Af[2]*Lx*Ly*stress[5];
5587 force[f][1] = Af[0]*Ly*Lz*stress[3] + Af[1]*Lz*Lx*stress[1] + Af[2]*Lx*Ly*stress[4];
5588 force[f][2] = Af[0]*Ly*Lz*stress[5] + Af[1]*Lz*Lx*stress[4] + Af[2]*Ly*Ly*stress[2];
5590 force[f] /= solidFaceAreaMag[f];}
5598 pFile = fopen(
"cxyz0.plt",
"w");
5602 fprintf(pFile,
"%s \n",
"VARIABLES= cx, cy, cz, f,");
5603 fprintf(pFile,
"%s %i %s %i %s %i \n",
"ZONE I=", N3,
",J=",N2,
"K=",N1);
5604 fprintf(pFile,
"%s\n",
"F=POINT");
5605 const int numMeshes =
_meshes.size();
5606 const int cellno=
_options.printCellNumber;
5607 for (
int n=0; n<numMeshes; n++)
5616 for(
int j=0;j< numFields;j++)
5622 fprintf(pFile,
"%E %E %E %E %E\n",cx[j],cy[j],cz[j],f[cellno],fEq[cellno]);
const MeshList & _finestMeshes
const FaceGroupList & getBoundaryFaceGroups() const
const Array< int > & getCol() const
int getCount(const int i) const
map< string, shared_ptr< ArrayBase > > & getPersistenceData()
const Array< int > & getRow() const
void setJacobianBGK(SquareMatrix< T, 5 > &fjac, VectorT5 &fvec, const VectorT5 &xn, const VectorT3 &v, const int c)
map< const Mesh *, int > SizeMap
DistFunctFields< T > _dsfPtrInj
shared_ptr< FaceGroup > FaceGroupPtr
void computeIBFaceDsf(const StorageSite &solidFaces, const int method, const int RelaxDistribution=0)
T updateResid(const bool addFAS)
pair< Index, Index > EntryIndex
void OutputDsfBLOCK(const char *filename)
const StorageSite & getIBFaces() const
void CopyQuad(TQuad ©FromQuad)
const CRConnectivity & getConnectivity(const StorageSite &from, const StorageSite &to) const
DistFunctFields< T > & getdsfInj()
shared_ptr< TCOMET > TCOMETPtr
void COMETSolveFine(const int sweep, const int level)
const double ConservationofMassCheck()
void smooth(const int num)
shared_ptr< BCcellArray > BCellPtr
COMETModel(const MeshList &meshes, const int level, GeomFields &geomFields, MacroFields ¯oFields, Quadrature< T > &quad, const int ibm=0, GeomFields *finestGeomFields=NULL, const MeshList *finestMeshes=NULL, MacroFields *finestMacroFields=NULL)
std::map< int, COMETBC< T > * > COMETBCMap
void initializeCoarseMaxwellian()
std::vector< Field * > stdVectorField
DistFunctFields< T > _dsfPtr2
void makeFAS(const StorageSite &solidFaces)
shared_ptr< TArray > TArrptr
void weightedMaxwellian(double weight1, double uvel1, double vvel1, double wvel1, double uvel2, double vvel2, double wvel2, double temp1, double temp2)
Quadrature< T > & _quadrature
void setJacobianESBGK(SquareMatrix< T, 10 > &fjac, VectorT10 &fvec, const VectorT10 &xn, const VectorT3 &v, const int c)
shared_ptr< MeshList > MshLstPtr
NumTypeTraits< T >::T_Scalar T_Scalar
GeomFields & getGeomFields()
MatrixMappersMap _coarseGatherMaps
pair< const StorageSite *, const StorageSite * > SSPair
const StorageSite & createInteriorFaceGroup(const int size)
DistFunctFields< T > & getdsfRes()
const GatherMap & getGatherMapLevel1() const
const ScatterMap & getScatterMapLevel1() const
void findResid(const bool plusFAS)
const Array< int > & getIBFaceList() const
Field EntropyGenRate_Collisional
void computeSolidFaceDsf(const StorageSite &solidFaces, const int method, const int RelaxDistribution=0)
void applyZeroGradientBC(int f, GradMatrix &gMat) const
vector< BCellPtr > BCcellList
MFRPtr _initialKmodelNorm
map< const StorageSite *, shared_ptr< StorageSite > > GhostStorageSiteMap
T mag(const Vector< T, 3 > &a)
COMETModelOptions< T > _options
void setCount(const int selfCount, const int nGhost=0)
void setBCMap(COMETBCMap *bcMap)
void setConnectivity(const StorageSite &rowSite, const StorageSite &colSite, shared_ptr< CRConnectivity > conn)
void COMETSolve(const int sweep, const int level)
void initializeFineMaxwellian()
DistFunctFields< T > TDistFF
const StorageSite & createBoundaryFaceGroup(const int size, const int offset, const int id, const string &boundaryType)
void ComputeCollisionfrequency()
map< const StorageSite *, StorageSite * > SiteMap
shared_ptr< BCfaceArray > BfacePtr
FloatVal< T > getVal(const string varName) const
void setFinerLevel(TCOMET *fl)
DistFunctFields< T > & getdsfFAS()
void doSweeps(const int sweeps, const int num, const StorageSite &solidFaces)
void ComputeFineMacroparameters()
shared_ptr< GeomFields > GeoFldsPtr
DistFunctFields< T > _dsfPtrFAS
void correctMassDeficit2(double n1, double n2)
Tangent sqrt(const Tangent &a)
const CRConnectivity & getAllFaceCells() const
void initializeMaxwellianEq()
void syncGhostCoarsening(const MeshList &inMeshes, GeomFields &inGeomFields, MeshList &outMeshes)
const CRConnectivity & getCellFaces() const
void ComputeCOMETMacroparameters()
map< int, vector< int > > _faceReflectionArrayMap
void correctMassDeficit()
map< SSPair, shared_ptr< Array< int > > > MatrixMappersMap
const DistFunctFields< T > & getdsf2() const
COMETModelOptions< T > & getOptions()
Array< VectorT3 > VectorT3Array
void applyPressureOutletBC(int f, const X &outletTemperature, const X &outletPressure) const
const map< int, vector< int > > & getFaceReflectionArrayMap() const
const StorageSite & createInterfaceGroup(const int size, const int offset, const int id)
virtual void * getData() const
pair< const Field *, const StorageSite * > ArrayIndex
vector< BfacePtr > BCfaceList
int getScatterProcID() const
GeomFields & _finestGeomFields
int getGatherProcID() const
SquareMatrix< T, N > inverseGauss(SquareMatrix< T, N > &a, int size)
GhostStorageSiteMap _sharedSiteMap
void applyNSInterfaceBC() const
shared_ptr< StorageSite > SSPtr
DistFunctFields< T > & getdsf()
map< SSPair, shared_ptr< Matrix > > _interpolationMatrices
void NewtonsMethodBGK(const int ktrial)
void NewtonsMethodESBGK(const int ktrial)
map< Index, shared_ptr< StorageSite > > StorageSiteMap
void initializeMaxwellian()
void findResidFine(const bool plusFAS)
T updateResid(const bool addFAS, const StorageSite &solidFaces)
void applyRealWallBC(int f, const VectorX3 &WallVelocity, const X &WallTemperature, const X &accommodationCoefficient, const vector< int > &vecReflection, GradMatrix &gMat) const
const StorageSite & getFaces() const
void computeSolidFacePressure(const StorageSite &solidFaces)
MacroFields & _macroFields
MultiField::ArrayIndex Index
Array< StressTensorT6 > StressTensorArray
void MakeCoarseMesh1(const MeshList &inMeshes, GeomFields &inGeomFields, MeshList &outMeshes)
const StorageSite & getCells() const
void ComputeMacroparameters()
map< string, shared_ptr< ArrayBase > > _persistenceData
void computeSurfaceForce(const StorageSite &solidFaces, bool perUnitArea, bool IBM=0)
void MakeIBCoarseModel(TCOMET *finerModel, const StorageSite &solidFaces)
void EquilibriumDistributionESBGK()
void ComputeMacroparametersESBGK()
Array< VectorT6 > VectorT6Array
int getCountLevel1() const
void cycle(const StorageSite &solidFaces)
shared_ptr< CRConnectivity > CRPtr
void setCoarserLevel(TCOMET *cl)
const ScatterMap & getScatterMap() const
const MeshList & getMeshList()
void addArray(const StorageSite &, shared_ptr< ArrayBase > a)
void callCOMETBoundaryConditions()
const CRConnectivity & getFaceCells(const StorageSite &site) const
DistFunctFields< T > _dsfEqPtrES
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
const vector< int > & getData() const
MacroFields & _finestMacroFields
Array< VectorT10 > VectorT10Array
shared_ptr< VectorT3Array > VT3Ptr
StressTensor< T > StressTensorT6
Tangent fabs(const Tangent &a)
void SetBoundaryConditions()
T advance(const int iters, const StorageSite &solidFaces)
SizeMap _coarseGhostSizes
const GatherMap & getGatherMap() const
map< EntryIndex, shared_ptr< Matrix > > MatrixMap
DistFunctFields< T > _dsfPtr0
Field velocityFASCorrection
std::vector< Field * > dsf
int MakeCoarseMesh2(const MeshList &inMeshes, GeomFields &inGeomFields, GeomFields &coarseGeomFields, MeshList &outMeshes)
void applyPressureInletBC(int f, const X &inletTemperature, const X &inletPressure, GradMatrix &gMat) const
static void syncLocalVectorFields(std::vector< Field * > &dsf)
DistFunctFields< T > _dsfPtrRes
DistFunctFields< T > _dsfPtr
DistFunctFields< T > _dsfPtr1
Vector< T, 10 > VectorT10
const DistFunctFields< T > & getdsfEq() const
shared_ptr< MultiFieldReduction > MFRPtr
map< Index, int > MatrixSizeMap
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
const FaceGroupList & getInterfaceGroups() const
GeomFields _coarseGeomFields
DistFunctFields< T > _dsfEqPtr
void smooth(const int num, const StorageSite &solidFaces)
void InitializeMacroparameters()
MatrixMappersMap _coarseScatterMaps
void setCountLevel1(const int countLevel1)
const DistFunctFields< T > & getdsfEqES() const
DistFunctFields< T > & getdsf0()
void EquilibriumDistributionBGK()
std::map< int, COMETVC< T > * > COMETVCMap
void InitializeFgammaCoefficients()
shared_ptr< Mesh > MeshPtr
void ComputeCoarseMacroparameters()
void advance(const int iters)
void MakeCoarseIndex(const StorageSite &solidFaces)
void MakeCoarseModel(TCOMET *finerModel)
void doSweeps(const int sweeps, const int num)
const DistFunctFields< T > & getdsf1() const
void ConservationofMFSolid(const StorageSite &solidFaces) const
void weightedMaxwellian(double weight1, double uvel1, double uvel2, double temp1, double temp2)
pair< const StorageSite *, const StorageSite * > SSPair
vector< Mesh * > MeshList
Array< VectorT5 > VectorT5Array