void ImplicitMultiLevelFsiSolver::optimize(
    const fsi::vector & y,
    const fsi::vector & x0,
    fsi::vector & xk
    )
{
    assert( init );

    assert( y.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || y.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x0.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || x0.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( xk.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || xk.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x0.rows() == xk.rows() );
    assert( y.rows() == xk.rows() );

    fsi->newMeasurementSeries();

    postProcessing->performPostProcessing( y, x0, xk );
}
void ImplicitMultiLevelFsiSolver::evaluate(
    const fsi::vector & x,
    fsi::vector & output,
    fsi::vector & R
    )
{
    assert( init );

    assert( x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( output.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || output.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( R.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || R.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x.rows() == output.rows() );
    assert( x.rows() == R.rows() );

    fsi->evaluate( x, output, R );
}
    virtual void optimize(
        const fsi::vector & y,
        const fsi::vector & /*x0*/,
        fsi::vector & xk
        )
    {
        assert( y.rows() == 3 );
        assert( xk.rows() == 2 );

        // Analytical optimum
        xk( 0 ) = (y[2] - y[0]) / 2.0;
        xk( 1 ) = (y[0] + y[1] + y[2]) / 3.0;
    }
示例#4
0
    virtual void evaluate(
        const fsi::vector & x,
        fsi::vector & output,
        fsi::vector & R
        )
    {
        assert( x.rows() == 2 );
        assert( R.rows() == 3 );

        fsi::vector t( 3 );
        t << -1, 0, 1;

        R = x( 0 ) * t + x( 1 ) * Eigen::MatrixXd::Ones( 3, 1 );
        output = R;
    }
示例#5
0
    virtual void evaluate(
        const fsi::vector & x,
        fsi::vector & output,
        fsi::vector & R
        )
    {
        assert( x.rows() == 2 );
        assert( R.rows() == 3 );

        fsi::vector t( 3 );
        t << -1, 0, 1;

        R = x( 0 ) * (x( 1 ) * t.array() + 1.0).pow( 2 );
        output = R;
    }
示例#6
0
    virtual bool isConvergence(
        const fsi::vector & x,
        const fsi::vector & xprev
        )
    {
        assert( x.rows() == xprev.rows() );

        iter++;

        allConverged_ = false;

        if ( (x - xprev).norm() < tol * x.norm() )
            allConverged_ = true;

        return allConverged_;
    }
示例#7
0
文件: ESDIRK.C 项目: gunnups/FOAM-FSI
    void ESDIRK::setFunction(
        const int k,
        const fsi::vector & f,
        const fsi::vector & result
        )
    {
        assert( f.rows() == result.rows() );
        assert( k <= nbStages - 1 );

        if ( F.cols() == 0 )
            F.resize( nbStages, f.rows() );

        if ( solStages.cols() == 0 )
            solStages.resize( nbStages, f.rows() );

        F.row( k ) = f;
        solStages.row( k ) = result;
    }
示例#8
0
void SDCFsiSolver::getSolution(
    fsi::vector & solution,
    fsi::vector & f
    )
{
    assert( dofFluid > 0 );
    assert( dofSolid >= 0 );
    assert( dofFluid + dofSolid == solution.rows() );
    assert( solution.rows() == f.rows() );

    fsi::vector solFluid( dofFluid ), solSolid( dofSolid ), fFluid( dofFluid ), fSolid( dofSolid );
    fluid->getSolution( solFluid, fFluid );
    solid->getSolution( solSolid, fSolid );

    solution.head( dofFluid ) = solFluid;
    solution.tail( dofSolid ) = solSolid;
    f.head( dofFluid ) = fFluid;
    f.tail( dofSolid ) = fSolid;
}
示例#9
0
 void DataStorage::storeSolution(
     const fsi::vector & sol,
     int substep
     )
 {
     assert( sol.rows() == solStages.cols() );
     assert( substep <= solStages.rows() );
     assert( not std::isnan( sol.norm() ) );
     solStages.row( substep ) = sol;
 }
示例#10
0
 void DataStorage::storeFunction(
     const fsi::vector & f,
     int substep
     )
 {
     assert( f.rows() == F.cols() );
     assert( substep <= F.rows() );
     assert( not std::isnan( f.norm() ) );
     F.row( substep ) = f;
 }
示例#11
0
 int operator()(
     const fsi::vector & x,
     fsi::vector & fvec
     ) const
 {
     fsi::vector output( x.rows() );
     model->evaluate( x, output, fvec );
     fvec -= *y;
     return 0;
 }
示例#12
0
文件: ESDIRK.C 项目: gunnups/FOAM-FSI
    void ESDIRK::setOldSolution(
        int timeIndex,
        const fsi::vector & result
        )
    {
        assert( timeIndex >= this->timeIndex );

        if ( qold.rows() == result.rows() )
            qold = solStages.bottomRows( 1 ).transpose();
        else
        if ( timeIndex > this->timeIndex )
            qold = result;

        this->timeIndex = timeIndex;
    }
bool ImplicitMultiLevelFsiSolver::isConvergence(
    const fsi::vector & x,
    const fsi::vector & xprev
    )
{
    assert( init );

    assert( x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || x.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( xprev.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        || xprev.rows() == fsi->solidSolver->couplingGridSize * fsi->solid->dim
        + fsi->fluidSolver->couplingGridSize * fsi->fluid->dim );

    assert( x.rows() == xprev.rows() );

    return fsi->isConvergence( x, xprev );
}