CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Virtual Mass Force Implementation in icoLagrangianFoam- foam_exd 3.0 (https://www.cfd-online.com/Forums/openfoam-programming-development/143543-virtual-mass-force-implementation-icolagrangianfoam-foam_exd-3-0-a.html)

ali_atrian October 27, 2014 11:47

Virtual Mass Force Implementation in icoLagrangianFoam- foam_exd 3.0
 
Hello Dear openFOAMers
I am a bigginer to openFoam and I want to activate virtualMass force in solver icoLagrangianFoam. so in the file constant/kinematicCloudProperties I enable the force and also add a line to determine Cvm value:
Code:

particleForces
{
    gravity        on;
    virtualMass    on;
    Cvm                    0.5;
    pressureGradient on;
       
}

but I receive the error:
Code:

--> FOAM FATAL ERROR:
Not implemented
    From function Foam::particleForces::calcCoupled(...) - virtual mass force
    in file particleForces/particleForces.C at line 153.
FOAM aborting
Aborted (core dumped)

the error is related to the following lines of src/lagrangian/intermediate/particleForces/particleForces.C:
Code:

Foam::vector Foam::particleForces::calcCoupled
(
    const label cellI,
    const scalar dt,
    const scalar rhoc,
    const scalar rho,
    const vector& Uc,
    const vector& U
) const
{
    vector Ftot = vector::zero;
    // Virtual mass force
    if (virtualMass_)
    {
        notImplemented
        (
            "Foam::particleForces::calcCoupled(...) - virtual mass force"
        );
//        Ftot += Cvm_*rhoc/rho*d(Uc - U)/dt;
    }

does anyone know what i ave to do?

I thankfuuullly apreciate any help

ali_atrian October 30, 2014 03:40

some one give me just a small hint pleaseee
in file particleForces.C, I uncommented the line:
Code:

Ftot += Cvm_*rhoc/rho*d(Uc - U)/dt
but I received the error:
Code:

particleForces/particleForces.C: In member function ‘Foam::vector Foam::particleForces::calcCoupled(Foam::label, Foam::scalar, Foam::scalar, Foam::scalar, const vector&, const vector&) const':
particleForces/particleForces.C:154:39: error: 'd' was not declared in this scope

what shoul i do? is there any toutorial shed lights on my problem
in openfoam 2.3 and 2.1 i didt find any library file including the virtual mass formula as included in foam-exd 3.0 and any other tutorials in foam extend 3.1 lead to the same errors when virtualMass" is "on"
I Greatfuuuly appreciate any help

ali_atrian November 6, 2014 02:26

no help on virtual mass implemention to foam-exd 3.0??!!

kalyan November 6, 2014 09:15

Hi,

even im struck with VIrtualMass. im using openFoam-2.3.x and defined VirtualMass in particle force as

virtualMass
{
Cvm 0.5;
}


but i get a error :

request for volVectorField U from objectRegistry region0 failed available objects of type volVectorField are 1(U.air).

if i remove virtualMass , then simualtion goes fine.. im not sure what this error is..


Regards,
Kalyan

ali_atrian November 8, 2014 11:59

I got where the problem arises from:
I used "src/finiteVolume/finiteVolume/fvc" library and change the virtual mass formulation as:
Code:

Ftot += Cvm_*rhoc/rho*fvc::ddt(Uc-U);
but i found that all the class templates defined in fvcDdt.C have their output formats in something like volVectorField! :
Code:

    template<class Type>
    tmp<GeometricField<Type, fvPatchField, volMesh> > ddt
    (
        const GeometricField<Type, fvPatchField, volMesh>&
    );

while we need 'vector' format for 'Ftot' (in particleForces.C) :

Code:

Foam::vector Foam::particleForces::calcCoupled
(
    const label cellI,
    const scalar dt,
    const scalar rhoc,
    const scalar rho,
    const vector& Uc,
    const vector& U
) const
{
    vector Ftot = vector::zero;

so, we need to define a class template something like:
Code:

  /* template<class Type>
    tmp< vector > ddt
    (
        const vector&
    );
*/

and thats the way we can implement virtual mass force (I think so)
I myself have not ever defined any template so I neglected annny eddition because it seems hard for me to go through this way and now im going to simulate my problem using DPMFoam in OF230 :o
however, I appreciate any comment whether on my findings or about template defenition for this problem
GoOoD LucK

ali_atrian November 8, 2014 12:05

Quote:

Originally Posted by kalyan (Post 517714)
Hi,

even im struck with VIrtualMass. im using openFoam-2.3.x and defined VirtualMass in particle force as

virtualMass
{
Cvm 0.5;
}


but i get a error :

request for volVectorField U from objectRegistry region0 failed available objects of type volVectorField are 1(U.air).

if i remove virtualMass , then simualtion goes fine.. im not sure what this error is..


Regards,
Kalyan


I will be engaged in virtual mass force in OF230 so sooon, (as I mentioned in prior post) so I will talk about that if there be any comment to share with u

oswald November 10, 2014 04:34

In order to calculate the virtual mass force, I added a new member to kinematicParcel called "Urelold". As the name suggests, it is the relative velocity between fluid and particle at the previous time step. To calculate d(Uc-Up)/dt, you can then use the old and the current relative velocities and the current time step and you don't need fvc::ddt(Uc-U) anymore.

ali_atrian November 10, 2014 06:22

implementation of acceleration in VM force
 
Hello Oswald
first of all i really thank you to give me some points
Maybe i can't get what you exactly mean, but :
1) here we nead (Uc-U) not an average between particle and fluid velocities!
2) in the formula, we have to insert the acceleration (not velocity) so why do you say
Quote:

you can then use the old and the current relative velocities
?

- can u explane a bit more on code implementation (the code that u say it can be used instead of
Code:

fvc::ddt(Uc-U)
and does it need any other changes in any other files in libs or solver ??
Best Regards

oswald November 10, 2014 07:00

I hope I got you right. The code fvc::ddt(Uc-U) can be seen as the change of the relative particle velocity (Uc-U) per time, i.e. d(Uc-U)/dt. Approximately this is the same as [(Uc-U)_current - (Uc-U)_old]/deltaT. (Uc-U)_current ist the current difference between particle and velocity fluid and can be calculated with the current values. I simply store this value as the value for (Uc-U)_old for the next time step. The change over time is then simply calculated by dividing the difference of the relative velocities by the current deltaT.

A disadvantage here is that you are not free to choose a different interpolation scheme.

The Urelold-value is stored in the kinematicParcel-class like U, d, rho and so on.

ali_atrian November 11, 2014 03:16

Hello Oswald
I really appreciate all your guidance
Its now clear for me :o
Best Regards


All times are GMT -4. The time now is 22:23.