void DataTest:: setVelocityField(const TimeLevelIndex<2> &timeIdx) { io.open(dataIdx); for (arma::uword m = 0; m < _domain->numDim(); ++m) { io.input<double>(dataIdx, timeIdx, {&velocityField(m)}); } if (timeIdx.isCurrentIndex()) { velocityField.applyBndCond(timeIdx); } else { velocityField.applyBndCond(timeIdx, UPDATE_HALF_LEVEL); } io.close(dataIdx); } // setVelocityField
void SolidRotationTestCase::advance(double time, const TimeLevelIndex<2> &timeIdx) { double sinAlpha = sin(alpha), cosAlpha = cos(alpha); for (int j = 0; j < mesh->getNumGrid(1, velocity(0).getGridType(1)); ++j) { double cosLat = mesh->getCosLat(velocity(0).getGridType(1), j); double sinLat = mesh->getSinLat(velocity(0).getGridType(1), j); for (int i = 0; i < mesh->getNumGrid(0, velocity(0).getGridType(0)); ++i) { double cosLon = mesh->getCosLon(velocity(0).getGridType(0), i); velocity(0)(timeIdx, i, j) = U0*(cosLat*cosAlpha+sinLat*cosLon*sinAlpha); } } for (int j = 0; j < mesh->getNumGrid(1, velocity(1).getGridType(1)); ++j) { for (int i = 0; i < mesh->getNumGrid(0, velocity(1).getGridType(0)); ++i) { double sinLon = mesh->getSinLon(velocity(1).getGridType(0), i); velocity(1)(timeIdx, i, j) = -U0*sinLon*sinAlpha; } } if (timeIdx.isCurrentIndex()) { velocity.applyBndCond(timeIdx); } else { velocity.applyBndCond(timeIdx, UPDATE_HALF_LEVEL); } }