void virtualMassForce::setForce() const
{
    reAllocArrays();

    scalar dt = U_.mesh().time().deltaT().value();

    for(int index = 0;index <  particleCloud_.numberOfParticles(); index++)
    {
        //if(mask[index][0])
        //{
            vector virtualMassForce(0,0,0);
            label cellI = particleCloud_.cellIDs()[index][0];

            if (cellI > -1) // particle Found
            {
                vector Us = particleCloud_.velocity(index);
                vector Ur = U_[cellI]-Us;
                vector UrelOld;
                for(int j=0;j<3;j++)
                {
                    UrelOld[j] = UrelOld_[index][j];
                    UrelOld_[index][j] = Ur[j];
                }

                vector ddtUrel = (Ur-UrelOld)/dt;
                scalar ds = 2*particleCloud_.radius(index);
                scalar Vs = ds*ds*ds*M_PI/6;
                scalar rho = rho_[cellI];

                virtualMassForce = 0.5 * rho * Vs * ddtUrel;

            }
            // set force on particle
            if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += virtualMassForce[j];
            else  for(int j=0;j<3;j++) impForces()[index][j] += virtualMassForce[j];
            for(int j=0;j<3;j++) DEMForces()[index][j] += virtualMassForce[j];
        //}
    }

}
void virtualMassForce::setForce() const
{
    reAllocArrays();

    scalar dt = U_.mesh().time().deltaT().value();

    vector position(0,0,0);
    vector Ufluid(0,0,0);
    vector Ur(0,0,0);
    vector DDtU(0,0,0);

    //Compute extra vfields in case it is needed
    volVectorField DDtU_(0.0*U_/U_.mesh().time().deltaT());
    if(splitUrelCalculation_)
        DDtU_ = fvc::ddt(U_) + fvc::div(phi_, U_); //Total Derivative of fluid velocity

    interpolationCellPoint<vector> UInterpolator_(   U_);
    interpolationCellPoint<vector> DDtUInterpolator_(DDtU_);

#include "setupProbeModel.H"

    bool haveUrelOld_(false);

    for(int index = 0; index <  particleCloud_.numberOfParticles(); index++)
    {
        vector virtualMassForce(0,0,0);
        label cellI = particleCloud_.cellIDs()[index][0];

        if (cellI > -1) // particle Found
        {

            if(forceSubM(0).interpolation())
            {
                position     = particleCloud_.position(index);
                Ufluid       = UInterpolator_.interpolate(position,cellI);
            }
            else
            {
                Ufluid = U_[cellI];
            }


            if(splitUrelCalculation_)  //if split, just use total derivative of fluid velocity
                if(forceSubM(0).interpolation())
                {
                    DDtU = DDtUInterpolator_.interpolate(position,cellI);
                }
                else
                {
                    DDtU = DDtU_[cellI];
                }
            else
            {
                vector Us = particleCloud_.velocity(index);
                Ur = Ufluid - Us;
            }


            //Check of particle was on this CPU the last step
            if(UrelOld_[index][0]==NOTONCPU) //use 1. element to indicate that particle was on this CPU the last time step
                haveUrelOld_ = false;
            else
                haveUrelOld_ = true;

            vector UrelOld(0.,0.,0.);
            vector ddtUrel(0.,0.,0.);
            for(int j=0; j<3; j++)
            {
                UrelOld[j]         = UrelOld_[index][j];
                UrelOld_[index][j] = Ur[j];
            }
            if(haveUrelOld_ ) //only compute force if we have old (relative) velocity
                ddtUrel = (Ur-UrelOld)/dt;

            if(splitUrelCalculation_) //we can always compute the total derivative in case we split
                ddtUrel = DDtU;

            scalar ds = 2*particleCloud_.radius(index);
            scalar Vs = ds*ds*ds*M_PI/6;
            scalar rho = forceSubM(0).rhoField()[cellI];

            virtualMassForce = Cadd_ * rho * Vs * ddtUrel;

            if( forceSubM(0).verbose() ) //&& index>100 && index < 105)
            {
                Pout << "index / cellI = " << index << tab << cellI << endl;
                Pout << "position = " << particleCloud_.position(index) << endl;
            }

            //Set value fields and write the probe
            if(probeIt_)
            {
#include "setupProbeModelfields.H"
                vValues.append(virtualMassForce);           //first entry must the be the force
                vValues.append(Ur);
                vValues.append(UrelOld);
                vValues.append(ddtUrel);
                sValues.append(Vs);
                sValues.append(rho);
                particleCloud_.probeM().writeProbe(index, sValues, vValues);
            }
        }
        else    //particle not on this CPU
            UrelOld_[index][0]=NOTONCPU;

        // write particle based data to global array
        forceSubM(0).partToArray(index,virtualMassForce,vector::zero);
    }
}