Beispiel #1
0
// ===================================================
// Inline conversion methods
// ===================================================
inline Real
OneDFSIPhysics::fromPToA( const Real& P, const Real& timeStep, const UInt& iNode, const bool& elasticExternalNodes ) const
{
    if ( !M_dataPtr->viscoelasticWall() || ( ( iNode == 0 || iNode == M_dataPtr->numberOfNodes() - 1 ) && elasticExternalNodes ) )
        return ( M_dataPtr->area0( iNode ) * OneDFSI::pow20( ( P - externalPressure() ) / M_dataPtr->beta0( iNode ) + 1, 1 / M_dataPtr->beta1( iNode ) )  );
    else
    {
        // Newton method to solve the non linear equation
        Real tolerance(1e-6);
        Real maxIT(100);
        UInt i(0);

        Real A( M_dataPtr->area0( iNode ) );
        Real newtonUpdate(0);
        for ( ; i < maxIT ; ++i )
        {
            if ( std::abs( pressure( A, timeStep, iNode, elasticExternalNodes ) - P ) < tolerance )
                break;

            newtonUpdate = ( pressure( A, timeStep, iNode, elasticExternalNodes ) - P ) / dPdA( A, timeStep, iNode, elasticExternalNodes );
            if ( A - newtonUpdate <= 0 )
                A /= 2.0; // Bisection
            else
                A -= newtonUpdate; // Newton
        }
        if ( i == maxIT )
        {
            std::cout << "!!! Warning: conversion fromPToA below tolerance !!! " << std::endl;
            std::cout << "Tolerance: " << tolerance << "; Residual: " << std::abs( pressure( A, timeStep, iNode, elasticExternalNodes ) - P ) << std::endl;
        }

        return A;
    }
}
Beispiel #2
0
inline Real
OneDFSIPhysics::dAdP( const Real& P, const Real& timeStep, const UInt& iNode, const bool& elasticExternalNodes ) const
{
    if ( !M_dataPtr->viscoelasticWall() || ( ( iNode == 0 || iNode == M_dataPtr->numberOfNodes() - 1 ) && elasticExternalNodes ) )
    {
        return M_dataPtr->area0( iNode ) / ( M_dataPtr->beta0( iNode ) * M_dataPtr->beta1( iNode ) )
                                      * OneDFSI::pow10( 1 + ( P - externalPressure() )
                                      / M_dataPtr->beta0( iNode ), 1 / M_dataPtr->beta1( iNode ) - 1 );
    }
    else
    {
        // Finite difference approach
        return ( fromPToA( P + M_dataPtr->jacobianPerturbationStress(), timeStep, iNode, elasticExternalNodes ) - fromPToA( P, timeStep, iNode, elasticExternalNodes ) )
               / M_dataPtr->jacobianPerturbationStress();
    }
}
Beispiel #3
0
inline Real
OneDFSIPhysics::elasticPressure( const Real& A, const UInt& iNode ) const
{
    return ( M_dataPtr->beta0( iNode ) * ( OneDFSI::pow05( A/M_dataPtr->area0( iNode ), M_dataPtr->beta1( iNode ) ) - 1 ) );
}
Beispiel #4
0
inline Real
OneDFSIPhysics::dPdAelastic( const Real& A, const UInt& iNode ) const
{
    return M_dataPtr->beta0( iNode ) * M_dataPtr->beta1( iNode ) * OneDFSI::pow05( A / M_dataPtr->area0( iNode ), M_dataPtr->beta1( iNode ) ) / A;
}