예제 #1
0
void
MultiscaleCoupling::showMe()
{
    if ( myModelsNumber() > 0 )
    {
        std::cout << "Coupling id         = " << M_ID << std::endl
                  << "Coupling name       = " << M_couplingName << std::endl
                  << "Coupling type       = " << enum2String ( M_type, multiscaleCouplingsMap ) << std::endl << std::endl;

        std::cout << "Interpolation order = " << M_timeInterpolationOrder << std::endl
                  << "Flow interfaces     = " << M_flowRateInterfaces << std::endl << std::endl;

        std::cout << "Models ID(s)        = ";
        for ( UInt i ( 0 ); i < modelsNumber(); ++i )
            if ( myModel ( i ) )
            {
                std::cout << M_models[i]->ID() << " ";
            }
        std::cout << std::endl;
        std::cout << "Models type(s)      = ";
        for ( UInt i ( 0 ); i < modelsNumber(); ++i )
            if ( myModel ( i ) )
            {
                std::cout << enum2String ( M_models[i]->type(), multiscaleModelsMap ) << " ";
            }
        std::cout << std::endl;
        std::cout << "Flags list          = ";
        for ( UInt i ( 0 ); i < modelsNumber(); ++i )
            if ( myModel ( i ) )
            {
                std::cout << M_boundaryIDs[i] << " ";
            }
        std::cout << std::endl << std::endl;
    }
}
예제 #2
0
// ===================================================
// Inline Methods
// ===================================================
inline UInt
MultiscaleCoupling::myModelsNumber() const
{
    UInt myModelsNumber ( 0 );

    for ( UInt i ( 0 ); i < modelsNumber(); ++i )
        if ( myModel ( i ) )
        {
            ++myModelsNumber;
        }

    return myModelsNumber;
}
예제 #3
0
// ===================================================
// Get Methods
// ===================================================
UInt
MultiscaleCoupling::modelGlobalToLocalID ( const UInt& ID ) const
{
    if ( myModelsNumber() > 0 )
        for ( UInt localID ( 0 ); localID < modelsNumber(); ++localID )
            if ( myModel ( localID ) )
                if ( M_models[localID]->ID() == ID )
                {
                    return localID;
                }

    std::cout << " !!! WARNING: modelGlobalToLocalID was not able to find the model ID !!! " << std::endl;
    return 0;
}
예제 #4
0
void
MultiscaleCoupling::saveSolution()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8200 ) << "MultiscaleCoupling::saveSolution() \n";
#endif

    if ( myModelsNumber() > 0 )
    {
        for ( UInt i ( 0 ); i < modelsNumber(); ++i )
            if ( myModel ( i ) )
            {
                Real flowRate   ( multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->boundaryFlowRate ( M_boundaryIDs[i] ) );
                Real stress     ( multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->boundaryMeanNormalStress ( M_boundaryIDs[i] ) );
                Real totalStress ( multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->boundaryMeanTotalNormalStress ( M_boundaryIDs[i] ) );
                Real area       ( multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->boundaryArea ( M_boundaryIDs[i] ) );

                if ( isModelLeaderProcess ( i ) )
                {
                    std::ofstream output;
                    output << std::scientific << std::setprecision ( 15 );

                    std::string filename = multiscaleProblemFolder + multiscaleProblemPrefix + "_Coupling_" + number2string ( M_ID )
                                           + "_Flag_" + number2string ( i )
                                           + "_" + number2string ( multiscaleProblemStep ) + ".mfile";

                    if ( M_globalData->dataTime()->timeStepNumber() == 0 || ( multiscaleProblemStep > 0 &&
                            M_globalData->dataTime()->round ( M_globalData->dataTime()->time() - ( multiscaleSaveEachNTimeSteps - 1 ) * M_globalData->dataTime()->timeStep() ) == M_globalData->dataTime()->round ( M_globalData->dataTime()->initialTime() ) ) )
                    {
                        output.open ( filename.c_str(), std::ios::trunc );
                        output << "% Coupling Type: " << enum2String ( M_type, multiscaleCouplingsMap ) << std::endl;
                        output << "% Coupling Name: " << M_couplingName << std::endl;
                        output << "% Model:         " << number2string ( M_models[i]->ID() ) << std::endl;
                        output << "% Boundary Flag: " << number2string ( M_models[i]->boundaryFlag ( M_boundaryIDs[i] ) ) << std::endl << std::endl;
                        output << "% TIME                     FLOW RATE                STRESS                   TOTAL STRESS             AREA" << std::endl;
                    }
                    else
                    {
                        output.open ( filename.c_str(), std::ios::app );
                    }
                    output << "  " << M_globalData->dataTime()->time() << "    " << flowRate << "    " << stress << "    " << totalStress << "    " << area << std::endl;
                    output.close();
                }
            }
    }
}
예제 #5
0
// ===================================================
// Multiscale PhysicalCoupling Virtual Methods
// ===================================================
void
MultiscaleCoupling::setupData ( const std::string& fileName )
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8200 ) << "MultiscaleCoupling::setupData( fileName ) \n";
#endif

    GetPot dataFile ( fileName );

    // Read Multiscale parameters
    M_couplingName = dataFile ( "Multiscale/couplingName", "couplingName" );

    M_timeInterpolationOrder = dataFile ( "Multiscale/timeInterpolationOrder", 0 );
    M_flowRateInterfaces     = dataFile ( "Multiscale/flowRateInterfaces", 0 );

    // If flowRateInterfaces is negative all the interfaces get a flow rate
    if ( M_flowRateInterfaces < 0 )
    {
        M_flowRateInterfaces = modelsNumber();
    }

    // Set the size of the local coupling variables
    if ( myModelsNumber() > 0 )
    {
        M_localCouplingVariables.reserve ( M_timeInterpolationOrder + 1 );
    }

    // Set the number of coupling variables (default is 0)
    if ( myModelsNumber() > 0 )
    {
        setupCouplingVariablesNumber();
    }

    // Create local vectors
    createLocalVectors();
}