61 m_innerTol = m_params.options().getReal(
"nonlin.tol");
66template<
class T,
int MatOrder>
69 int numPatches = m_params.getPde().patches().nPatches();
72 std::stringstream filenameU;
73 filenameU <<
"velocity" + fileNameSuffix +
"_" << m_iterationNumber <<
"it";
74 gsWriteParaview<T>(uSol, filenameU.str(), plotPts);
77 std::stringstream filenameP;
78 filenameP <<
"pressure" + fileNameSuffix +
"_" << m_iterationNumber <<
"it";
79 gsWriteParaview<T>(pSol, filenameP.str(), plotPts);
81 for (
int p = 0; p < numPatches; p++)
83 std::stringstream fnU;
84 fnU << filenameU.str() << p <<
".vts";
85 fileU <<
"<DataSet timestep = \"" << m_iterationNumber <<
"\" part = \"" << p <<
"\" file = \"" << fnU.str() <<
"\"/>\n";
87 std::stringstream fnP;
88 fnP << filenameP.str() << p <<
".vts";
89 fileP <<
"<DataSet timestep = \"" << m_iterationNumber <<
"\" part = \"" << p <<
"\" file = \"" << fnP.str() <<
"\"/>\n";
94template<
class T,
int MatOrder>
97 GISMO_ASSERT(this->getAssembler()->isInitialized(),
"Assembler must be initialized first, call initialize()");
99 this->updateAssembler();
101 if (!m_iterationNumber)
102 this->initIteration();
106 this->applySolver(tmpSolution);
108 this->writeSolChangeRelNorm(m_solution, tmpSolution);
111 T relNorm = this->solutionChangeRelNorm(m_solution, tmpSolution);
113 gsWriteOutputLine(m_outFile,
" [u, p] Picard's iterations...", m_fileOutput, m_dispOutput);
115 while((relNorm > m_innerTol) && (picardIter < m_innerIter))
121 this->updateAssembler(tmpSolution,
false);
122 this->applySolver(tmpSolution);
123 this->writeSolChangeRelNorm(oldSol, tmpSolution);
125 relNorm = this->solutionChangeRelNorm(oldSol, tmpSolution);
129 m_solution = tmpSolution;
131 m_time += m_timeStepSize;
132 m_avgPicardIter += picardIter;
137template<
class T,
int MatOrder>
141 std::string fileNameU =
"velocity" + fileNameSuffix +
"_animation.pvd";
142 std::ofstream fileU(fileNameU.c_str());
143 GISMO_ASSERT(fileU.is_open(),
"Error creating " << fileNameU);
145 std::string fileNameP =
"pressure" + fileNameSuffix +
"_animation.pvd";
146 std::ofstream fileP(fileNameP.c_str());
147 GISMO_ASSERT(fileP.is_open(),
"Error creating " << fileNameP);
149 startAnimationFile(fileU);
150 startAnimationFile(fileP);
152 plotCurrentTimeStep(fileU, fileP, fileNameSuffix, plotPts);
154 for (
int i = 0; i < totalIter; i += iterStep)
156 this->solve(math::min(iterStep, totalIter), epsilon, minIterations);
158 plotCurrentTimeStep(fileU, fileP, fileNameSuffix, plotPts);
161 endAnimationFile(fileU);
162 endAnimationFile(fileP);