| 1185 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 1186 | |
| 1187 | bool Foam::dynamicRefineFvMesh::update() |
| 1188 | { |
| 1189 | // Re-read dictionary. Choosen since usually -small so trivial amount |
| 1190 | // of time compared to actual refinement. Also very useful to be able |
| 1191 | // to modify on-the-fly. |
| 1192 | dictionary refineDict |
| 1193 | ( |
| 1194 | IOdictionary |
| 1195 | ( |
| 1196 | IOobject |
| 1197 | ( |
| 1198 | "dynamicMeshDict", |
| 1199 | time().constant(), |
| 1200 | *this, |
| 1201 | IOobject::MUST_READ_IF_MODIFIED, |
| 1202 | IOobject::NO_WRITE, |
| 1203 | false |
| 1204 | ) |
| 1205 | ).optionalSubDict(typeName + "Coeffs") |
| 1206 | ); |
| 1207 | |
| 1208 | label refineInterval = readLabel(refineDict.lookup("refineInterval")); |
| 1209 | |
| 1210 | bool hasChanged = false; |
| 1211 | |
| 1212 | if (refineInterval == 0) |
| 1213 | { |
| 1214 | topoChanging(hasChanged); |
| 1215 | |
| 1216 | return false; |
| 1217 | } |
| 1218 | else if (refineInterval < 0) |
| 1219 | { |
| 1220 | FatalErrorInFunction |
| 1221 | << "Illegal refineInterval " << refineInterval << nl |
| 1222 | << "The refineInterval setting in the dynamicMeshDict should" |
| 1223 | << " be >= 1." << nl |
| 1224 | << exit(FatalError); |
| 1225 | } |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | // Note: cannot refine at time 0 since no V0 present since mesh not |
| 1231 | // moved yet. |
| 1232 | |
| 1233 | if (time().timeIndex() > 0 && time().timeIndex() % refineInterval == 0) |
| 1234 | { |
| 1235 | label maxCells = readLabel(refineDict.lookup("maxCells")); |
| 1236 | |
| 1237 | if (maxCells <= 0) |
| 1238 | { |
| 1239 | FatalErrorInFunction |
| 1240 | << "Illegal maximum number of cells " << maxCells << nl |
| 1241 | << "The maxCells setting in the dynamicMeshDict should" |
| 1242 | << " be > 0." << nl |
| 1243 | << exit(FatalError); |
| 1244 | } |
nothing calls this directly
no test coverage detected