void CollisionD2Q9BGK::dataToFile(string path){ if(rho == NULL) rho = allocate2DArray(lm->n.y, lm->n.x); if(ux == NULL) ux = allocate2DArray(lm->n.y, lm->n.x); if(uy == NULL) uy = allocate2DArray(lm->n.y, lm->n.x); cout<<"mem allocated"<<endl; double *rhoUTemp = new double[3]; for(int j = 0; j < lm->n.y; j++){ for(int i = 0; i < lm->n.x; i++){ rho[j][i] = get0moment(i, j); get1moment(i, j, rhoUTemp); ux[j][i] = rhoUTemp[X]/rho[j][i]; uy[j][i] = rhoUTemp[Y]/rho[j][i]; } } cout<<"vals calced"<<endl; stringstream ss, ssTemp; struct stat sb; ss.str(""); ss<<path; if (!stat(ss.str().c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)){ cout<<"creating directory: "<<ss.str()<<endl; mkdir(ss.str().c_str(), 0775); } // stringstream ss, ssTemp; // struct stat sb; // for(int i = 0; ; i++){ // ss.str(""); // ss<<"vis_scripts/data"; // ss<<""<<i<<"/"; // if (!stat(ss.str().c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)){ // cout<<"creating directory: "<<ss.str()<<endl; // mkdir(ss.str().c_str(), 0775); // break; // } // } cout<<"bgk base..."<<endl; ssTemp.str(""); ssTemp << ss.str(); ssTemp << "ux.csv"; write2DArray(ux, NULL, ssTemp.str(), lm->n.x, lm->n.y); ssTemp.str(""); ssTemp << ss.str(); ssTemp << "uy.csv"; write2DArray(uy, NULL, ssTemp.str(), lm->n.x, lm->n.y); ssTemp.str(""); ssTemp << ss.str(); ssTemp << "rho.csv"; write2DArray(rho, NULL, ssTemp.str(), lm->n.x, lm->n.y); }
void CollisionD2Q9AD::dataToFile(string path) { write2DArray(rho, path, lm->n.x, lm->n.y); }
void CollisionD2Q9LNP::dataToFile(string path) { write2DArray(ni, NULL, path, n.x, n.y); }
void CollisionD2Q9LPM::dataToFile(){ write2DArray(psi, NULL, "vis_scripts/data1/rho.csv", n.x, n.y); }