// // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. #include "parallel/PetscSolverNavierStokes.h" namespace AMDiS { using namespace std; void PetscSolverNavierStokes::initSolver(KSP &ksp) { FUNCNAME("PetscSolverNavierStokes::initSolver()"); MSG("RUN NAVIER STOKES SOLVER INIT!\n"); KSPCreate(mpiCommGlobal, &ksp); KSPSetOperators(ksp, getMatInterior(), getMatInterior(), SAME_NONZERO_PATTERN); KSPSetTolerances(ksp, 0.0, 1e-8, PETSC_DEFAULT, PETSC_DEFAULT); KSPSetType(ksp, KSPGMRES); KSPSetOptionsPrefix(ksp, "ns_"); KSPSetFromOptions(ksp); KSPMonitorSet(ksp, KSPMonitorDefault, PETSC_NULL, PETSC_NULL); } void PetscSolverNavierStokes::initPreconditioner(PC pc) { FUNCNAME("PetscSolverNavierStokes::initPreconditioner()"); MSG("RUN NAVIER STOKES PRECONDITIONER INIT!\n"); vector velocityComponents; velocityComponents.push_back(0); velocityComponents.push_back(1); vector pressureComponent; pressureComponent.push_back(2); PCSetType(pc, PCFIELDSPLIT); PCFieldSplitSetSchurFactType(pc, PC_FIELDSPLIT_SCHUR_FACT_FULL); createFieldSplit(pc, "velocity", velocityComponents); createFieldSplit(pc, "pressure", pressureComponent); } }