bool Foam::dataExchangeModel::couple() const
{
    bool coupleNow = false;
    if (doCoupleNow())
    {
        couplingStep_++;
        coupleNow = true;
    }
    return coupleNow;
}
Example #2
0
bool Foam::MytwoWayMPI::couple() const
{
    bool coupleNow = false;
                
    if (doCoupleNow())      //here is time condition
    {
        couplingStep_++;
        coupleNow = true;
        
        // start DEM bodies to move
        if (liggghts == 1)
        {
            Info<<"\n\n-------------------" << endl;
            Info<<"*** Starting up DEM LOOP"<<endl;
            particleCloud_.clockM().start(3,"LIGGGHTS");                                  
            //+++
            MPI_Barrier(MPI_COMM_WORLD);   
            lmp->MoveBodies();
            Info<<"*** Bodies succesfully moved!"<<endl;
            Info<<"DEM elapsed time is "<<lmp->elapsed_time<<" sec."<<endl;
                                    
            particleCloud_.clockM().stop("LIGGGHTS");
            Info<<"-------------------\n" << endl;
            
            MPI_Barrier(MPI_COMM_WORLD);        
        }

        // give nr of particles to cloud
        int newNpart = lmp->getNumberOfParticles();               
        //double newNpart = this->getNumberOfParticles();
        

        this->setNumberOfParticles(newNpart);
        //particleCloud_.setNumberOfParticles(newNpart);
        
        
        // re-allocate arrays of cloud
        particleCloud_.clockM().start(4,"MY LIGGGHTS_reallocArrays");
        particleCloud_.reAllocArrays();
        particleCloud_.clockM().stop("MY LIGGGHTS_reallocArrays");
    }

    return coupleNow;
}