/** * Nettoie la case de l'ancienne position de l'entité. * @param board Le plateau de jeu sur lequel l'entité est retirée * @param entity L'entité à nettoyer */ void clearEntity(char board[ROWS][COLS], const Entity* entity) { goToXY(entity->pos->y, entity->pos->x); if (entity->caseBelow == THICK_CHAR) { setColor(THIN_CHAR_COLOR); board[entity->pos->x][entity->pos->y] = THIN_CHAR; putchar(convertCase(THIN_CHAR)); } else if (entity->caseBelow == SLIP_CHAR) { setColor(SLIP_CHAR_COLOR); board[entity->pos->x][entity->pos->y] = SLIP_CHAR; putchar(convertCase(SLIP_CHAR)); } else { setColor(entity->nextSymbolColor); board[entity->pos->x][entity->pos->y] = entity->nextSymbol; putchar(convertCase(entity->nextSymbol)); } resetColor(); }
void BBTCOView::constructContextMenu( QMenu * _cm ) { QAction * a = new QAction( embed::getIconPixmap( "bb_track" ), tr( "Open in Beat+Bassline-Editor" ), _cm ); _cm->insertAction( _cm->actions()[0], a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( openInBBEditor() ) ); _cm->insertSeparator( _cm->actions()[1] ); _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ), this, SLOT( resetName() ) ); _cm->addAction( embed::getIconPixmap( "edit_rename" ), tr( "Change name" ), this, SLOT( changeName() ) ); _cm->addAction( embed::getIconPixmap( "colorize" ), tr( "Change color" ), this, SLOT( changeColor() ) ); _cm->addAction( embed::getIconPixmap( "colorize" ), tr( "Reset color to default" ), this, SLOT( resetColor() ) ); }
static void dataLove(void) { int dx = 50; int dy = 0; static int blue = 0; static int inc = 1; setTextColor(GLOBAL(nickbg), RGB(7, blue, 3)); if (blue >= 7) { inc = -1; } else if (blue <= 0) { inc = 1; } blue += inc; setExtFont(GLOBAL(nickfont)); dy= (RESY - getFontHeight()) / 3 * 2; DoString(dx, dy, "<3"); resetColor(); }
/** * Dessine le plateau de jeu. * @param map Le fichier correspondant à la map * @param game L'état du jeu * @param board Le plateau à afficher */ void drawBoard(FILE* map, const GameState* game, char board[ROWS][COLS]) { unsigned short x, y; for (x = 0; x < ROWS; x++) { for (y = 0; y <= COLS; y++) { board[x][y] = fgetc(map); setColor(getCaseColor(board[x][y])); putchar(convertCase(board[x][y])); } } resetColor(); drawToolbar(game); drawPanel(); printf("\n"); closeMap(map); }
void VideoSource::toggleMute() { session->enableSource( ssrc, isMuted() ); enableRendering = !isMuted(); if ( isMuted() ) { baseBColor.R = 1.0f; baseBColor.G = 0.1f; baseBColor.B = 0.15f; // see resetColor for why we check for selected here if ( !selected ) setColor( baseBColor ); setSecondaryColor( baseBColor ); } else { resetColor(); destSecondaryColor.R = 0.0f; destSecondaryColor.G = 0.0f; destSecondaryColor.B = 0.0f; destSecondaryColor.A = 0.0f; setSecondaryColor( destSecondaryColor ); } }
void ChooseProgramList::setPrograms(const QVector<QString>& programs) { // Clear old check boxes QCheckBox *checkBox; foreach (checkBox, checkBoxes) delete checkBox; checkBoxes.clear(); // Create new check boxes checkBoxes.reserve(programs.size()); for(int i = 0;i < programs.size();++i) { checkBox = new QCheckBox(programs[i]); checkBox->setChecked(i < MAX_AUTO_CHECK); connect(checkBox, SIGNAL(toggled(bool)), SLOT(checkChanged(bool))); layout->addWidget(checkBox, 0, Qt::AlignLeft); checkBoxes.push_back(checkBox); } resetColor(); }
void HexEdge::init(vtkIdType p0, vtkIdType p1, vtkSmartPointer<vtkPoints> verts) { globalVertices = verts; vertIds->InsertId(0,p0); vertIds->InsertId(1,p1); myPoints->SetNumberOfPoints(2); setType(LINE); drawLine(); data->SetPoints(myPoints); data->SetLines(lines); tube->SetInput(data); tube->SetRadius(0.05); mapper->SetInputConnection(tube->GetOutputPort()); actor->SetMapper(mapper); resetColor(); }
/// Main loop and input handling int main() { hidecursor(); saveDefaultColor(); gen(level); setColor(2); printf("Welcome! Use WASD to move, ESC to quit.\n"); setColor(6); anykey("Hit any key to start.\n"); draw(); while (1) { // Input if (kbhit()) { char k = getkey(); int oldx = x, oldy = y; if (k == 'a') { --x; ++moves; } else if (k == 'd') { ++x; ++moves; } else if (k == 'w') { --y; ++moves; } else if (k == 's') { ++y; ++moves; } else if (k == KEY_ESCAPE) break; // Collisions if (lvl[x][y] & WALL) { x = oldx; y = oldy; } else if (lvl[x][y] & COIN) { coins++; lvl[x][y] ^= COIN; } else if (lvl[x][y] & TORCH) { torch+=20; lvl[x][y] ^= TORCH; } else if (lvl[x][y] & STAIRS_DOWN) gen(++level); // Drawing draw(); // Die if (--torch <= 0) break; } } cls(); resetColor(); showcursor(); return 0; }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_actionChangeMode_triggered(); break; case 1: on_actionSair_triggered(); break; case 2: on_actionConfigura_o_triggered(); break; case 3: mInitialH(); break; case 4: pInitialH(); break; case 5: mFinalH(); break; case 6: pFinalH(); break; case 7: mInitialS(); break; case 8: pInitialS(); break; case 9: mFinalS(); break; case 10: pFinalS(); break; case 11: mInitialV(); break; case 12: pInitialV(); break; case 13: mFinalV(); break; case 14: pFinalV(); break; case 15: resetColor(); break; case 16: setStart(); break; case 17: bMoveF(); break; case 18: bMoveB(); break; case 19: bMoveL(); break; case 20: bMoveR(); break; case 21: bRotL(); break; case 22: bRotR(); break; case 23: bStop(); break; default: ; } _id -= 24; } return _id; }
int main(int argc, char **argv) { PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); int iter = 1; double Re = 1; double Sc = 2000; double cfl = 10; double rho_l = 1.0; Solver *solverP = new PetscSolver(KSPCG,PCSOR); Solver *solverV = new PetscSolver(KSPCG,PCICC); Solver *solverC = new PetscSolver(KSPCG,PCICC); const char *binFolder = "./bin/"; const char *datFolder = "./dat/"; const char *vtkFolder = "./vtk/"; const char *simFolder = "./sim/"; string meshFile = "disk6-10-20.vtk"; string meshDir = (string) getenv("DATA_DIR"); meshDir += "/mesh/3d/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; m1.setMeshDisk(6,6,8); m1.setAdimenDisk(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setNeighbour(); m1.setTriEdge(); m1.setMapEdgeTri(); m1.setInitSurfaceArea(); m1.setSurfaceArea(); m1.setInitSurfaceVolume(); m1.setSurfaceVolume(); m1.tetMeshStats(); // F, G and H m1.setInfiniteDiskBC(1.3690760e-04,1.7819422e-04,8.8528405e-01); //m1.readAndSetPressureDiskBC("../../db/baseState/nuC/Sc2000/","p"); m1.setCDiskBC(); Simulator3D s1(m1); s1.setRe(Re); // Reynolds do disco (~1) s1.setSc(Sc); // Schmidt da concentracao (~2000) s1.setCfl(cfl); s1.setRho(rho_l); s1.setSolverVelocity(solverV); s1.setSolverPressure(solverP); s1.setSolverConcentration(solverC); //s1.init(); s1.initDiskBaseState("../../db/baseState/nuC/Sc2000/","analiticoNuC.dat"); s1.setDtEulerian(); s1.assembleNuC(); if( (*(argv+1)) == NULL ) { cout << endl; cout << "--------------> STARTING FROM 0" << endl; cout << endl; } else if( strcmp( *(argv+1),"restart") == 0 ) { cout << endl; cout << "--------------> RE-STARTING..." << endl; cout << endl; iter = s1.loadSolution("./","sim",atoi(*(argv+2))); s1.assembleK(); } InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveInfo("./","info",mesh); save.printSimulationReport(); int nIter = 1000; int nR = 5; for( int i=0;i<nIter;i++ ) { for( int j=0;j<nR;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << i*nR+j+iter << endl << endl; cout << resetColor(); /* dt variable */ //s1.setDtEulerian(); //s1.assembleNuC(); s1.matMount(); s1.matMountC(); s1.setUnCoupledBC(); s1.setUnCoupledCBC(); s1.stepSL(); s1.setRHS(); s1.setCRHS(); s1.unCoupled(); s1.unCoupledC(); s1.assembleK(); save.saveVonKarman(simFolder,"vk"); save.saveDiskRadiusError(simFolder, "vkError", "../../db/baseState/nuC/Sc2000/analiticoNuC.dat"); save.saveDiskError(datFolder, "diskError", "../../db/baseState/nuC/Sc2000/analiticoNuC.dat"); save.saveConvergence(datFolder,"convergence"); s1.saveOldData(); s1.timeStep(); cout << color(none,magenta,black); cout << "________________________________________ END of " << i*nR+j+iter << endl << endl;; cout << resetColor(); } save.saveVTK(vtkFolder,"sim",(i+1)*nR+iter-1); //save.saveVTKSurface(vtkFolder,"sim",(nR-1)+i*nR+iter-1); save.saveSol(binFolder,"sim",(i+1)*nR+iter-1); save.printMeshReport(); save.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); int iter = 1; real Re = 91; real We = 0.23; real c1 = 0.0; // lagrangian real c2 = 1.0; // smooth vel real c3 = 10.0; // smooth coord (fujiwara) real d1 = 1.0; // surface tangent velocity u_n=u-u_t real d2 = 0.1; // surface smooth cord (fujiwara) real alpha = 1.0; real mu_in = 1.78E-5; real mu_out = 1.0E-3; real rho_in = 1.25; real rho_out = 1000; real cfl = 0.5; string meshFile = "annular.msh"; //string meshFile = "annularSquare.msh"; //Solver *solverP = new PetscSolver(KSPGMRES,PCILU); Solver *solverP = new PetscSolver(KSPGMRES,PCJACOBI); Solver *solverV = new PetscSolver(KSPCG,PCJACOBI); Solver *solverC = new PetscSolver(KSPCG,PCICC); const char *binFolder = "./bin/"; const char *vtkFolder = "./vtk/"; const char *mshFolder = "./msh/"; const char *datFolder = "./dat/"; string meshDir = (string) getenv("DATA_DIR"); meshDir += "/gmsh/3d/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; Simulator3D s1; const char *mesh1 = mesh; m1.readMSH(mesh1); m1.setInterfaceBC(); m1.setTriEdge(); m1.setWallInterfaceBC(); m1.mesh2Dto3D(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setRe(Re); s1.setWe(We); s1.setC1(c1); s1.setC2(c2); s1.setC3(c3); s1.setD1(d1); s1.setD2(d2); s1.setAlpha(alpha); s1.setMu(mu_in,mu_out); s1.setRho(rho_in,rho_out); s1.setCfl(cfl); s1.initAnnular(); s1.setDtALETwoPhase(); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveVTKSurface(vtkFolder,"geometry"); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); int nIter = 3000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << i << endl << endl; cout << resetColor(); //s1.stepLagrangian(); s1.stepALE(); s1.setDtALETwoPhase(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.setUnCoupledBC(); s1.setRHS(); s1.setGravity("+Z"); //s1.setInterface(); s1.setInterfaceGeo(); s1.unCoupled(); save.saveMSH(mshFolder,"newMesh",i); save.saveVTK(vtkFolder,"sim",i); save.saveVTKSurface(vtkFolder,"sim",i); save.saveSol(binFolder,"sim",i); save.saveBubbleInfo(datFolder); save.chordalPressure(datFolder,"chordalPressure",i); s1.saveOldData(); s1.timeStep(); cout << color(none,magenta,black); cout << "________________________________________ END of " << i << endl << endl;; cout << resetColor(); iter++; } Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.setNormalAndKappa(); m1.initMeshParameters(); // 3D operations //m1.insert3dMeshPointsByDiffusion(); m1.remove3dMeshPointsByDiffusion(); //m1.removePointByVolume(); //m1.removePointsByInterfaceDistance(); //m1.remove3dMeshPointsByDistance(); m1.remove3dMeshPointsByHeight(); m1.delete3DPoints(); // surface operations m1.smoothPointsByCurvature(); m1.insertPointsByLength("curvature"); //m1.insertPointsByCurvature("flat"); //m1.removePointsByCurvature(); //m1.insertPointsByInterfaceDistance("flat"); m1.contractEdgesByLength("curvature"); //m1.removePointsByLength(); //m1.flipTriangleEdges(); //m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ //m1.mesh2Dto3DOriginal(); m1.mesh3DPoints(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setGenericBC(); Simulator3D s2(m1,s1); s2.applyLinearInterpolation(mOld); s1 = s2; s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); //PetscInitializeNoArguments(); int iter = 0; double velVCrossflow = 0.0; // i.e. V_crossflow = velVCrossflow x V_jet double velWCrossflow = velVCrossflow; //const char* _frame = "fixed"; const char* _frame = "moving"; string _physGroup = "\"wallInflowVTransverse\""; double betaGrad = 0.0; Solver *solverP = new PetscSolver(KSPCG,PCILU); Solver *solverV = new PCGSolver(); Solver *solverC = new PCGSolver(); string meshFile = "crossflow-3d-Lp1.5-b0.09.msh"; const char* name = "ms"; const char *binFolder = "null"; const char *datFolder = "null"; const char *mshFolder = "null"; const char *vtkFolder = "null"; if( strcmp( name,"wl") == 0 ) { binFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/bin/"; datFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/dat/"; mshFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/msh/"; vtkFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/vtk/"; } else { binFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/bin/"; datFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/dat/"; mshFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/msh/"; vtkFolder = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/vtk/"; } string meshDir = (string) getenv("MESH3D_DIR"); if( strcmp( _frame,"moving") == 0 ) meshDir += "/rising/movingFrame/" + meshFile; else meshDir += "/rising/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; cout << endl; cout << "--------------> RE-STARTING..." << endl; cout << endl; string mshBase = "null"; if( strcmp( name,"wl") == 0 ) mshBase = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/msh/newMesh-"; else mshBase = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/msh/newMesh-"; // load surface mesh string aux = *(argv+1); string file = mshBase + *(argv+1) + (string) ".msh"; const char *mesh2 = file.c_str(); m1.readMSH(mesh2); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); string vtkBase = "null"; if( strcmp( name,"wl") == 0 ) vtkBase = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/vtk/sim-"; else vtkBase = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/vtk/sim-"; // load 3D mesh file = vtkBase + *(argv+1) + (string) ".vtk"; const char *vtkFile = file.c_str(); m1.readVTK(vtkFile); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.readVTKHeaviside(vtkFile); m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setCrossflowVVelocity(velVCrossflow); m1.setCrossflowWVelocity(velWCrossflow); m1.setGenericBCPBCNew(_physGroup); m1.setGenericBC(); Periodic3D pbc(m1); //pbc.MountPeriodicVectorsNew("noPrint"); pbc.MountPeriodicVectors("noPrint"); Simulator3D s1(pbc,m1); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); const char *dirBase = "null"; if( strcmp( name,"wl") == 0 ) dirBase = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-1.0-longmire-Lp5/"; else dirBase = "/work/gcpoliveira/post-processing/3d/crossflow-lambda-0.0-meister-Lp1.5-b0.09/"; iter = s1.loadSolution(dirBase,"sim",atoi(*(argv+1))); // Point's distribution Helmholtz3D h1(m1); h1.setBC(); h1.initRisingBubble(); h1.assemble(); h1.setk(0.2); h1.matMountC(); h1.setUnCoupledCBC(); h1.setCRHS(); h1.unCoupledC(); h1.setModel3DEdgeSize(); InOut save(m1,s1); // cria objeto de gravacao save.saveVTKSurface(vtkFolder,"geometry"); save.saveVTKPBC(vtkFolder,"initial",0,betaGrad); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); double uinst=0; double vinst=0; double winst=0; double uref=0; double vref=0; double wref=0; double xref=0; double yref=0; double zref=0; double xinit=0; double yinit=0; double zinit=0; double dx=0; double dy=0; double dz=0; if( strcmp( _frame,"moving") == 0 ) { // moving uref = s1.getURef(); xref = s1.getXRef(); vref = s1.getVRef(); yref = s1.getYRef(); wref = s1.getWRef(); zref = s1.getZRef(); s1.setCentroidVelPos(); xinit = s1.getCentroidPosXAverage(); // initial x centroid yinit = s1.getCentroidPosYAverage(); // initial y centroid zinit = s1.getCentroidPosZAverage(); // initial z centroid } int nIter = 50000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl; cout << resetColor(); if( strcmp( _frame,"moving") == 0 ) { // moving frame dx = s1.getCentroidPosXAverage() - xinit; // mov. frame x displacement dy = s1.getCentroidPosYAverage() - yinit; // mov. frame y displacement dz = s1.getCentroidPosZAverage() - zinit; // mov. frame z displacement uinst = s1.getCentroidVelXAverage() + dx/s1.getDt(); // uc + correction vinst = s1.getCentroidVelYAverage() + dy/s1.getDt(); // vc + correction winst = s1.getCentroidVelZAverage() + dz/s1.getDt(); // wc + correction uref += uinst; // sums to recover inertial vel vref += vinst; wref += winst; xref += uref*s1.getDt(); yref += vref*s1.getDt(); zref += wref*s1.getDt(); cout << "uref: " << uref << " xref: " << xref << endl; cout << "vref: " << vref << " yref: " << yref << endl; cout << "wref: " << wref << " zref: " << zref << endl; cout << "uinst: " << uinst << " vinst: " << vinst << " winst: " << winst << endl; cout << "dx: " << dx << endl; cout << "dy: " << dy << endl; cout << "dz: " << dz << endl; s1.setUSol(uinst); // subtraction for inertial frame: u - u_MFR s1.setVSol(vinst); // subtraction for inertial frame: v - v_MFR s1.setWSol(winst); // subtraction for inertial frame: w - w_MFR m1.setCrossflowVVelocity(velVCrossflow); // set of crossflow velocity for BC m1.setCrossflowWVelocity(velWCrossflow); // set of crossflow velocity for BC m1.setGenericBCPBCNew(_physGroup); m1.setGenericBC(uref,vref,wref); // crossflow condition //pbc.MountPeriodicVectorsNew("print"); pbc.MountPeriodicVectors("print"); s1.setURef(uref); // sets to recover the inertial physics; ease prints in InOut s1.setVRef(vref); s1.setWRef(wref); s1.setXRef(xref); s1.setYRef(yref); s1.setZRef(zref); } s1.setDtALETwoPhase(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); s1.stepALEPBC(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.setUnCoupledBC(); //s1.setGravity("-Z"); //s1.setBetaFlowLiq("+X"); s1.setRHS(); s1.setCopyDirectionPBC("RL"); s1.setInterfaceGeo(); //s1.unCoupledPBCNew(); s1.unCoupledPBC(); if ( i%15 == 0 ) { save.saveVTKPBC(vtkFolder,"sim",iter,betaGrad); save.saveVTKSurfacePBC(vtkFolder,"sim",iter,betaGrad); save.saveMSH(mshFolder,"newMesh",iter); save.saveSol(binFolder,"sim",iter); save.saveBubbleInfo(datFolder); save.bubbleWallDistance(datFolder,"dist",iter); save.saveBubbleShapeFactors(datFolder,"shapeFactors",iter); } s1.saveOldData(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl; cout << resetColor(); s1.timeStep(); iter++; } Helmholtz3D h2(m1,h1); h2.setBC(); h2.initRisingBubble(); h2.assemble(); h2.setk(0.2); h2.matMountC(); h2.setUnCoupledCBC(); h2.setCRHS(); h2.unCoupledC(); h2.saveVTK(vtkFolder,"edge",iter-1); //h2.saveChordalEdge(datFolder,"edge",iter-1); h2.setModel3DEdgeSize(); Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ m1.setNormalAndKappa(); m1.initMeshParameters(); // 3D mesh operations m1.insert3dMeshPointsByDiffusion(6.5); m1.remove3dMeshPointsByDiffusion(1.5); //m1.removePointByVolume(); //m1.removePointsByInterfaceDistance(); //m1.remove3dMeshPointsByDistance(); m1.remove3dMeshPointsByHeight(); m1.delete3DPoints(); // surface mesh operations m1.smoothPointsByCurvature(); m1.insertPointsByLength("curvature"); //m1.insertPointsByCurvature("flat"); //m1.removePointsByCurvature(); //m1.insertPointsByInterfaceDistance("flat"); m1.contractEdgesByLength("curvature"); //m1.removePointsByLength(); m1.flipTriangleEdges(); m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ m1.mesh3DPoints(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); if( strcmp( _frame,"moving") == 0 ) { m1.setCrossflowVVelocity(velVCrossflow); m1.setCrossflowWVelocity(velWCrossflow); m1.setGenericBCPBCNew(_physGroup); m1.setGenericBC(uref,vref,wref); //pbc.MountPeriodicVectorsNew("noPrint"); pbc.MountPeriodicVectors("noPrint"); } else { m1.setCrossflowVVelocity(velVCrossflow); m1.setCrossflowWVelocity(velWCrossflow); m1.setGenericBCPBCNew(_physGroup); m1.setGenericBC(); //pbc.MountPeriodicVectorsNew("noPrint"); pbc.MountPeriodicVectors("noPrint"); } Simulator3D s2(m1,s1); s2.applyLinearInterpolation(mOld); s1 = s2; s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); if ( i%15 == 0 ) { InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } } PetscFinalize(); return 0; }
void MainWindow::on_actionReset_Color_triggered() { resetColor(); }
ConfigWindow::ConfigWindow(QWidget *parent) : QDialog(parent, Qt::Dialog | Qt::WindowCloseButtonHint) { setWindowTitle(tr("Configuration")); QGroupBox *dependances = new QGroupBox(tr("Dépendances"), this); listFF7 = new QTreeWidget(dependances); listFF7->setColumnCount(1); listFF7->setUniformRowHeights(true); listFF7->setHeaderLabels(QStringList(tr("Final Fantasy VII installés"))); listFF7->setFixedHeight(80); ff7ButtonMod = new QPushButton(dependances); ff7ButtonRem = new QPushButton(tr("Supprimer"), dependances); kernelAuto = new QCheckBox(tr("kernel2.bin"), dependances); kernelPath = new QLabel(dependances); kernelPath->setFixedWidth(500); kernelButton = new QPushButton(tr("Changer"), dependances); windowAuto = new QCheckBox(tr("window.bin"), dependances); windowPath = new QLabel(dependances); windowPath->setFixedWidth(500); windowButton = new QPushButton(tr("Changer"), dependances); charAuto = new QCheckBox(tr("char.lgp"), dependances); charPath = new QLabel(dependances); charPath->setFixedWidth(500); charButton = new QPushButton(tr("Changer"), dependances); QGridLayout *dependLayout = new QGridLayout(dependances); dependLayout->addWidget(listFF7, 0, 0, 3, 2); dependLayout->addWidget(ff7ButtonMod, 0, 2); dependLayout->addWidget(ff7ButtonRem, 1, 2); dependLayout->setRowStretch(2, 1); dependLayout->addWidget(kernelAuto, 3, 0); dependLayout->addWidget(kernelPath, 3, 1); dependLayout->addWidget(kernelButton, 3, 2); dependLayout->addWidget(windowAuto, 4, 0); dependLayout->addWidget(windowPath, 4, 1); dependLayout->addWidget(windowButton, 4, 2); dependLayout->addWidget(charAuto, 5, 0); dependLayout->addWidget(charPath, 5, 1); dependLayout->addWidget(charButton, 5, 2); QGroupBox *openGL = new QGroupBox(tr("OpenGL"), this); disableOGL = new QCheckBox(tr("Désactiver OpenGL"), openGL); QGridLayout *OGLLayout = new QGridLayout(openGL); OGLLayout->addWidget(disableOGL, 0, 0); QGroupBox *textEditor = new QGroupBox(tr("Editeur de texte"), this); windowColor1 = new QPushButton(textEditor); windowColor2 = new QPushButton(textEditor); windowColor3 = new QPushButton(textEditor); windowColor4 = new QPushButton(textEditor); windowPreview = new QLabel(textEditor); windowColorReset = new QPushButton(tr("Valeurs par défaut"), textEditor); optiText = new QCheckBox(trUtf8("Optimiser automatiquement les duos de caract\xc3\xa8res \xc2\xab . \xc2\xbb, \xc2\xab .\" \xc2\xbb et \xc2\xab \xe2\x80\xa6\" \xc2\xbb.")); optiText->hide();//TODO japEnc = new QCheckBox(tr("Caractères japonais"), textEditor); listCharNames = new QComboBox(textEditor); for(int i=0 ; i<9 ; ++i) { listCharNames->addItem(QIcon(QString(":/images/icon-char-%1.png").arg(i)), Data::char_names.at(i)); } charNameEdit = new QLineEdit(textEditor); charNameEdit->setMaxLength(9); autoSizeMarginEdit = new QSpinBox(textEditor); autoSizeMarginEdit->setRange(0, 320); spacedCharactersWidthEdit = new QSpinBox(textEditor); spacedCharactersWidthEdit->setRange(0, 320); QGridLayout *windowPreviewLayout = new QGridLayout; windowPreviewLayout->addWidget(windowColor1, 0, 0, Qt::AlignRight | Qt::AlignTop); windowPreviewLayout->addWidget(windowColor3, 1, 0, Qt::AlignRight | Qt::AlignBottom); windowPreviewLayout->addWidget(windowPreview, 0, 1, 2, 1, Qt::AlignCenter); windowPreviewLayout->addWidget(windowColor2, 0, 2, Qt::AlignLeft | Qt::AlignTop); windowPreviewLayout->addWidget(windowColor4, 1, 2, Qt::AlignLeft | Qt::AlignBottom); windowPreviewLayout->addWidget(windowColorReset, 2, 0, 1, 3, Qt::AlignLeft); windowPreviewLayout->setColumnStretch(3, 1); QGridLayout *textEditorLayout = new QGridLayout(textEditor); textEditorLayout->addWidget(japEnc, 0, 0, 1, 2); // windowPreviewLayout->addWidget(optiText, 1, 0, 1, 2); textEditorLayout->addLayout(windowPreviewLayout, 1, 0, 4, 2, Qt::AlignTop); textEditorLayout->addWidget(listCharNames, 0, 2, 1, 2, Qt::AlignTop); textEditorLayout->addWidget(charNameEdit, 1, 2, 1, 2, Qt::AlignTop); textEditorLayout->addWidget(new QLabel(tr("Taille auto. : marge à droite")), 3, 2, Qt::AlignBottom); textEditorLayout->addWidget(autoSizeMarginEdit, 3, 3, Qt::AlignBottom); textEditorLayout->addWidget(new QLabel(tr("Largeur {SPACED CHARACTERS}")), 4, 2, Qt::AlignBottom); textEditorLayout->addWidget(spacedCharactersWidthEdit, 4, 3, Qt::AlignBottom); textEditorLayout->setRowStretch(2, 1); QGroupBox *scriptEditor = new QGroupBox(tr("Editeur de script"), this); expandedByDefault = new QCheckBox(tr("Lignes expansées par défaut"), scriptEditor); QVBoxLayout *scriptEditorLayout = new QVBoxLayout(scriptEditor); scriptEditorLayout->addWidget(expandedByDefault); scriptEditorLayout->addStretch(); QGroupBox *misc = new QGroupBox(tr("Divers"), this); lzsNotCheck = new QCheckBox(tr("Ne pas vérifier strictement le format des fichiers"), misc); QVBoxLayout *miscLayout = new QVBoxLayout(misc); miscLayout->addWidget(lzsNotCheck); miscLayout->addStretch(); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); QGridLayout *layout = new QGridLayout(this); layout->addWidget(dependances, 0, 0, 1, 2); layout->addWidget(openGL, 1, 0, 1, 2); layout->addWidget(textEditor, 2, 0, 1, 2); layout->addWidget(scriptEditor, 3, 0); layout->addWidget(misc, 3, 1); layout->addWidget(buttonBox, 4, 0, 1, 2); connect(listFF7, SIGNAL(itemSelectionChanged()), SLOT(changeFF7ListButtonsState())); connect(ff7ButtonMod, SIGNAL(released()), SLOT(modifyCustomFF7Path())); connect(ff7ButtonRem, SIGNAL(released()), SLOT(removeCustomFF7Path())); connect(kernelAuto, SIGNAL(toggled(bool)), SLOT(kernelAutoChange(bool))); connect(windowAuto, SIGNAL(toggled(bool)), SLOT(windowAutoChange(bool))); connect(charAuto, SIGNAL(toggled(bool)), SLOT(charAutoChange(bool))); connect(kernelButton, SIGNAL(released()), SLOT(changeKernelPath())); connect(windowButton, SIGNAL(released()), SLOT(changeWindowPath())); connect(charButton, SIGNAL(released()), SLOT(changeCharPath())); connect(windowColor1, SIGNAL(released()), SLOT(changeColor())); connect(windowColor2, SIGNAL(released()), SLOT(changeColor())); connect(windowColor3, SIGNAL(released()), SLOT(changeColor())); connect(windowColor4, SIGNAL(released()), SLOT(changeColor())); connect(windowColorReset, SIGNAL(released()), SLOT(resetColor())); connect(listCharNames, SIGNAL(currentIndexChanged(int)), SLOT(fillCharNameEdit())); connect(charNameEdit, SIGNAL(textEdited(QString)), SLOT(setCharName(QString))); connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); fillConfig(); changeFF7ListButtonsState(); }
void ColorCount::resetAll() { for(int i = 0; i < m_number_of_colors; ++i) resetColor(i); }
void AutocompletingComboBox::focusOutEvent(QFocusEvent * ev) { resetColor(); QComboBox::focusOutEvent(ev); }
int main(int argc, char **argv) { const char *mshFolder = "./msh/"; const char *vtkFolder = "./vtk/"; const char *datFolder = "./dat/"; /* meshes */ vector<const char*> mesh; mesh.resize(43); mesh[0] = "../../db/gmsh/3d/cylinder/curvature/0.90.msh"; mesh[1] = "../../db/gmsh/3d/cylinder/curvature/0.85.msh"; mesh[2] = "../../db/gmsh/3d/cylinder/curvature/0.80.msh"; mesh[3] = "../../db/gmsh/3d/cylinder/curvature/0.75.msh"; mesh[4] = "../../db/gmsh/3d/cylinder/curvature/0.70.msh"; mesh[5] = "../../db/gmsh/3d/cylinder/curvature/0.65.msh"; mesh[6] = "../../db/gmsh/3d/cylinder/curvature/0.60.msh"; mesh[7] = "../../db/gmsh/3d/cylinder/curvature/0.55.msh"; mesh[8] = "../../db/gmsh/3d/cylinder/curvature/0.50.msh"; mesh[9] = "../../db/gmsh/3d/cylinder/curvature/0.45.msh"; mesh[10] = "../../db/gmsh/3d/cylinder/curvature/0.40.msh"; mesh[11] = "../../db/gmsh/3d/cylinder/curvature/0.35.msh"; mesh[12] = "../../db/gmsh/3d/cylinder/curvature/0.30.msh"; mesh[13] = "../../db/gmsh/3d/cylinder/curvature/0.25.msh"; mesh[14] = "../../db/gmsh/3d/cylinder/curvature/0.24.msh"; mesh[15] = "../../db/gmsh/3d/cylinder/curvature/0.23.msh"; mesh[16] = "../../db/gmsh/3d/cylinder/curvature/0.22.msh"; mesh[17] = "../../db/gmsh/3d/cylinder/curvature/0.21.msh"; mesh[18] = "../../db/gmsh/3d/cylinder/curvature/0.20.msh"; mesh[19] = "../../db/gmsh/3d/cylinder/curvature/0.19.msh"; mesh[20] = "../../db/gmsh/3d/cylinder/curvature/0.18.msh"; mesh[21] = "../../db/gmsh/3d/cylinder/curvature/0.17.msh"; mesh[22] = "../../db/gmsh/3d/cylinder/curvature/0.16.msh"; mesh[23] = "../../db/gmsh/3d/cylinder/curvature/0.15.msh"; mesh[24] = "../../db/gmsh/3d/cylinder/curvature/0.14.msh"; mesh[25] = "../../db/gmsh/3d/cylinder/curvature/0.13.msh"; mesh[26] = "../../db/gmsh/3d/cylinder/curvature/0.12.msh"; mesh[27] = "../../db/gmsh/3d/cylinder/curvature/0.11.msh"; mesh[28] = "../../db/gmsh/3d/cylinder/curvature/0.10.msh"; mesh[29] = "../../db/gmsh/3d/cylinder/curvature/0.095.msh"; mesh[30] = "../../db/gmsh/3d/cylinder/curvature/0.09.msh"; mesh[31] = "../../db/gmsh/3d/cylinder/curvature/0.085.msh"; mesh[32] = "../../db/gmsh/3d/cylinder/curvature/0.08.msh"; mesh[33] = "../../db/gmsh/3d/cylinder/curvature/0.075.msh"; mesh[34] = "../../db/gmsh/3d/cylinder/curvature/0.07.msh"; mesh[35] = "../../db/gmsh/3d/cylinder/curvature/0.065.msh"; mesh[36] = "../../db/gmsh/3d/cylinder/curvature/0.06.msh"; mesh[37] = "../../db/gmsh/3d/cylinder/curvature/0.055.msh"; mesh[38] = "../../db/gmsh/3d/cylinder/curvature/0.05.msh"; mesh[39] = "../../db/gmsh/3d/cylinder/curvature/0.045.msh"; mesh[40] = "../../db/gmsh/3d/cylinder/curvature/0.04.msh"; mesh[41] = "../../db/gmsh/3d/cylinder/curvature/0.035.msh"; mesh[42] = "../../db/gmsh/3d/cylinder/curvature/0.03.msh"; for( int i=0;i<(int) mesh.size();i++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << i << endl << endl; cout << resetColor(); Model3D m1; Simulator3D s1(m1); m1.readMSH(mesh[i]); m1.setInterfaceBC(); m1.setTriEdge(); m1.restoreMappingArrays(); m1.setNormalAndKappa(); m1.setSurfaceVolume(); m1.setSurfaceArea(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); InOut save(m1,s1); // cria objeto de gravacao save.saveMSH(mshFolder,"newMesh",i); save.saveVTKSurface(vtkFolder,"sim",i); save.saveKappaErrorCylinder(datFolder); save.saveVolumeCorrection(datFolder); cout << color(none,magenta,black); cout << "________________________________________ END of " << i << endl << endl;; cout << resetColor(); } return 0; }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); //PetscInitializeNoArguments(); //double bubbleDiam = 3.0E-3; // sqrt(Ar) = 535.83 ; Eo = 1.2091 //double bubbleDiam = 4.0E-3; // sqrt(Ar) = 824.96 ; Eo = 2.1495 double bubbleDiam = 5.2E-3; // sqrt(Ar) = 12228.0 ; Eo = 3.6327 double mu_in = 18.21E-6; double mu_out = 958.08E-6; double rho_in = 1.205; double rho_out = 998.0; double gravity = 9.8; double sigma = 0.0728; double betaGrad = 1.0; // 0.9625 double Re = sqrt( CalcArchimedesBuoyancy(gravity,bubbleDiam,rho_out,mu_out ) ); double We = CalcEotvos(gravity,bubbleDiam,rho_out,sigma); double Fr = 1.0; /* // Rabello's thesis: sugar-syrup 1 double Re = 33.0413; double Sc = 1.0; double Fr = 1.0; double We = 115.662; double mu_in = 1.78E-5; double mu_out = 0.5396; double rho_in = 1.225; double rho_out = 1350.0; */ int iter = 0; double alpha = 1.0; double cfl = 0.5; double c1 = 0.0; // lagrangian double c2 = 0.1; // smooth vel double c3 = 10.0; // smooth coord (fujiwara) double d1 = 1.0; // surface tangent velocity u_n=u-u_t double d2 = 0.1; // surface smooth cord (fujiwara) //const char* _frame = "fixed"; const char* _frame = "moving"; string physGroup = "\"wallInflowZeroU\""; Solver *solverP = new PetscSolver(KSPGMRES,PCILU); Solver *solverV = new PetscSolver(KSPCG,PCICC); Solver *solverC = new PetscSolver(KSPCG,PCICC); /* string meshFile = "rising-moving-x.msh"; const char *binFolder = "/home/gcpoliveira/post-processing/vtk/3d/rising-pbc-moving/bin/"; const char *mshFolder = "/home/gcpoliveira/post-processing/vtk/3d/rising-pbc-moving/msh/"; const char *datFolder = "/home/gcpoliveira/post-processing/vtk/3d/rising-pbc-moving/dat/"; const char *vtkFolder = "/home/gcpoliveira/post-processing/vtk/3d/rising-pbc-moving/"; */ // cell-2D string meshFile = "unit-cell-s-2D-3d.msh"; // 1 /* const char *binFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1/bin/"; const char *datFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1/dat/"; const char *mshFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1/msh/"; const char *vtkFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1/vtk/"; */ // 2 /* const char *binFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-2/bin/"; const char *datFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-2/dat/"; const char *mshFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-2/msh/"; const char *vtkFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-2/vtk/"; */ // 3 const char *binFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-3/bin/"; const char *datFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-3/dat/"; const char *mshFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-3/msh/"; const char *vtkFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-2D-nb1-3/vtk/"; /* // cell-D string meshFile = "unit-cell-s-D-3d.msh"; const char *binFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-D-nb1/bin/"; const char *vtkFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-D-nb1/"; const char *datFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-D-nb1/dat/"; const char *mshFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-D-nb1/msh/"; */ /* // cell-0.5D string meshFile = "unit-cell-s-0.5D-3d.msh"; const char *binFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-0.5D-nb1/bin/"; const char *vtkFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-0.5D-nb1/"; const char *datFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-0.5D-nb1/dat/"; const char *mshFolder = "/home/gcpoliveira/post-processing/vtk/3d/unit-cell-s-0.5D-nb1/msh/"; */ string meshDir = (string) getenv("MESH3D_DIR"); if( strcmp( _frame,"moving") == 0 ) meshDir += "/rising/movingFrame/" + meshFile; else meshDir += "/rising/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; cout << endl; cout << "--------------> STARTING FROM 0" << endl; cout << endl; const char *mesh1 = mesh; m1.readMSH(mesh1); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(); Periodic3D pbc(m1); pbc.MountPeriodicVectorsNew("print"); Simulator3D s1(pbc,m1); s1.setRe(Re); s1.setWe(We); s1.setFr(Fr); s1.setC1(c1); s1.setC2(c2); s1.setC3(c3); s1.setD1(d1); s1.setD2(d2); s1.setAlpha(alpha); s1.setMu(mu_in,mu_out); s1.setRho(rho_in,rho_out); s1.setCfl(cfl); s1.init(); s1.setBetaPressureLiquid(betaGrad); s1.setDtALETwoPhase(); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); // Point's distribution Helmholtz3D h1(m1); h1.setBC(); h1.initRisingBubble(); //h1.initThreeBubbles(); h1.assemble(); h1.setk(0.2); h1.matMountC(); h1.setUnCoupledCBC(); h1.setCRHS(); h1.unCoupledC(); h1.setModel3DEdgeSize(); InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveVTKSurface(vtkFolder,"geometry"); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); double vinst=0; double vref=0; double xref=0; double xinit=0; double dx=0; if( strcmp( _frame,"moving") == 0 ) { // moving vref = s1.getURef(); xref = s1.getXRef(); s1.setCentroidVelPos(); xinit = s1.getCentroidPosXAverage(); } int nIter = 30000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl << endl; cout << resetColor(); // moving if( strcmp( _frame,"moving") == 0 ) { // moving frame dx = s1.getCentroidPosXAverage() - xinit; vinst = s1.getCentroidVelXAverage() + dx/s1.getDt(); vref += vinst; xref += vref*s1.getDt(); cout << "vref: " << vref << " xref: " << xref << endl; cout << "dx: " << dx << endl; s1.setUSol(vinst); m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(vref); pbc.MountPeriodicVectorsNew("print"); s1.setURef(vref); s1.setXRef(xref); } s1.setDtALETwoPhase(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); s1.stepALEPBC(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.setUnCoupledBC(); s1.setGravity("-X"); s1.setBetaFlowLiq("+X"); s1.setRHS(); s1.setCopyDirectionPBC("RL"); s1.setInterfaceGeo(); //s1.setInterfaceLevelSet(); s1.unCoupledPBCNew(); save.saveMSH(mshFolder,"newMesh",iter); save.saveVTK(vtkFolder,"sim",iter); save.saveVTKSurface(vtkFolder,"sim",iter); save.saveSol(binFolder,"sim",iter); save.saveBubbleInfo(datFolder); //save.crossSectionalVoidFraction(datFolder,"voidFraction",iter); save.saveBubbleShapeFactors(datFolder,"shapeFactors",iter); s1.saveOldData(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl << endl;; cout << resetColor(); s1.timeStep(); iter++; } Helmholtz3D h2(m1,h1); h2.setBC(); h2.initRisingBubble(); //h2.initThreeBubbles(); h2.assemble(); h2.matMountC(); h2.setUnCoupledCBC(); h2.setCRHS(); h2.unCoupledC(); h2.setModel3DEdgeSize(); Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.setNormalAndKappa(); m1.initMeshParameters(); // 3D operations m1.insert3dMeshPointsByDiffusion(6.0); m1.remove3dMeshPointsByDiffusion(1.0); //m1.removePointByVolume(); //m1.removePointsByInterfaceDistance(); //m1.remove3dMeshPointsByDistance(); m1.remove3dMeshPointsByHeight(); m1.delete3DPoints(); // surface operations m1.smoothPointsByCurvature(); m1.insertPointsByLength("curvature"); //m1.insertPointsByCurvature("flat"); //m1.removePointsByCurvature(); //m1.insertPointsByInterfaceDistance("flat"); m1.contractEdgesByLength("curvature"); //m1.removePointsByLength(); m1.flipTriangleEdges(); m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ //m1.mesh2Dto3DOriginal(); m1.mesh3DPoints(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); if( strcmp( _frame,"moving") == 0 ) { m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(vref); pbc.MountPeriodicVectorsNew("print"); } else { m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(); pbc.MountPeriodicVectorsNew("noPrint"); } Simulator3D s2(m1,s1); s2.applyLinearInterpolation(mOld); s1 = s2; s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
/** Adds visible mark at coordinates xpos, ypos, specify colour */ void addMark(Plotdata &x, Plotdata &y, double xpos, double ypos, Color colour) { setColor(x, y, colour); Plotdata::singlePoint(x, y, xpos, ypos); resetColor(x, y); }
/** * Affiche la légende du jeu. */ static void drawPanel() { setColor(GRAY_COLOR); goToXY(INFOPANEL_X, 4); setColor(getCaseColor(HERO_CHAR)); printf("%c", convertCase(HERO_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Personnage"); goToXY(INFOPANEL_X, 5); setColor(getCaseColor(WALL_CHAR)); printf("%c", convertCase(WALL_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Mur"); goToXY(INFOPANEL_X, 6); setColor(getCaseColor(DOOR_CHAR)); printf("%c", convertCase(DOOR_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Porte de sortie"); goToXY(INFOPANEL_X, 7); setColor(getCaseColor(THIN_CHAR)); printf("%c", convertCase(THIN_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Glace fine"); goToXY(INFOPANEL_X, 8); setColor(getCaseColor(THICK_CHAR)); printf("%c", convertCase(THICK_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Glace epaisse"); goToXY(INFOPANEL_X, 9); setColor(getCaseColor(SLIP_CHAR)); printf("%c", convertCase(SLIP_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Glace glissante"); goToXY(INFOPANEL_X, 10); setColor(getCaseColor(MELT_CHAR)); printf("%c", convertCase(MELT_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Eau"); goToXY(INFOPANEL_X, 11); setColor(getCaseColor(LIGHTNESS_POTION_CHAR)); printf("%c", convertCase(LIGHTNESS_POTION_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Potion de legerete"); goToXY(INFOPANEL_X, 12); setColor(getCaseColor(SCORE_BONUS_CHAR)); printf("%c", convertCase(SCORE_BONUS_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Bonus de score"); goToXY(INFOPANEL_X, 13); setColor(getCaseColor(TUNNEL_CHAR)); printf("%c", convertCase(TUNNEL_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Tunnel"); goToXY(INFOPANEL_X, 14); setColor(getCaseColor(MOWER_CHAR)); printf("%c", convertCase(MOWER_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Tondeuse"); goToXY(INFOPANEL_X, 15); setColor(getCaseColor(HOLE_CHAR)); printf("%c", convertCase(HOLE_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Trou"); goToXY(INFOPANEL_X, 16); setColor(getCaseColor(ENEMY_CHAR)); printf("%c", convertCase(ENEMY_CHAR)); setColor(GRAY_COLOR); printf(" %s\n", "Ennemi"); goToXY(INFOPANEL_X, 18); printf("%s %4s\n", "(p)", "Pause"); goToXY(INFOPANEL_X, 19); printf("%s %4s\n", "(r)", "Recommencer le niveau"); goToXY(INFOPANEL_X, 20); printf("%s %2s\n", "(q)", "Quitter"); resetColor(); }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); //PetscInitializeNoArguments(); // bogdan's thesis 2010 (Bhaga and Weber, JFM 1980) int iter = 1; //double Re = 6.53; // case 1 double Re = 13.8487; // case 2 //double Re = 32.78; // case 3 double Sc = 1000; double We = 115.66; double Fr = 1.0; double c1 = 0.0; // lagrangian double c2 = 1.0; // smooth vel double c3 = 10.0; // smooth coord (fujiwara) double d1 = 1.0; // surface tangent velocity u_n=u-u_t double d2 = 0.1; // surface smooth cord (fujiwara) double alpha = 1.0; double mu_in = 0.0000178; double mu_out = 1.28; double rho_in = 1.225; double rho_out = 1350; double cfl = 0.8; string meshFile = "airWaterSugar.msh"; //string meshFile = "test.msh"; Solver *solverP = new PetscSolver(KSPGMRES,PCILU); //Solver *solverP = new PetscSolver(KSPGMRES,PCJACOBI); Solver *solverV = new PetscSolver(KSPCG,PCICC); //Solver *solverV = new PetscSolver(KSPCG,PCJACOBI); Solver *solverC = new PetscSolver(KSPCG,PCICC); const char *binFolder = "./bin/"; const char *vtkFolder = "./vtk/"; const char *mshFolder = "./msh/"; const char *datFolder = "./dat/"; string meshDir = (string) getenv("DATA_DIR"); meshDir += "/gmsh/3d/rising/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; Simulator3D s1; if( *(argv+1) == NULL ) { cout << endl; cout << "--------------> STARTING FROM 0" << endl; cout << endl; const char *mesh1 = mesh; m1.readMSH(mesh1); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setRe(Re); s1.setSc(Sc); s1.setWe(We); s1.setFr(Fr); s1.setC1(c1); s1.setC2(c2); s1.setC3(c3); s1.setD1(d1); s1.setD2(d2); s1.setAlpha(alpha); s1.setMu(mu_in,mu_out); s1.setRho(rho_in,rho_out); s1.setCfl(cfl); s1.init(); s1.initHeatTransfer(); s1.setDtALETwoPhase(); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); } else if( strcmp( *(argv+1),"restart") == 0 ) { cout << endl; cout << "--------------> RE-STARTING..." << endl; cout << endl; // load surface mesh string aux = *(argv+2); string file = (string) "./msh/newMesh-" + *(argv+2) + (string) ".msh"; const char *mesh2 = file.c_str(); m1.readMSH(mesh2); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); s1(m1); // load 3D mesh file = (string) "./vtk/sim-" + *(argv+2) + (string) ".vtk"; const char *vtkFile = file.c_str(); m1.readVTK(vtkFile); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.readVTKHeaviside(vtkFile); m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); iter = s1.loadSolution("./","sim",atoi(*(argv+2))); } else if( strcmp( *(argv+1),"remesh") == 0 ) { cout << endl; cout << "--------------> RE-MESHING & STARTING..." << endl; cout << endl; // load old mesh Model3D mOld; string file = (string) "./vtk/sim-" + *(argv+2) + (string) ".vtk"; const char *vtkFile = file.c_str(); mOld.readVTK(vtkFile); mOld.readVTKHeaviside(vtkFile); mOld.setMapping(); // load surface mesh and create new mesh file = (string) "./msh/newMesh-" + *(argv+2) + (string) ".msh"; const char *mesh2 = file.c_str(); m1.readMSH(mesh2); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3DOriginal(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); iter = s1.loadSolution("./","sim",atoi(*(argv+2))); s1.applyLinearInterpolation(mOld); } else if( strcmp( *(argv+1),"restop") == 0 ) { cout << endl; cout << "--------------> RE-MESHING (NO ITERATION)..." << endl; cout << endl; // load old mesh Model3D mOld; string file = (string) "./vtk/sim-" + *(argv+2) + (string) ".vtk"; const char *vtkFile = file.c_str(); mOld.readVTK(vtkFile); mOld.readVTKHeaviside(vtkFile); mOld.setMapping(); // load surface mesh and create new one file = (string) "./msh/newMesh-" + *(argv+2) + (string) ".msh"; const char *mesh2 = file.c_str(); m1.readMSH(mesh2); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3DOriginal(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); s1(m1); //file = (string) "sim-" + *(argv+2); //const char *sol = file.c_str(); iter = s1.loadSolution("./","sim",atoi(*(argv+2))); s1.applyLinearInterpolation(mOld); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.saveVTK(vtkFolder,"sim",atoi(*(argv+2))); saveEnd.saveMSH(mshFolder,"newMesh",atoi(*(argv+2))); saveEnd.saveSol(binFolder,"sim",atoi(*(argv+2))); //saveEnd.saveVTKSurface(vtkFolder,"sim",atoi(*(argv+2))); return 0; } // Point's distribution Helmholtz3D h1(m1); h1.setBC(); h1.initRisingBubble(); h1.assemble(); h1.setk(0.2); h1.matMountC(); h1.setUnCoupledCBC(); h1.setCRHS(); h1.unCoupledC(); //h1.saveVTK(vtkFolder,"edge"); h1.setModel3DEdgeSize(); InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveVTKSurface(vtkFolder,"geometry"); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); int nIter = 3000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl << endl; cout << resetColor(); //s1.stepLagrangian(); s1.stepALE(); s1.setDtALETwoPhase(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.matMountC(); s1.setUnCoupledBC(); s1.setUnCoupledCBC(); s1.setRHS(); s1.setCRHS(); s1.setGravity("Z"); //s1.setInterface(); s1.setInterfaceGeo(); s1.unCoupled(); s1.unCoupledC(); save.saveMSH(mshFolder,"newMesh",iter); save.saveVTK(vtkFolder,"sim",iter); save.saveVTKSurface(vtkFolder,"sim",iter); save.saveSol(binFolder,"sim",iter); save.saveBubbleInfo(datFolder); //save.crossSectionalVoidFraction(datFolder,"voidFraction",iter); s1.saveOldData(); s1.timeStep(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl << endl;; cout << resetColor(); iter++; } Helmholtz3D h2(m1,h1); h2.setBC(); h2.initRisingBubble(); h2.assemble(); h2.matMountC(); h2.setUnCoupledCBC(); h2.setCRHS(); h2.unCoupledC(); h2.saveVTK(vtkFolder,"edge",iter-1); h2.saveChordalEdge(datFolder,"edge",iter-1); h2.setModel3DEdgeSize(); Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.setNormalAndKappa(); m1.initMeshParameters(); // 3D operations //m1.insert3dMeshPointsByDiffusion(); m1.remove3dMeshPointsByDiffusion(); //m1.removePointByVolume(); //m1.removePointsByInterfaceDistance(); //m1.remove3dMeshPointsByDistance(); m1.remove3dMeshPointsByHeight(); m1.delete3DPoints(); // surface operations m1.smoothPointsByCurvature(); m1.insertPointsByLength("curvature"); //m1.insertPointsByCurvature("flat"); //m1.removePointsByCurvature(); //m1.insertPointsByInterfaceDistance("flat"); m1.contractEdgesByLength("curvature"); //m1.removePointsByLength(); m1.flipTriangleEdges(); m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ //m1.mesh2Dto3DOriginal(); m1.mesh3DPoints(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInterfaceBC(); m1.setGenericBC(); Simulator3D s2(m1,s1); s2.applyLinearInterpolation(mOld); s1 = s2; s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); double Re = 100; double Sc = 1; double We = 1; double Fr = 1; double c1 = 0.0; // lagrangian double c2 = 0.0; // smooth vel double c3 = 0.0; // smooth coord (fujiwara) double d1 = 1.0; // surface tangent velocity u_n=u-u_t double d2 = 0.0; // surface smooth cord (fujiwara) double alpha = 1; double mu_in = 1; double mu_out = 0.001; double rho_in = 1; double rho_out = 0.01; double cfl = 0.8; Solver *solverP = new PetscSolver(KSPGMRES,PCILU); Solver *solverV = new PetscSolver(KSPCG,PCICC); Solver *solverC = new PetscSolver(KSPCG,PCICC); const char *vtkFolder = "./vtk/"; const char *mshFolder = "./msh/"; const char *datFolder = "./dat/"; //string meshFile = (string) getenv("MESHLIB"); //meshFile += "/gmsh/3d/torus/curvature/"; //const char *mesh = meshFile.c_str(); /* meshes */ vector<const char*> mesh; mesh.resize(7); mesh[0] = "../../db/gmsh/3d/torus/curvature/0.10.msh"; mesh[1] = "../../db/gmsh/3d/torus/curvature/0.09.msh"; mesh[2] = "../../db/gmsh/3d/torus/curvature/0.08.msh"; mesh[3] = "../../db/gmsh/3d/torus/curvature/0.07.msh"; mesh[4] = "../../db/gmsh/3d/torus/curvature/0.06.msh"; mesh[5] = "../../db/gmsh/3d/torus/curvature/0.05.msh"; mesh[6] = "../../db/gmsh/3d/torus/curvature/0.04.msh"; for( int i=0;i<(int) mesh.size();i++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << i << endl << endl; cout << resetColor(); Model3D m1; Simulator3D s1; m1.readMSH(mesh[i]); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setRe(Re); s1.setSc(Sc); s1.setWe(We); s1.setFr(Fr); s1.setC1(c1); s1.setC2(c2); s1.setC3(c3); s1.setD1(d1); s1.setD2(d2); s1.setAlpha(alpha); s1.setMu(mu_in,mu_out); s1.setRho(rho_in,rho_out); s1.setCfl(cfl); s1.init(); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); //s1.stepLagrangian(); s1.stepALE(); s1.setDtALETwoPhase(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.setUnCoupledBC(); s1.setRHS(); //s1.setInterface(); s1.setInterfaceGeo(); s1.unCoupled(); InOut save(m1,s1); // cria objeto de gravacao save.saveMSH(mshFolder,"newMesh",i); save.saveVTK(vtkFolder,"sim",i); save.saveVTKSurface(vtkFolder,"sim",i); save.saveKappaErrorTorus(datFolder); save.saveBubbleInfo(datFolder); save.chordalPressure(datFolder,"chordalPressure",i); save.crossSectionalPlane(datFolder,"XZ",i); cout << color(none,magenta,black); cout << "________________________________________ END of " << i << endl << endl;; cout << resetColor(); } PetscFinalize(); return 0; }
int main(int argc, char **argv) { /* This test case applies a prescribed vortex field in a unit cube to * test the re-meshing techinique of the surface mesh. * * OBS.: - comment stepSL() on Simulator3D::stepALE * - switch to tetrahedralize( (char*) "QYYAp",&in,&out ) on * Model3D::mesh3DPoints * * Since the field is prescribed, there is no need of calculating the * convection in a Euleurian way (stepSL) and the insertion of nodes on * the 3D mesh. * * */ PetscInitializeNoArguments(); int iter = 1; double d1 = 0.0; // surface tangent velocity u_n=u-u_t double d2 = 0.0; // surface smooth cord (fujiwara) double dt = 0.02; double T = 3.0; double time = 0; string meshFile = "sphere.msh"; const char *vtkFolder = "./vtk/"; const char *mshFolder = "./msh/"; const char *datFolder = "./dat/"; string meshDir = (string) getenv("DATA_DIR"); meshDir += "/gmsh/3d/sphere/vortex/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; Simulator3D s1; const char *mesh1 = mesh; m1.readMSH(mesh1); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D("QYYAp"); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); s1(m1); s1.setDt(dt); s1.setD1(d1); s1.setD2(d2); // initial conditions s1.stepImposedPeriodicField("3d",T,s1.getTime()); // X,Y and Z --> Sol(n+1) int nReMesh = 1; while( time < T ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl << endl; cout << resetColor(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); time = s1.getTime(); // time step: n+1/4 Simulator3D s20(m1,s1); double stepTime = dt/4.0; s20.stepImposedPeriodicField("3d",T,time+stepTime,stepTime); // SolOld(n) --> Sol(n+1/2) s20.saveOldData(); // Sol(n+1/2) --> SolOld(n+1/2) // time step: n+1/2 Simulator3D s30(m1,s20); stepTime = dt/2.0; s30.stepImposedPeriodicField("3d",T,time+stepTime,stepTime); // SolOld(n) --> Sol(n+1/2) s30.saveOldData(); // Sol(n+1/2) --> SolOld(n+1/2) s30.stepALE(); // SolOld(n+1/2) --> ALE(n+1/2) // time step: n using ALE(n+1/2) s1.setUALE(s30.getUALE()); s1.setVALE(s30.getVALE()); s1.setWALE(s30.getWALE()); s1.movePoints(); m1.setNormalAndKappa(); double field = cos(3.14159265358*time/T); cout << endl; cout << " | T: " << T << endl; cout << " | dt: " << dt << endl; cout << " | time: " << time << endl; cout << " | iter: " << iter << endl; cout << " | field: " << field << endl; cout << endl; save.saveMSH(mshFolder,"newMesh",iter); save.saveVTK(vtkFolder,"sim",iter); save.saveVTKSurface(vtkFolder,"sim",iter); save.saveBubbleInfo(datFolder); s1.saveOldData(); // Sol(n+1) --> SolOld(n) s1.timeStep(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl << endl;; cout << resetColor(); iter++; } Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.initMeshParameters(); // surface operations //m1.smoothPointsByCurvature(); m1.insertPointsByLength("flat"); m1.contractEdgesByLength("flat"); if( time > 1.9 ) m1.contractEdgesByLength("flat",0.65); if( time > 2.2 ) m1.contractEdgesByLength2("flat",0.7); if( time > 2.3 ) m1.contractEdgesByLength2("flat",0.8); if( time > 2.8 ) m1.contractEdgesByLength2("flat",1.2); //m1.removePointsByLength(); m1.flipTriangleEdges(); //m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ m1.setInterfaceBC(); m1.setMiniElement(); m1.restoreMappingArrays(); m1.setSurfaceVolume(); m1.setSurfaceArea(); m1.triMeshStats(); // computing velocity field X^(n+1),time+1 at new nodes too! Simulator3D s2(m1,s1); s2.stepImposedPeriodicField("3d",T,time); // X,Y and Z --> Sol(n+1) s2.saveOldData(); s1 = s2; s1.setCentroidVelPos(); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
void Creep::update(float deltaTime) { m_fStateTime += deltaTime; m_healthBarFrame = m_health * 16 / m_maxHealth - 1; m_healthBarFrame = m_healthBarFrame < 0 ? 0 : m_healthBarFrame; m_timeToShowHealthBar -= deltaTime; if (FlagUtil::isFlagSet(m_creepCondition, ELECTRIFIED)) { if (m_electrifiedTime > 0) { m_electrifiedTime -= deltaTime; } else { m_creepCondition = FlagUtil::removeFlag(m_creepCondition, ELECTRIFIED); m_speed = m_initialSpeed; if (FlagUtil::isFlagSet(m_creepCondition, FROZEN)) { m_speed /= 3; } } } if (FlagUtil::isFlagSet(m_creepCondition, POISONED)) { if (m_poisonedTime > 0) { bool isFrozen = FlagUtil::isFlagSet(m_creepCondition, FROZEN); m_poisonedTime -= deltaTime; m_poisonTime += deltaTime; while (m_poisonTime > TIME_FOR_POISON_DAMAGE) { m_poisonTime -= TIME_FOR_POISON_DAMAGE; takeDamage(m_poisonDamage, Damage_Type::ACID); } if (m_isGrowingDueToPoison) { m_fWidth += deltaTime * (isFrozen ? 0.1f : 0.5f); m_fHeight += deltaTime * (isFrozen ? 0.1f : 0.5f); if (m_fWidth > m_maxSize) { m_fWidth = m_maxSize; m_fHeight = m_maxSize; m_isGrowingDueToPoison = false; } } else { m_fWidth -= deltaTime * (isFrozen ? 0.1f : 0.5f); m_fHeight -= deltaTime * (isFrozen ? 0.1f : 0.5f); if (m_fWidth < m_halfSize) { m_fWidth = m_halfSize; m_fHeight = m_halfSize; m_isGrowingDueToPoison = true; } } } else { m_creepCondition = FlagUtil::removeFlag(m_creepCondition, POISONED); m_fWidth = m_defaultSize; m_fHeight = m_defaultSize; } resetBounds(m_fWidth * SIZE_TO_BOUNDS_RATIO, m_fHeight * SIZE_TO_BOUNDS_RATIO); } if (FlagUtil::isFlagSet(m_creepCondition, FROZEN)) { if (m_frozenTime > 0) { m_frozenTime -= deltaTime; m_fRed += m_frozenRecoveryRate * deltaTime; m_fGreen = m_fRed; } else { thaw(); } } else if (FlagUtil::isFlagSet(m_creepCondition, ON_FIRE)) { if (m_burnTime > 0) { m_burnTime -= deltaTime; } else { m_creepCondition = FlagUtil::removeFlag(m_creepCondition, ON_FIRE); m_creepCondition = FlagUtil::setFlag(m_creepCondition, FIRE_RECOVERY); } } else if (FlagUtil::isFlagSet(m_creepCondition, FIRE_RECOVERY)) { m_fRed += 1.5f * deltaTime; m_fGreen = m_fRed; m_fBlue = m_fRed; if (m_fRed > 1) { m_creepCondition = FlagUtil::removeFlag(m_creepCondition, FIRE_RECOVERY); resetColor(); } } m_deltaX = m_velocity->getX() * deltaTime; m_deltaY = m_velocity->getY() * deltaTime; m_position->add(m_deltaX, m_deltaY); m_direction = calcDirection(); updateBounds(); }
ChineseCalendar::ChineseCalendar(QWidget *parent) : QWidget(parent) { setupUi(this); m_strFileList.clear(); // bg = new QPixmap(":/img/chinesecalendarBGyellow.png"); icon = QIcon(":/img/icon.png"); icon64 = QIcon(":/img/chinesecalendar-64.png"); mycalendat=new CCBO; mycalendat->InitConnection(QDir::currentPath ()); selectedDate = QDate::currentDate(); monthCombo->setCurrentIndex(selectedDate.month() - 1); YearSelect->setCurrentIndex(selectedDate.year()-1900); connect(monthCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setMonth(int))); connect(monthCombo, SIGNAL(activated(int)), this, SLOT(setMonth(int))); connect(YearSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(setYear(int))); connect(this->backtotoday, SIGNAL(clicked()), this, SLOT(backtoday())); // this->TbnextMonth->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}"); // this->TbnextYear->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}"); // this->TbpreviousMonth->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}"); // this->TbpreviousYear->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}"); // this->backtotoday->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}"); // this->YearSelect->setStyleSheet("QComboBox{border: 2px solid lightgray;border-radius: 5px;font:12pt;}"); // this->monthCombo->setStyleSheet("QComboBox{border: 2px solid lightgray;border-radius: 5px;font:12pt;}"); // this->label->setStyleSheet("QLabel{font:12pt;}"); // this->label_2->setStyleSheet("QLabel{font:12pt;}"); QString week; QDateTime dateTime = QDateTime::currentDateTime(); if (dateTime.toString("ddd") == "Mon") week = "星期一"; // Monday else if (dateTime.toString("ddd") == "Tue") week = "星期二"; // Tuesday else if (dateTime.toString("ddd") == "Wed") week = "星期三"; // Wednesday else if (dateTime.toString("ddd") == "Thu") week = "星期四"; // Thursday else if(dateTime.toString("ddd") == "Fri") week = "星期五"; // Friday else if (dateTime.toString("ddd") == "Sat") week = "星期六"; // Saturday else week = "星期日"; // Sunday QString currentTime = dateTime.toString("yyyy-MM-dd %1").arg(week); QDate day = QDate::currentDate(); struct CCalendar datebase; mycalendat->ctcl_solar_to_lunar(day.year(),day.month(),day.day(),&datebase); QString chinesemonth = datebase.cmonth; if (chinesemonth == "一月") chinesemonth = "正月"; if (chinesemonth == "十一月") chinesemonth = "冬月"; if (chinesemonth == "十二月") chinesemonth = "腊月"; QString chineseday = QString("农历 %1%2").arg(chinesemonth).arg(datebase.cday); QString chineseyear = QString("%1年(%2年)").arg(datebase.ganzhi).arg(datebase.shengxiao); QString chineseyi = QString("%1").arg(datebase.yi); QStringList chineseyilist = chineseyi.split("、"); QString chineseji = QString("%2").arg(datebase.ji); QStringList chinesejilist = chineseji.split("、"); QFont font; QPalette pa; font.setPointSize(48); font.setBold(true); this->label_10->setFont(font); this->label_10->setText(QString::number(day.day())); font.setBold(false); font.setPointSize(9); this->label_12->setFont(font); this->label_12->setText(currentTime); font.setPointSize(10); this->label_13->setFont(font); this->label_13->setText(chineseday); this->label_14->setFont(font); this->label_14->setText(chineseyear); font.setPointSize(15); this->label_15->setFont(font); font.setPointSize(10); this->label_17->setFont(font); this->label_18->setFont(font); QString yi=QString(""); QString ji=QString(""); if(chineseyilist.count() == 0 ) yi =QString(""); if(chineseyilist.count() >= 5) yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)).append("\n").append(chineseyilist.at(2)).append("\n").append(chineseyilist.at(3)).append("\n").append(chineseyilist.at(4)); if(chineseyilist.count() == 4) yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)).append("\n").append(chineseyilist.at(2)).append("\n").append(chineseyilist.at(3)); if (chineseyilist.count() == 3) yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)).append("\n").append(chineseyilist.at(2)); if (chineseyilist.count() == 2) yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)); if (chineseyilist.count() == 1) yi = QString("").append(chineseyilist.at(0)).append("\n"); this->label_17->setText(yi); if(chinesejilist.count() == 0 ) ji =QString(""); if(chinesejilist.count() >= 5) ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)).append("\n").append(chinesejilist.at(2)).append("\n").append(chinesejilist.at(3)).append("\n").append(chinesejilist.at(4)); if(chinesejilist.count() == 4) ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)).append("\n").append(chinesejilist.at(2)).append("\n").append(chinesejilist.at(3)); if (chinesejilist.count() == 3) ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)).append("\n").append(chinesejilist.at(2)); if (chinesejilist.count() == 2) ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)); if (chinesejilist.count() == 1) ji = QString("").append(chinesejilist.at(0)).append("\n"); this->label_18->setText(ji); QString cnote=mycalendat->ctcl_displaydata(day.year(),day.month(),day.day()); QString haveplan=QString("今日有行程安排"); QString noplan=QString("今日无行程安排"); int num = cnote.count(); while (num > 0 && cnote.at(num-1).isSpace()) { num--; } if(cnote.isEmpty() || num == 0) this->label_19->setText(noplan); else this->label_19->setText(haveplan); pa.setColor(QPalette::WindowText,Qt::white); this->label->setPalette(pa); this->label_2->setPalette(pa); this->label_15->setPalette(pa); this->label_4->setPalette(pa); this->label_5->setPalette(pa); this->label_6->setPalette(pa); this->label_7->setPalette(pa); this->label_8->setPalette(pa); pa.setColor(QPalette::WindowText,QColor(255,255,255)); this->label_3->setPalette(pa); this->label_9->setPalette(pa); pa.setColor(QPalette::WindowText,Qt::black); this->label_18->setPalette(pa); pa.setColor(QPalette::WindowText,QColor(235,74,20)); this->label_10->setPalette(pa); this->label_12->setPalette(pa); this->label_13->setPalette(pa); this->label_14->setPalette(pa); pa.setColor(QPalette::WindowText,Qt::white); this->label_19->setPalette(pa); pa.setColor(QPalette::WindowText,Qt::red); this->label_11->setPalette(pa); this->label_17->setPalette(pa); map = new QMap<QString, DateItem *>(); for (int i = 1; i <= 6; i++) { for (int j = 1; j <= 7; j++) { DateItem *dateitem = new DateItem(this); if (i <= 5) { dateitem->show(); } else { dateitem->hide(); } map->insert(QString("%1-%2").arg(i).arg(j), dateitem); if ((i < 6) || (i == 6 && (j == 1 || j == 2))) { connect(dateitem, SIGNAL(clicked(QString)), this, SLOT(resetcalendardate(QString))); connect(dateitem, SIGNAL(day(QString)), this, SLOT(setclickday(QString))); connect(dateitem, SIGNAL(resetColor()), this, SLOT(resetDateItemColor())); } } } setItemLayout(); setCalendar(); QTimer *timer = new QTimer(this); timer->setInterval(1000); connect(timer,SIGNAL(timeout()),this,SLOT(setTime())); timer->start(); QBitmap objBitmap(size()); QPainter painter(&objBitmap); painter.fillRect(rect(),Qt::white); painter.setBrush(QColor(0,0,0)); painter.drawRoundedRect(this->rect(),10,10); setMask(objBitmap); aboutDlg = new AboutDialog(); aboutDlg->hide(); this->createTray(); note = new Cnote; QDesktopWidget desktop; int width = desktop.screenGeometry().width(); note->setGeometry(QRect(width-400,80,224,280)); connect(note,SIGNAL(save(QString)),this,SLOT(savedata(QString))); note->hide(); }
int SDLFrontend::init (int width, int height, bool fullscreen, EventHandler &eventHandler) { if (width == -1 && height == -1) fullscreen = true; info(LOG_CLIENT, String::format("initializing: %i:%i - fullscreen: %s", width, height, fullscreen ? "true" : "false")); INIT_Subsystem(SDL_INIT_VIDEO, true); INIT_Subsystem(SDL_INIT_JOYSTICK, false); INIT_Subsystem(SDL_INIT_GAMECONTROLLER, false); INIT_Subsystem(SDL_INIT_HAPTIC, false); initJoystickAndHaptic(); SDL_DisplayMode displayMode; SDL_GetDesktopDisplayMode(0, &displayMode); const char *name = SDL_GetPixelFormatName(displayMode.format); info(LOG_CLIENT, String::format("current desktop mode: %dx%d@%dHz (%s)", displayMode.w, displayMode.h, displayMode.refresh_rate, name)); if (width == -1) width = 800;//displayMode.w; if (height == -1) height = 480; //displayMode.h; setGLAttributes(); setHints(); int doubleBuffered = 0; SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doubleBuffered); info(LOG_CLIENT, String::format("doublebuffer: %s", doubleBuffered ? "activated" : "disabled")); int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN; #ifdef __IPHONEOS__ flags |= SDL_WINDOW_RESIZABLE; #endif #if 1 //defined __IPHONEOS__ || defined __ANDROID__ if (fullscreen) flags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS; #else if (fullscreen) flags |= SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_BORDERLESS; #endif const int videoDrivers = SDL_GetNumVideoDrivers(); for (int i = 0; i < videoDrivers; ++i) { info(LOG_CLIENT, String::format("available driver: %s", SDL_GetVideoDriver(i))); } info(LOG_CLIENT, String::format("driver: %s", SDL_GetCurrentVideoDriver())); const int displays = SDL_GetNumVideoDisplays(); info(LOG_CLIENT, String::format("found %i display(s)", displays)); if (fullscreen && displays > 1) { width = displayMode.w; height = displayMode.h; info(LOG_CLIENT, String::format("use fake fullscreen for the first display: %i:%i", width, height)); } _window = SDL_CreateWindow(Singleton<Application>::getInstance().getName().c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, flags); if (!_window) { sdlCheckError(); return -1; } SDL_DisableScreenSaver(); initRenderer(); resetColor(); GLContext::get().init(); if (SDL_SetWindowBrightness(_window, 1.0f) == -1) sdlCheckError(); if (Config.isGrabMouse() && (!fullscreen || displays > 1)) { SDL_SetWindowGrab(_window, SDL_TRUE); } int screen = 0; int modes = SDL_GetNumDisplayModes(screen); info(LOG_CLIENT, "possible display modes:"); for (int i = 0; i < modes; i++) { SDL_GetDisplayMode(screen, i, &displayMode); name = SDL_GetPixelFormatName(displayMode.format); info(LOG_CLIENT, String::format("%dx%d@%dHz %s", displayMode.w, displayMode.h, displayMode.refresh_rate, name)); } // some platforms may override or hardcode the resolution - so // we have to query it here to get the actual resolution SDL_GetWindowSize(_window, &width, &height); if (SDL_SetRelativeMouseMode(SDL_TRUE) == -1) error(LOG_CLIENT, "no relative mouse mode support"); SDL_ShowCursor(0); info(LOG_CLIENT, String::format("actual resolution: %dx%d", width, height)); setVSync(ConfigManager::get().isVSync()); const int initState = IMG_Init(IMG_INIT_PNG); if (!(initState & IMG_INIT_PNG)) { sdlCheckError(); System.exit("No png support", 1); } _width = width; _height = height; updateViewport(0, 0, getWidth(), getHeight()); onInit(); _eventHandler = &eventHandler; _eventHandler->registerObserver(_console.get()); _eventHandler->registerObserver(this); info(LOG_CLIENT, "init the shader manager"); ShaderManager::get().init(); if (!Config.isSoundEnabled()) { info(LOG_CLIENT, "sound disabled"); } else if (!SoundControl.init(true)) { error(LOG_CLIENT, "sound initialization failed"); } return 0; }
int main(int argc, char **argv) { /* This test case applies a prescribed 2D vortex field in a unit cube to * test the re-meshing techinique of the surface mesh. * * OBS.: - comment stepSL() on Simulator3D::stepALE * - switch to tetrahedralize( (char*) "QYYAp",&in,&out ) on * Model3D::mesh3DPoints * * Since the field is prescribed, there is no need of calculating the * convection in a Euleurian way (stepSL) and the insertion of nodes on * the 3D mesh. * * */ PetscInitializeNoArguments(); int iter = 1; double d1 = 0.0; // surface tangent velocity u_n=u-u_t double d2 = 0.1; // surface smooth cord (fujiwara) double dt = 0.01; double time = 0.0; string meshFile = "sphere.msh"; const char *vtkFolder = "./vtk/"; const char *mshFolder = "./msh/"; const char *datFolder = "./dat/"; string meshDir = (string) getenv("DATA_DIR"); meshDir += "/gmsh/3d/sphere/zalesak/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; Simulator3D s1; const char *mesh1 = mesh; m1.readMSH(mesh1); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D("QYYAp"); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); s1(m1); s1.setD1(d1); s1.setD2(d2); s1.setDt(dt); InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveVTKSurface(vtkFolder,"geometry"); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); int nIter = 3000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl << endl; cout << resetColor(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); time = s1.getTime(); s1.stepImposedPeriodicField("rotating",0.0,time); s1.stepALE(); s1.movePoints(); s1.setInterfaceGeo(); save.saveMSH(mshFolder,"newMesh",iter); save.saveVTK(vtkFolder,"sim",iter); save.saveVTKSurface(vtkFolder,"sim",iter); save.saveBubbleInfo(datFolder); //save.crossSectionalVoidFraction(datFolder,"voidFraction",iter); s1.saveOldData(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl << endl;; cout << resetColor(); iter++; } Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.setNormalAndKappa(); m1.initMeshParameters(); // surface operations //m1.smoothPointsByCurvature(); m1.insertPointsByLength("flat"); m1.contractEdgesByLength("flat"); //m1.removePointsByLength(); //m1.flipTriangleEdges(); //m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ m1.setInterfaceBC(); m1.setMiniElement(); m1.restoreMappingArrays(); m1.setSurfaceVolume(); m1.setSurfaceArea(); m1.triMeshStats(); // computing velocity field X^(n+1),time+1 at new nodes too! Simulator3D s2(m1,s1); s2.stepImposedPeriodicField("rotating",0.0,time); s2.saveOldData(); s1 = s2; s1.setCentroidVelPos(); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); //PetscInitializeNoArguments(); int iter = 0; //const char* _frame = "fixed"; const char* _frame = "moving"; string physGroup = "\"wallInflowZeroU\""; //string physGroup = "\"wallNoSlip\""; double betaGrad = 1.0; Solver *solverP = new PetscSolver(KSPCG,PCICC); Solver *solverV = new PetscSolver(KSPCG,PCICC); Solver *solverC = new PetscSolver(KSPCG,PCICC); // rising-pbc //string meshFile = "airWaterSugarPBC-wallLeftRight.msh"; /* const char *binFolder = "/work/gcpoliveira/post-processing/3d/rising-pbc/bin/"; const char *mshFolder = "/work/gcpoliveira/post-processing/3d/rising-pbc/msh/"; const char *datFolder = "/work/gcpoliveira/post-processing/3d/rising-pbc/dat/"; const char *vtkFolder = "/work/gcpoliveira/post-processing/3d/rising-pbc/vtk/"; */ // rising-beta /* const char *binFolder = "/work/gcpoliveira/post-processing/3d/rising-beta/bin/"; const char *mshFolder = "/work/gcpoliveira/post-processing/3d/rising-beta/msh/"; const char *datFolder = "/work/gcpoliveira/post-processing/3d/rising-beta/dat/"; const char *vtkFolder = "/work/gcpoliveira/post-processing/3d/rising-beta/vtk/"; */ // cell-2D string meshFile = "unit-cell-s-2D-3d.msh"; // 1 /* const char *binFolder = "/work/gcpoliveira/post-processing/3d/cell-1/bin/"; const char *datFolder = "/work/gcpoliveira/post-processing/3d/cell-1/dat/"; const char *mshFolder = "/work/gcpoliveira/post-processing/3d/cell-1/msh/"; const char *vtkFolder = "/work/gcpoliveira/post-processing/3d/cell-1/vtk/"; */ // 2 /* const char *binFolder = "/work/gcpoliveira/post-processing/3d/cell-2/bin/"; const char *datFolder = "/work/gcpoliveira/post-processing/3d/cell-2/dat/"; const char *mshFolder = "/work/gcpoliveira/post-processing/3d/cell-2/msh/"; const char *vtkFolder = "/work/gcpoliveira/post-processing/3d/cell-2/vtk/"; */ // 3 const char *binFolder = "/work/gcpoliveira/post-processing/3d/cell-3/bin/"; const char *datFolder = "/work/gcpoliveira/post-processing/3d/cell-3/dat/"; const char *mshFolder = "/work/gcpoliveira/post-processing/3d/cell-3/msh/"; const char *vtkFolder = "/work/gcpoliveira/post-processing/3d/cell-3/vtk/"; string meshDir = (string) getenv("MESH3D_DIR"); if( strcmp( _frame,"moving") == 0 ) meshDir += "/rising/movingFrame/" + meshFile; else meshDir += "/rising/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; cout << endl; cout << "--------------> RE-STARTING..." << endl; cout << endl; //string mshBase = "/work/gcpoliveira/post-processing/3d/cell-1/msh/newMesh-"; //string mshBase = "/work/gcpoliveira/post-processing/3d/cell-2/msh/newMesh-"; string mshBase = "/work/gcpoliveira/post-processing/3d/cell-3/msh/newMesh-"; //string mshBase = "/work/gcpoliveira/post-processing/3d/rising-pbc/msh/newMesh-"; //string mshBase = "/work/gcpoliveira/post-processing/3d/rising-beta/msh/newMesh-"; // load surface mesh string aux = *(argv+1); string file = mshBase + *(argv+1) + (string) ".msh"; const char *mesh2 = file.c_str(); m1.readMSH(mesh2); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); //string vtkBase = "/work/gcpoliveira/post-processing/3d/cell-1/vtk/sim-"; //string vtkBase = "/work/gcpoliveira/post-processing/3d/cell-2/vtk/sim-"; string vtkBase = "/work/gcpoliveira/post-processing/3d/cell-3/vtk/sim-"; //string vtkBase = "/work/gcpoliveira/post-processing/3d/rising-pbc/vtk/sim-"; //string vtkBase = "/work/gcpoliveira/post-processing/3d/rising-beta/vtk/sim-"; // load 3D mesh file = vtkBase + *(argv+1) + (string) ".vtk"; const char *vtkFile = file.c_str(); m1.readVTK(vtkFile); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.readVTKHeaviside(vtkFile); m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(); Periodic3D pbc(m1); pbc.MountPeriodicVectorsNew("print"); Simulator3D s1(pbc,m1); s1.setBetaPressureLiquid(betaGrad); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); //const char *dirBase = "/work/gcpoliveira/post-processing/3d/cell-1/"; //const char *dirBase = "/work/gcpoliveira/post-processing/3d/cell-2/"; const char *dirBase = "/work/gcpoliveira/post-processing/3d/cell-3/"; //const char *dirBase = "/work/gcpoliveira/post-processing/3d/rising-pbc/"; //const char *dirBase = "/work/gcpoliveira/post-processing/3d/rising-beta/"; iter = s1.loadSolution(dirBase,"sim",atoi(*(argv+1))); // Point's distribution Helmholtz3D h1(m1); h1.setBC(); h1.initRisingBubble(); //h1.initThreeBubbles(); h1.assemble(); h1.setk(0.2); h1.matMountC(); h1.setUnCoupledCBC(); h1.setCRHS(); h1.unCoupledC(); h1.setModel3DEdgeSize(); InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveVTKSurface(vtkFolder,"geometry"); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); double vinst=0; double vref=0; double xref=0; double xinit=0; double dx=0; if( strcmp( _frame,"moving") == 0 ) { // moving vref = s1.getURef(); xref = s1.getXRef(); s1.setCentroidVelPos(); xinit = s1.getCentroidPosXAverage(); } int nIter = 30000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl << endl; cout << resetColor(); // moving if( strcmp( _frame,"moving") == 0 ) { // moving frame dx = s1.getCentroidPosXAverage() - xinit; vinst = s1.getCentroidVelXAverage() + dx/s1.getDt(); vref += vinst; xref += vref*s1.getDt(); cout << "vref: " << vref << " xref: " << xref << endl; cout << "dx: " << dx << endl; s1.setUSol(vinst); m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(vref); pbc.MountPeriodicVectorsNew("print"); s1.setURef(vref); s1.setXRef(xref); } s1.setDtALETwoPhase(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); s1.stepALEPBC(); //s1.stepALE(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.setUnCoupledBC(); s1.setGravity("-X"); s1.setBetaFlowLiq("+X"); s1.setRHS(); s1.setCopyDirectionPBC("RL"); s1.setInterfaceGeo(); //s1.setInterfaceLevelSet(); s1.unCoupledPBCNew(); //s1.unCoupledBetaPBC(); // rising-beta if ( i%5 == 0 ) { save.saveMSH(mshFolder,"newMesh",iter); save.saveVTK(vtkFolder,"sim",iter); save.saveVTKSurface(vtkFolder,"sim",iter); save.saveSol(binFolder,"sim",iter); save.saveBubbleInfo(datFolder); //save.crossSectionalVoidFraction(datFolder,"voidFraction",iter); save.saveBubbleShapeFactors(datFolder,"shapeFactors",iter); } s1.saveOldData(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl << endl;; cout << resetColor(); s1.timeStep(); iter++; } Helmholtz3D h2(m1,h1); h2.setBC(); //h2.initRisingBubble(); h2.initThreeBubbles(); h2.assemble(); h2.matMountC(); h2.setUnCoupledCBC(); h2.setCRHS(); h2.unCoupledC(); h2.setModel3DEdgeSize(); Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.setNormalAndKappa(); m1.initMeshParameters(); // 3D operations m1.insert3dMeshPointsByDiffusion(6.0); m1.remove3dMeshPointsByDiffusion(0.5); //m1.removePointByVolume(); //m1.removePointsByInterfaceDistance(); //m1.remove3dMeshPointsByDistance(); m1.remove3dMeshPointsByHeight(); m1.delete3DPoints(); // surface operations m1.smoothPointsByCurvature(); m1.insertPointsByLength("curvature"); //m1.insertPointsByCurvature("flat"); //m1.removePointsByCurvature(); //m1.insertPointsByInterfaceDistance("flat"); m1.contractEdgesByLength("curvature"); //m1.removePointsByLength(); m1.flipTriangleEdges(); m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ //m1.mesh2Dto3DOriginal(); m1.mesh3DPoints(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); if( strcmp( _frame,"moving") == 0 ) { m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(vref); pbc.MountPeriodicVectorsNew("print"); } else { m1.setGenericBCPBCNew(physGroup); m1.setGenericBC(); pbc.MountPeriodicVectorsNew("noPrint"); } Simulator3D s2(m1,s1); s2.applyLinearInterpolation(mOld); s1 = s2; s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }
int main(int argc, char **argv) { PetscInitialize(&argc,&argv,PETSC_NULL,PETSC_NULL); //PetscInitializeNoArguments(); // bogdan's thesis 2010 (Bhaga and Weber, JFM 1980) int iter = 1; double Re = 100; double We = 115.662; double Sc = 1; double Fr = 1.0; double alpha = 1.0; double rho_in = 1.225; double rho_out = 1350; double mu_out = 1; double mu_in = 0.0000178; const char* _case = "9"; // case 1 if( strcmp( _case,"1") == 0 ) { Re = sqrt(42.895); mu_out = 2.73; } else if( strcmp( _case,"2") == 0 ) { Re = 13.8487; // case 2 mu_out = 1.28; } else if( strcmp( _case,"3") == 0 ) { Re = 33.0413; // case 3 mu_out = 0.5396; // case 3 } else if( strcmp( _case,"6") == 0 ) { Re = sqrt(3892.856); // case 6 mu_out = 0.2857; // case 6 } else if( strcmp( _case,"7") == 0 ) { Re = sqrt(18124.092); // case 7 mu_out = 0.1324; // case 7 } else if( strcmp( _case,"8") == 0 ) { Re = sqrt(41505.729); // case 8 (extream) mu_out = 0.0875134907735; // extream } else if( strcmp( _case,"9") == 0 ) { double bubbleDiam = 5.2E-3; double gravity = 9.8; double sigma = 0.0728; rho_in = 1.205; rho_out = 998.0; mu_out = 958.08E-6; mu_in = 18.21E-6; Re = sqrt( CalcArchimedesBuoyancy(gravity,bubbleDiam,rho_out,mu_out) ); We = CalcEotvos(gravity,bubbleDiam,rho_out,sigma); } else { cerr << "test case " << _case << " not available!" << endl; exit(1); } double cfl = 0.5; const char* _frame = "fixed"; //const char* _frame = "moving"; // fixed double c1 = 0.0; // lagrangian double c2 = 1.0; // smooth vel double c3 = 10.0; // smooth coord (fujiwara) double d1 = 1.0; // surface tangent vel = (u-ut) double d2 = 0.1; // surface smooth coord (fujiwara) // moving if( strcmp( _frame,"moving") == 0 ) { c1 = 0.0; // lagrangian c2 = 1.0; // smooth vel: OBS - different result with c1=0.0 c3 = 10.0; // smooth coord (fujiwara) d1 = 0.0; // surface tangent velocity u_n=u-u_t d2 = 0.1; // surface smooth cord (fujiwara) } string meshFile = "airWaterSugarPBC-wallNoSlip.msh"; Solver *solverP = new PetscSolver(KSPCG,PCICC); Solver *solverV = new PetscSolver(KSPCG,PCILU); //Solver *solverV = new PetscSolver(KSPCG,PCJACOBI); Solver *solverC = new PetscSolver(KSPCG,PCICC); const char *binFolder = "/work/gcpoliveira/post-processing/3d/rising-compare/bin/"; const char *mshFolder = "/work/gcpoliveira/post-processing/3d/rising-compare/msh/"; const char *vtkFolder = "/work/gcpoliveira/post-processing/3d/rising-compare/vtk/"; const char *datFolder = "/work/gcpoliveira/post-processing/3d/rising-compare/dat/"; string meshDir = (string) getenv("MESH3D_DIR"); if( strcmp( _frame,"moving") == 0 ) meshDir += "/rising/movingFrame/" + meshFile; else meshDir += "/rising/" + meshFile; const char *mesh = meshDir.c_str(); Model3D m1; Simulator3D s1; if( *(argv+1) == NULL ) { cout << endl; cout << "--------------> STARTING FROM 0" << endl; cout << endl; const char *mesh1 = mesh; m1.readMSH(mesh1); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setRe(Re); s1.setSc(Sc); s1.setWe(We); s1.setFr(Fr); s1.setC1(c1); s1.setC2(c2); s1.setC3(c3); s1.setD1(d1); s1.setD2(d2); s1.setAlpha(alpha); s1.setMu(mu_in,mu_out); s1.setRho(rho_in,rho_out); s1.setCfl(cfl); s1.init(); s1.setDtALETwoPhase(); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); } else if( strcmp( *(argv+1),"restart") == 0 ) { cout << endl; cout << "--------------> RE-STARTING..." << endl; cout << endl; // load surface mesh string aux = *(argv+2); string file = (string) "/work/gcpoliveira/post-processing/3d/rising/msh/newMesh-" + *(argv+2) + (string) ".msh"; const char *mesh2 = file.c_str(); m1.readMSH(mesh2); m1.setInterfaceBC(); m1.setTriEdge(); m1.mesh2Dto3D(); s1(m1); // load 3D mesh file = (string) "/work/gcpoliveira/post-processing/3d/rising/vtk/sim-" + *(argv+2) + (string) ".vtk"; const char *vtkFile = file.c_str(); m1.readVTK(vtkFile); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.readVTKHeaviside(vtkFile); m1.setSurfaceConfig(); m1.setInitSurfaceVolume(); m1.setInitSurfaceArea(); m1.setGenericBC(); s1(m1); s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); iter = s1.loadSolution("/work/gcpoliveira/post-processing/3d/rising/","sim",atoi(*(argv+2))); } // Point's distribution Helmholtz3D h1(m1); h1.setBC(); h1.initRisingBubble(); h1.assemble(); h1.setk(0.2); h1.matMountC(); h1.setUnCoupledCBC(); h1.setCRHS(); h1.unCoupledC(); h1.setModel3DEdgeSize(); InOut save(m1,s1); // cria objeto de gravacao save.saveVTK(vtkFolder,"geometry"); save.saveVTKSurface(vtkFolder,"geometry"); save.saveMeshInfo(datFolder); save.saveInfo(datFolder,"info",mesh); double vinst=0; double vref=0; double xref=0; double xinit=0; double dx=0; if( strcmp( _frame,"moving") == 0 ) { // moving vref = s1.getURef(); xref = s1.getXRef(); s1.setCentroidVelPos(); xinit = s1.getCentroidPosXAverage(); } int nIter = 30000; int nReMesh = 1; for( int i=1;i<=nIter;i++ ) { for( int j=0;j<nReMesh;j++ ) { cout << color(none,magenta,black); cout << "____________________________________ Iteration: " << iter << endl << endl; cout << resetColor(); // moving if( strcmp( _frame,"moving") == 0 ) { // moving frame dx = s1.getCentroidPosXAverage() - xinit; vinst = s1.getCentroidVelXAverage() + dx/s1.getDt(); vref += vinst; xref += vref*s1.getDt(); cout << "vref: " << vref << " xref: " << xref << endl; cout << "dx: " << dx << endl; s1.setUSol(vinst); m1.setGenericBC(vref); s1.setURef(vref); s1.setXRef(xref); } //s1.stepLagrangian(); s1.stepALE(); s1.setDtALETwoPhase(); InOut save(m1,s1); // cria objeto de gravacao save.printSimulationReport(); s1.movePoints(); s1.assemble(); s1.matMount(); s1.setUnCoupledBC(); s1.setRHS(); s1.setGravity("-X"); //s1.setInterface(); s1.setInterfaceGeo(); s1.unCoupled(); if ( i%5 == 0 ) { save.saveMSH(mshFolder,"newMesh",iter); save.saveVTK(vtkFolder,"sim",iter); save.saveVTKSurface(vtkFolder,"sim",iter); save.saveSol(binFolder,"sim",iter); save.saveBubbleInfo(datFolder); //save.crossSectionalVoidFraction(datFolder,"voidFraction",iter); } s1.saveOldData(); cout << color(none,magenta,black); cout << "________________________________________ END of " << iter << endl << endl;; cout << resetColor(); s1.timeStep(); iter++; } Helmholtz3D h2(m1,h1); h2.setBC(); h2.initRisingBubble(); h2.assemble(); h2.setk(0.2); h2.matMountC(); h2.setUnCoupledCBC(); h2.setCRHS(); h2.unCoupledC(); if ( i%5 == 0 ) { h2.saveVTK(vtkFolder,"edge",iter-1); h2.saveChordalEdge(datFolder,"edge",iter-1); } h2.setModel3DEdgeSize(); Model3D mOld = m1; /* *********** MESH TREATMENT ************* */ // set normal and kappa values m1.setNormalAndKappa(); m1.initMeshParameters(); // 3D operations m1.insert3dMeshPointsByDiffusion(6.0); m1.remove3dMeshPointsByDiffusion(0.5); //m1.removePointByVolume(); //m1.removePointsByInterfaceDistance(); //m1.remove3dMeshPointsByDistance(); m1.remove3dMeshPointsByHeight(); m1.delete3DPoints(); // surface operations m1.smoothPointsByCurvature(); m1.insertPointsByLength("flat"); //m1.insertPointsByCurvature("flat"); //m1.removePointsByCurvature(); //m1.insertPointsByInterfaceDistance("flat"); m1.contractEdgesByLength("flat"); //m1.removePointsByLength(); m1.flipTriangleEdges(); m1.removePointsByNeighbourCheck(); //m1.checkAngleBetweenPlanes(); /* **************************************** */ //m1.mesh2Dto3DOriginal(); m1.mesh3DPoints(); m1.setMapping(); #if NUMGLEU == 5 m1.setMiniElement(); #else m1.setQuadElement(); #endif m1.setSurfaceConfig(); if( strcmp( _frame,"moving") == 0 ) m1.setGenericBC(vref); else m1.setGenericBC(); Simulator3D s2(m1,s1); s2.applyLinearInterpolation(mOld); s1 = s2; s1.setSolverPressure(solverP); s1.setSolverVelocity(solverV); s1.setSolverConcentration(solverC); InOut saveEnd(m1,s1); // cria objeto de gravacao saveEnd.printMeshReport(); saveEnd.saveMeshInfo(datFolder); } PetscFinalize(); return 0; }