write RANSValues from solver to stgLVariables (fully coupled zonal) /author Sutharsan
1140 {
1141 TRACE();
1142
1145 const MInt IBC =
a->getStgId(it);
1147
1148
1150 ASSERT(cellId < (
MInt)
m_solver->m_RANSValues[varId].size(),
1151 "Trying to access data [" + std::to_string(cellId) + "] in RANSValues with length "
1152 + std::to_string(
m_solver->m_RANSValues[varId].size())
1153 +
", domainId: " + std::to_string(
m_solver->domainId()));
1154 }
1155
1161
1163
1166 }
1167
1168
1169
1177 }
1178 }
1179 } else {
1180
1182 stringstream fn;
1183 fn.clear();
1185 fn << prop_name << "preliminaryDataRans2D.txt";
1188
1189 ifstream preliminaryData;
1190 preliminaryData.open(fname);
1191
1192 vector<MFloat> data;
1194 string line;
1195
1196 while(preliminaryData >> num) {
1197 data.push_back(num);
1198 }
1199
1200
1201 prop_name =
"bc" + std::to_string(
m_bcId) +
"preliminaryRansDataCount";
1202 MInt preliminaryDataVarCount =
1203 Context::getSolverProperty<MInt>(prop_name,
m_solverId, AT_, &preliminaryDataVarCount);
1204
1205 MInt dataCount = data.size() / preliminaryDataVarCount;
1206
1207 vector<vector<MFloat>> preData(dataCount, vector<MFloat>(preliminaryDataVarCount, 0));
1208
1210 for(
MInt d = 0; d < dataCount; d++) {
1211 for(
MInt dd = 0; dd < preliminaryDataVarCount; dd++) {
1212 index = preliminaryDataVarCount * d + dd;
1213 preData[d][dd] = data[
index];
1214 }
1215 }
1216
1217 preliminaryData.close();
1218
1220 const MInt IBC =
a->getStgId(it);
1223
1224 for(
MInt d = 0; d < dataCount - 1; d++) {
1225 if(pos >= preData[d][0] && pos < preData[d + 1][0]) {
1228 preData[d][var]
1229 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1230 var = 2;
1232 preData[d][var]
1233 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1234 var = 3;
1236 preData[d][var]
1237 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1238 var = 4;
1240 preData[d][var]
1241 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1242 var = 5;
1244 preData[d][var]
1245 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1246 var = 6;
1248 preData[d][var]
1249 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1250 var = 7;
1252 preData[d][var]
1253 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1254 var = 8;
1256 preData[d][var]
1257 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1258 var = 9;
1260 preData[d][var]
1261 + (preData[d + 1][var] - preData[d][var]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1266 }
1267 }
1268 }
1269 }
1270
1272 stringstream fn;
1273 fn.clear();
1275 fn << prop_name << "preliminaryData.txt";
1276
1278
1280
1281 ifstream preliminaryData;
1282 preliminaryData.open(fname);
1283
1284 vector<MFloat> data;
1286
1287 while(preliminaryData >> num) {
1288 data.push_back(num);
1289 }
1290
1291
1292 MInt preliminaryDataVarCount = 1 +
m_solver->noVariables() + 8;
1293 MInt dataCount = data.size() / preliminaryDataVarCount;
1294
1295 vector<vector<MFloat>> preData(dataCount, vector<MFloat>(preliminaryDataVarCount, 0));
1296
1298 for(
MInt d = 0; d < dataCount; d++) {
1299 for(
MInt dd = 0; dd < preliminaryDataVarCount; dd++) {
1300 index = preliminaryDataVarCount * d + dd;
1301 preData[d][dd] = data[
index];
1302 }
1303 }
1304
1305 preliminaryData.close();
1306
1308
1310 const MInt IBC =
a->getStgId(it);
1312
1317 pos = sqrt(
y *
y + z * z);
1318 }
1319
1320 for(
MInt d = 0; d < dataCount; d++) {
1321 if(abs(pos - preData[d][0]) / pos < 0.001) {
1322
1323 for(
MInt var = 0; var < nDim + 2; var++) {
1325 if(var < nDim) {
1327 }
1328 }
1332 v++;
1333 }
1334 MInt index_ = preliminaryDataVarCount - 1;
1336 } else {
1337 if(d == dataCount - 1) continue;
1338
1339 if(pos >= preData[d][0] && pos < preData[d + 1][0]) {
1340 for(
MInt var = 0; var < nDim + 2; var++) {
1342 + (preData[d + 1][var + 1] - preData[d][var + 1]) * (pos - preData[d][0])
1343 / (preData[d + 1][0] - preData[d][0]);
1344
1345 if(var < nDim) {
1347 }
1348 }
1352 preData[d][v]
1353 + (preData[d + 1][v] - preData[d][v]) * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1354
1355 v++;
1356 }
1357
1358 MInt index_ = preliminaryDataVarCount - 1;
1360 + (preData[d + 1][index_] - preData[d][index_])
1361 * (pos - preData[d][0]) / (preData[d + 1][0] - preData[d][0]);
1362 }
1363 }
1364 }
1365 }
1366 }
1367 }
1368}