@@ -1929,8 +1929,6 @@ void CSolver::SetResidual_RMS(const CGeometry *geometry, const CConfig *config)
19291929
19301930 if (geometry->GetMGLevel () != MESH_0) return ;
19311931
1932- AD::StartNoSharedReading ();
1933-
19341932 SU2_OMP_MASTER {
19351933
19361934 /* --- Set the L2 Norm residual in all the processors. ---*/
@@ -1987,16 +1985,12 @@ void CSolver::SetResidual_RMS(const CGeometry *geometry, const CConfig *config)
19871985 }
19881986 END_SU2_OMP_MASTER
19891987 SU2_OMP_BARRIER
1990-
1991- AD::EndNoSharedReading ();
19921988}
19931989
19941990void CSolver::SetResidual_BGS (const CGeometry *geometry, const CConfig *config) {
19951991
19961992 if (geometry->GetMGLevel () != MESH_0) return ;
19971993
1998- AD::StartNoSharedReading ();
1999-
20001994 SU2_OMP_MASTER {
20011995
20021996 /* --- Set the L2 Norm residual in all the processors. ---*/
@@ -2034,8 +2028,6 @@ void CSolver::SetResidual_BGS(const CGeometry *geometry, const CConfig *config)
20342028 }
20352029 END_SU2_OMP_MASTER
20362030 SU2_OMP_BARRIER
2037-
2038- AD::EndNoSharedReading ();
20392031}
20402032
20412033void CSolver::SetRotatingFrame_GCL (CGeometry *geometry, const CConfig *config) {
@@ -4119,8 +4111,6 @@ void CSolver::ComputeResidual_Multizone(const CGeometry *geometry, const CConfig
41194111
41204112 SU2_OMP_PARALLEL {
41214113
4122- AD::StartNoSharedReading ();
4123-
41244114 /* --- Set Residuals to zero ---*/
41254115 SU2_OMP_MASTER
41264116 for (unsigned short iVar = 0 ; iVar < nVar; iVar++){
@@ -4162,8 +4152,6 @@ void CSolver::ComputeResidual_Multizone(const CGeometry *geometry, const CConfig
41624152 END_SU2_OMP_CRITICAL
41634153 SU2_OMP_BARRIER
41644154
4165- AD::EndNoSharedReading ();
4166-
41674155 SetResidual_BGS (geometry, config);
41684156
41694157 }
@@ -4225,7 +4213,7 @@ void CSolver::BasicLoadRestart(CGeometry *geometry, const CConfig *config, const
42254213}
42264214
42274215void CSolver::SavelibROM (CGeometry *geometry, CConfig *config, bool converged) {
4228-
4216+
42294217#if defined(HAVE_LIBROM) && !defined(CODI_FORWARD_TYPE) && !defined(CODI_REVERSE_TYPE)
42304218 const bool unsteady = config->GetTime_Domain ();
42314219 const string filename = config->GetlibROMbase_FileName ();
@@ -4237,38 +4225,38 @@ void CSolver::SavelibROM(CGeometry *geometry, CConfig *config, bool converged) {
42374225 bool incremental = false ;
42384226
42394227 if (!u_basis_generator) {
4240-
4228+
42414229 /* --- Define SVD basis generator ---*/
42424230 auto timesteps = static_cast <int >(nTimeIter - TimeIter);
42434231 CAROM::Options svd_options = CAROM::Options (dim, timesteps, -1 ,
42444232 false , true ).setMaxBasisDimension (int (maxBasisDim));
4245-
4233+
42464234 if (config->GetKind_PODBasis () == POD_KIND::STATIC) {
42474235 if (rank == MASTER_NODE) std::cout << " Creating static basis generator." << std::endl;
4248-
4236+
42494237 if (unsteady) {
42504238 if (rank == MASTER_NODE) std::cout << " Incremental basis generator recommended for unsteady simulations." << std::endl;
42514239 }
42524240 }
42534241 else {
42544242 if (rank == MASTER_NODE) std::cout << " Creating incremental basis generator." << std::endl;
4255-
4243+
42564244 svd_options.setIncrementalSVD (1.0e-3 , config->GetDelta_UnstTime (),
42574245 1.0e-2 , config->GetDelta_UnstTime ()*nTimeIter, true ).setDebugMode (false );
42584246 incremental = true ;
42594247 }
4260-
4248+
42614249 u_basis_generator.reset (new CAROM::BasisGenerator (
42624250 svd_options, incremental,
42634251 filename));
4264-
4252+
42654253 // Save mesh ordering
42664254 std::ofstream f;
42674255 f.open (filename + " _mesh_" + to_string (rank) + " .csv" );
42684256 for (unsigned long iPoint = 0 ; iPoint < nPointDomain; iPoint++) {
42694257 unsigned long globalPoint = geometry->nodes ->GetGlobalIndex (iPoint);
42704258 auto Coord = geometry->nodes ->GetCoord (iPoint);
4271-
4259+
42724260 for (unsigned long iDim; iDim < nDim; iDim++) {
42734261 f << Coord[iDim] << " , " ;
42744262 }
@@ -4283,31 +4271,31 @@ void CSolver::SavelibROM(CGeometry *geometry, CConfig *config, bool converged) {
42834271 su2double t = config->GetCurrent_UnstTime ();
42844272 u_basis_generator->takeSample (const_cast <su2double*>(base_nodes->GetSolution ().data ()), t, dt);
42854273 }
4286-
4274+
42874275 /* --- End collection of data and save POD ---*/
4288-
4276+
42894277 if (converged) {
4290-
4278+
42914279 if (!unsteady) {
42924280 // dt is different for each node, so just use a placeholder dt
42934281 su2double dt = base_nodes->GetDelta_Time (0 );
42944282 su2double t = dt*TimeIter;
42954283 u_basis_generator->takeSample (const_cast <su2double*>(base_nodes->GetSolution ().data ()), t, dt);
42964284 }
4297-
4285+
42984286 if (config->GetKind_PODBasis () == POD_KIND::STATIC) {
42994287 u_basis_generator->writeSnapshot ();
43004288 }
4301-
4289+
43024290 if (rank == MASTER_NODE) std::cout << " Computing SVD" << std::endl;
43034291 int rom_dim = u_basis_generator->getSpatialBasis ()->numColumns ();
4304-
4292+
43054293 if (rank == MASTER_NODE) std::cout << " Basis dimension: " << rom_dim << std::endl;
43064294 u_basis_generator->endSamples ();
4307-
4295+
43084296 if (rank == MASTER_NODE) std::cout << " ROM Sampling ended" << std::endl;
43094297 }
4310-
4298+
43114299#else
43124300 SU2_MPI::Error (" SU2 was not compiled with libROM support." , CURRENT_FUNCTION);
43134301#endif
0 commit comments