Commit 792dba47 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

rewrite readMsh and rename to readIdx

parent e2e4b25f
Pipeline #1172 passed with stage
in 27 minutes and 33 seconds
......@@ -461,9 +461,10 @@ void slim3dSolverFunctions::initialize()
kappahT = kappahJumpT;
}
}
else
else {
kappahS = kappahUser;
kappahT = kappahUser;
}
}
// bottom friction
if ( _solver->getComputeBottomFriction() ) {
......
......@@ -146,8 +146,16 @@ slim3dTimeIntegrator::~slim3dTimeIntegrator()
if( momVNewtonSol ) delete momVNewtonSol;
if( SDiffNewtonSol ) delete SDiffNewtonSol;
if( TDiffNewtonSol ) delete TDiffNewtonSol;
if(sedDiffNewton.size() != 0) for (int iSedEq = 0; iSedEq < _solver->getNumSedEq(); ++iSedEq){delete sedDiffNewton[iSedEq];} sedDiffNewton.resize(0);
for (size_t i = 0; i < sedDiffNewtonSol.size() ; ++i) { delete sedDiffNewtonSol[i];} sedDiffNewtonSol.resize(0);
if(sedDiffNewton.size() != 0) {
for (int iSedEq = 0; iSedEq < _solver->getNumSedEq(); ++iSedEq){
delete sedDiffNewton[iSedEq];
}
}
sedDiffNewton.resize(0);
for (size_t i = 0; i < sedDiffNewtonSol.size() ; ++i) {
delete sedDiffNewtonSol[i];
}
sedDiffNewtonSol.resize(0);
if (_volConservationChecker) delete _volConservationChecker;
if (_SConservationChecker) delete _SConservationChecker;
if (_TConservationChecker) delete _TConservationChecker;
......@@ -1547,16 +1555,14 @@ void slim3dTimeIntegratorPC::reStart(std::string directory, int export_i)
std::stringstream iExportStream;
iExportStream << "-" << std::setfill('0') << std::setw(6) << export_i;
std::string iExportStr = iExportStream.str();
double t;
int step;
std::string fieldName;
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"uv"+iExportStr).c_str());
d->uvDof->readMsh(directory+"uv/uv"+iExportStr+".idx",t,step);
double t = d->uvDof->importIdx(directory+"uv/uv"+iExportStr+".idx");
d->uvDof->scatter(true);
uvDof_new->copy(*d->uvDof); // same as i
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"uvOld"+iExportStr).c_str());
uvDof_old->readMsh(directory+"uvOld/uvOld"+iExportStr+".idx",t,step);
uvDof_old->importIdx(directory+"uvOld/uvOld"+iExportStr+".idx");
uvDof_old->scatter(true);
......@@ -1572,40 +1578,40 @@ void slim3dTimeIntegratorPC::reStart(std::string directory, int export_i)
if (_solver->getSolveUVImplicitVerticalDiffusion() || _solver->getSolveUVImplicitVerticalAdvection()){
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"uKim"+iExportStr).c_str());
momUNewtonSol->readMsh(directory+"uKim/uKim"+iExportStr+".idx",t,step);
momUNewtonSol->importIdx(directory+"uKim/uKim"+iExportStr+".idx");
uKim = momUNewtonSol;
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"vKim"+iExportStr).c_str());
momVNewtonSol->readMsh(directory+"vKim/vKim"+iExportStr+".idx",t,step);
momVNewtonSol->importIdx(directory+"vKim/vKim"+iExportStr+".idx");
vKim = momVNewtonSol;
}
if ( _solver->getSolveS() || _solver->getSolveSImplicitVerticalDiffusion() ) {
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"S"+iExportStr).c_str());
d->SDof->readMsh(directory+"S/S"+iExportStr+".idx",t,step);
d->SDof->importIdx(directory+"S/S"+iExportStr+".idx");
d->SDof->scatter(true);
SDof_new->copy(*d->SDof); // same as i
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"SOld"+iExportStr).c_str());
SDof_old->readMsh(directory+"SOld/SOld"+iExportStr+".idx",t,step);
SDof_old->importIdx(directory+"SOld/SOld"+iExportStr+".idx");
SDof_old->scatter(true);
}
if (_solver->getSolveSImplicitVerticalDiffusion() || _solver->getSolveSImplicitVerticalAdvection()){
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"SKim"+iExportStr).c_str());
SDiffNewtonSol->readMsh(directory+"SKim/SKim"+iExportStr+".idx",t,step);
SDiffNewtonSol->importIdx(directory+"SKim/SKim"+iExportStr+".idx");
SKim = SDiffNewtonSol;
}
if ( _solver->getSolveT() || _solver->getSolveTImplicitVerticalDiffusion() ) {
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"T"+iExportStr).c_str());
d->TDof->readMsh(directory+"T/T"+iExportStr+".idx",t,step);
d->TDof->importIdx(directory+"T/T"+iExportStr+".idx");
d->TDof->scatter(true);
TDof_new->copy(*d->TDof); // same as i
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"TOld"+iExportStr).c_str());
TDof_old->readMsh(directory+"TOld/TOld"+iExportStr+".idx",t,step);
TDof_old->importIdx(directory+"TOld/TOld"+iExportStr+".idx");
TDof_old->scatter(true);
}
if (_solver->getSolveTImplicitVerticalDiffusion() || _solver->getSolveTImplicitVerticalAdvection()){
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"TKim"+iExportStr).c_str());
TDiffNewtonSol->readMsh(directory+"TKim/TKim"+iExportStr+".idx",t,step);
TDiffNewtonSol->importIdx(directory+"TKim/TKim"+iExportStr+".idx");
TKim = TDiffNewtonSol;
}
......@@ -1615,18 +1621,18 @@ void slim3dTimeIntegratorPC::reStart(std::string directory, int export_i)
ss << iSedEq;
std::string iSedString = ss.str();
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"sed_"+ iSedString + iExportStr).c_str());
d->sedDof[iSedEq]->readMsh(directory+"sed_" + iSedString + "/sed_" + iSedString + iExportStr+".idx",t,step);
d->sedDof[iSedEq]->importIdx(directory+"sed_" + iSedString + "/sed_" + iSedString + iExportStr+".idx");
d->sedDof[iSedEq]->scatter(true);
sedDof_new[iSedEq]->copy(*d->sedDof[iSedEq]); // same as i
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"sedOld_"+ iSedString + iExportStr).c_str());
sedDof_old[iSedEq]->readMsh(directory+"sedOld_" + iSedString + "/sedOld_" + iSedString + iExportStr+".idx",t,step);
sedDof_old[iSedEq]->importIdx(directory+"sedOld_" + iSedString + "/sedOld_" + iSedString + iExportStr+".idx");
sedDof_old[iSedEq]->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"sedGround_"+ iSedString + iExportStr).c_str());
d->sedGroundDof2d[iSedEq]->readMsh(directory+"sedGround_" + iSedString + "/sedGround_" + iSedString +iExportStr+".idx",t,step);
d->sedGroundDof2d[iSedEq]->importIdx(directory+"sedGround_" + iSedString + "/sedGround_" + iSedString +iExportStr+".idx");
d->sedGroundDof2d[iSedEq]->scatter(true);
sedGroundDof_new[iSedEq]->copy(*d->sedGroundDof2d[iSedEq]); // same as i
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"sedGroundOld_"+ iSedString + iExportStr).c_str());
sedGroundDof_old[iSedEq]->readMsh(directory+"sedGroundOld_" + iSedString + "/sedGroundOld_" + iSedString +iExportStr+".idx",t,step);
sedGroundDof_old[iSedEq]->importIdx(directory+"sedGroundOld_" + iSedString + "/sedGroundOld_" + iSedString +iExportStr+".idx");
sedGroundDof_old[iSedEq]->scatter(true);
}
}
......@@ -1636,27 +1642,27 @@ void slim3dTimeIntegratorPC::reStart(std::string directory, int export_i)
ss << iSedEq;
std::string iSedString = ss.str();
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"sedKim_"+ iSedString + iExportStr).c_str());
sedDiffNewtonSol[iSedEq]->readMsh(directory+"sedKim_" + iSedString + "/sedKim_"+ iSedString + iExportStr+".idx",t,step);
sedDiffNewtonSol[iSedEq]->importIdx(directory+"sedKim_" + iSedString + "/sedKim_"+ iSedString + iExportStr+".idx");
sedKim[iSedEq] = sedDiffNewtonSol[iSedEq];
}
}
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"eta2d"+iExportStr).c_str());
d->etaDof2d->readMsh(directory+"eta2d/eta2d"+iExportStr+".idx",t,step);
d->etaDof2d->importIdx(directory+"eta2d/eta2d"+iExportStr+".idx");
d->etaDof2d->scatter(true);
f->eta2dFunc->compute(*d->etaDof2d->getFunction());
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"eta2dTavNew"+iExportStr).c_str());
etaDof2d_tav_new->readMsh(directory+"eta2dTavNew/eta2dTavNew"+iExportStr+".idx",t,step);
etaDof2d_tav_new->importIdx(directory+"eta2dTavNew/eta2dTavNew"+iExportStr+".idx");
etaDof2d_tav_new->scatter(true);
// update geometry to eta^{n+1}
etaDependencies(etaDof2d_tav_new);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"uvAv2d"+iExportStr).c_str());
d->uvAvDof2d->readMsh(directory+"uvAv2d/uvAv2d"+iExportStr+".idx",t,step);
d->uvAvDof2d->importIdx(directory+"uvAv2d/uvAv2d"+iExportStr+".idx");
d->uvAvDof2d->scatter(true);
f->uvAv2dFunc->compute(*d->uvAvDof2d->getFunction());
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"uvInt2dTavNew"+iExportStr).c_str());
uvIntDof2d_tav_new->readMsh(directory+"uvInt2dTavNew/uvInt2dTavNew"+iExportStr+".idx",t,step);
uvIntDof2d_tav_new->importIdx(directory+"uvInt2dTavNew/uvInt2dTavNew"+iExportStr+".idx");
uvIntDof2d_tav_new->scatter(true);
......@@ -1666,44 +1672,44 @@ void slim3dTimeIntegratorPC::reStart(std::string directory, int export_i)
_solver->getEquations()->turbMod->initialize();
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"tke"+iExportStr).c_str());
d->tkeDof->readMsh(directory+"tke/tke"+iExportStr+".idx",t,step);
d->tkeDof->importIdx(directory+"tke/tke"+iExportStr+".idx");
d->tkeDof->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"eps"+iExportStr).c_str());
d->epsDof->readMsh(directory+"eps/eps"+iExportStr+".idx",t,step);
d->epsDof->importIdx(directory+"eps/eps"+iExportStr+".idx");
d->epsDof->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"nuv"+iExportStr).c_str());
d->nuvDof->readMsh(directory+"nuv/nuv"+iExportStr+".idx",t,step);
d->nuvDof->importIdx(directory+"nuv/nuv"+iExportStr+".idx");
d->nuvDof->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"kappav"+iExportStr).c_str());
d->kappavDof->readMsh(directory+"kappav/kappav"+iExportStr+".idx",t,step);
d->kappavDof->importIdx(directory+"kappav/kappav"+iExportStr+".idx");
d->kappavDof->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"nuvCenter"+iExportStr).c_str());
d->nuvDofCenter->readMsh(directory+"nuvCenter/nuvCenter"+iExportStr+".idx",t,step);
d->nuvDofCenter->importIdx(directory+"nuvCenter/nuvCenter"+iExportStr+".idx");
d->nuvDofCenter->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"kappavCenter"+iExportStr).c_str());
d->kappavDofCenter->readMsh(directory+"kappavCenter/kappavCenter"+iExportStr+".idx",t,step);
d->kappavDofCenter->importIdx(directory+"kappavCenter/kappavCenter"+iExportStr+".idx");
d->kappavDofCenter->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"epsK2"+iExportStr).c_str());
epsDof_K2->readMsh(directory+"epsK2/epsK2"+iExportStr+".idx",t,step);
epsDof_K2->importIdx(directory+"epsK2/epsK2"+iExportStr+".idx");
epsDof_K2->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"epsK3"+iExportStr).c_str());
epsDof_K3->readMsh(directory+"epsK3/epsK3"+iExportStr+".idx",t,step);
epsDof_K3->importIdx(directory+"epsK3/epsK3"+iExportStr+".idx");
epsDof_K3->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"tkeK2"+iExportStr).c_str());
tkeDof_K2->readMsh(directory+"tkeK2/tkeK2"+iExportStr+".idx",t,step);
tkeDof_K2->importIdx(directory+"tkeK2/tkeK2"+iExportStr+".idx");
tkeDof_K2->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"tkeK3"+iExportStr).c_str());
tkeDof_K3->readMsh(directory+"tkeK3/tkeK3"+iExportStr+".idx",t,step);
tkeDof_K3->importIdx(directory+"tkeK3/tkeK3"+iExportStr+".idx");
tkeDof_K3->scatter(true);
if (Msg::GetCommRank() == 0) Msg::Info("reading file: %s",(directory+"uvCenter"+iExportStr).c_str());
d->uvDofCenter->readMsh(directory+"uvCenter/uvCenter"+iExportStr+".idx",t,step);
d->uvDofCenter->importIdx(directory+"uvCenter/uvCenter"+iExportStr+".idx");
d->uvDofCenter->scatter(true);
// uvDofCenter will be overwritten in advanceOneTimeStep, so we need to evaluate it now
_solver->getEquations()->turbMod->evaluateUVAtCellCenters();
......
......@@ -52,8 +52,8 @@ for rkn in range (0,len(RK_TYPES)):
solution_ref.setAll(0.0)
Common.rundgpy("PartitionStommel.py %d %d" % (rkn, nbp[i]))
Common.rundgpy("ScalingMultirateStommel.py %d" %(rkn), nbp[i])
solution_ref.readMsh(outputDir+"solution_export_%d_%d/solution_export_%d_%d.idx"%(rkn, 1, rkn, 1))
solution.readMsh(outputDir+"solution_export_%d_%d/solution_export_%d_%d.idx"%(rkn, nbp[i], rkn, nbp[i]))
solution_ref.importIdx(outputDir+"solution_export_%d_%d/solution_export_%d_%d.idx"%(rkn, 1, rkn, 1))
solution.importIdx(outputDir+"solution_export_%d_%d/solution_export_%d_%d.idx"%(rkn, nbp[i], rkn, nbp[i]))
solution.axpy(solution_ref, -1)
diff.append(solution.norm())
if solution.norm() > 0.00000000000000001:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment