コード例 #1
0
void SolidRotationTestCase::calcSolution(double time,
                                         const TimeLevelIndex<2> &timeIdx,
                                         AdvectionManager &advectionManager) {
    calcSolution(time, timeIdx, *q.front());
    advectionManager.input(timeIdx, q);
    REPORT_NOTICE("Overwrite tracers with the true solution.");
}
コード例 #2
0
void SolidRotationTestCase::calcInitCond(AdvectionManager &advectionManager) {
    q.push_back(new LADY_SCALAR_FIELD);
    q.front()->create("", "", "", *mesh, CENTER);
    TimeLevelIndex<2> initTimeIdx;
    calcSolution(0, initTimeIdx, *q.front());
    AdvectionTestCase::calcInitCond(advectionManager);
}
コード例 #3
0
ファイル: MovingVortices.cpp プロジェクト: dongli/TTS-I
void MovingVortices::calcInitCond(MeshManager &meshManager,
                                  MeshAdaptor &meshAdaptor,
                                  TracerManager &tracerManager)
{
    // -------------------------------------------------------------------------
    // two dual meshes
    const RLLMesh &meshCnt = meshManager.getMesh(PointCounter::Center);
    const RLLMesh &meshBnd = meshManager.getMesh(PointCounter::Bound);
    // -------------------------------------------------------------------------
    // evaluate the initial condition on the RLL mesh of point counter
    tracerManager.registerTracer("test tracer 0", "test unit", meshManager);
    Field qt;
    qt.init(meshCnt, meshBnd);
    Array<double, 2> qtmp(meshCnt.getNumLon(), meshCnt.getNumLat());
#ifdef DEBUG
    double totalCellMass = 0.0;
#endif
    calcSolution(0.0, meshCnt.lon, meshCnt.lat, qtmp);
    for (int i = 0; i < meshCnt.getNumLon()-1; ++i)
        for (int j = 0; j < meshCnt.getNumLat(); ++j) {
            qt.values(i, j) = qtmp(i, j);
#ifdef DEBUG
            totalCellMass += qt.values(i, j).getNew()*meshBnd.area(i, j);
#endif
        }
    // -------------------------------------------------------------------------
    // check the location polygon vertices
    Vertex *vertex = tracerManager.polygonManager.vertices.front();
    for (int i = 0; i < tracerManager.polygonManager.vertices.size(); ++i) {
        Location loc;
        meshManager.checkLocation(vertex->getCoordinate(), loc, vertex);
        vertex->setLocation(loc);
        vertex = vertex->next;
    }
    // -------------------------------------------------------------------------
    meshAdaptor.adapt(tracerManager, meshManager);
    // -------------------------------------------------------------------------
    meshAdaptor.remap("test tracer 0", qt, tracerManager);
    // -------------------------------------------------------------------------
#ifdef DEBUG
    double totalPolygonMass = 0.0;
    Polygon *polygon = tracerManager.polygonManager.polygons.front();
    for (int i = 0; i < tracerManager.polygonManager.polygons.size(); ++i) {
        totalPolygonMass += polygon->tracers[0].getMass();
        polygon = polygon->next;
    }
    cout << "Total cell mass is    " << setprecision(20) << totalCellMass << endl;
    cout << "Total polygon mass is " << setprecision(20) << totalPolygonMass << endl;
    cout << "Mass error is " << totalCellMass-totalPolygonMass << endl;
#endif
    // -------------------------------------------------------------------------
    meshAdaptor.remap("test tracer 0", tracerManager);
}
コード例 #4
0
ファイル: MovingVortices.cpp プロジェクト: dongli/TTS-I
void MovingVortices::calcSolution(MeshManager &meshManager,
                                  MeshAdaptor &meshAdaptor,
                                  TracerManager &tracerManager)
{
    // -------------------------------------------------------------------------
    // two dual meshes
    const RLLMesh &meshCnt = meshManager.getMesh(PointCounter::Center);
    const RLLMesh &meshBnd = meshManager.getMesh(PointCounter::Bound);
    // -------------------------------------------------------------------------
    // evaluate the initial condition on the RLL mesh of point counter
    Field q0;
    q0.init(meshCnt, meshBnd);
    calcSolution(q0);
    // -------------------------------------------------------------------------
    meshAdaptor.remap("test tracer", q0, tracerManager);
    // -------------------------------------------------------------------------
    meshAdaptor.remap("test tracer", tracerManager);
    
}