CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   dieselFoam: Summation of total droplet momentum in a Cell (http://www.cfd-online.com/Forums/openfoam/78306-dieselfoam-summation-total-droplet-momentum-cell.html)

N. A. July 17, 2010 22:11

dieselFoam: Summation of total droplet momentum in a Cell
 
Hello,

Can someone share their experience on how can total momentum of droplets in a cell be calculated and stored in a a variable. I am new to C++ language and I really need someone's experience in creating a new variables in dieselFoam.

Thanks,
Nir

su_junwei July 18, 2010 00:15

Quote:

Originally Posted by N. A. (Post 267852)
Hello,

Can someone share their experience on how can total momentum of droplets in a cell be calculated and stored in a a variable. I am new to C++ language and I really need someone's experience in creating a new variables in dieselFoam.

Thanks,
Nir

You can do it like this

volVectorField moment
(
IOobject
(
"moment",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedVector("moment", dimensionSet(1, -2, -2, 0, 0),vector::zero)
);

spray::iterator mol(dieselSpray.begin());

for (mol = dieselSpray.begin(); mol != dieselSpray.end(); ++mol)
{
label cellI=mol().cell();
moment[cellI]+=mol().m()*mol().U();
}

Junwei

N. A. July 18, 2010 00:52

Hi Junwei,

Thanks. Is this addition to be made in dieselFoam.C of the solver dieselFoam or should be added in one of the files in the ../src/dieselSpray.. directory.

Thanks,
Nir

su_junwei July 18, 2010 05:21

Quote:

Originally Posted by N. A. (Post 267861)
Hi Junwei,

Thanks. Is this addition to be made in dieselFoam.C of the solver dieselFoam or should be added in one of the files in the ../src/dieselSpray.. directory.

Thanks,
Nir

I think you can do it in dieselFoam.

Junwei

N. A. August 26, 2010 13:58

Hi Junwei,

I wish to add a variable in the lagrangian equations and solve for it. Just as we solve for x,d, m, T, etc for particle properties, I am trying to solve for distorted surface area for each particle and wish to calculate each time-step.

Do you know how another variable be added into lagrangian variables and solve for it.

Any ifnormation will be very helpful.

Thanks,
Nir

su_junwei August 26, 2010 22:37

Hi Nir
You can add a variable into parcel class in /src/lagrangian/dieselSpray/parcel/
1) add variable
2) add read and write access function to this variable
3) add IO operation in parcelIO.C

You can alter the variable like the following code
cloudObject is the particle cloud. yourVariable is your variable name you defined.
for
(
spray::iterator particle = cloudObject.begin();
particle != cloudObject.end();
++particle
)
{
particle().yourVariable()=.... // do as you like.
}

Regards, Junwei

Palminchi September 14, 2010 10:37

What a nice topic! :)

Palminchi September 20, 2010 08:43

Dear su_junwei,

As far as I understand, if you are multiplying m()*U(), the dimmension of the vector when you defined it before should be (1 1 -1), shouldn't it?
Please, confirm if this is something I don't understand or something I can't see when you make the iterator programming.

And other question is, with the iterator, could I obtain the momentum flux of the droplets(which is m*U^2) ? And do you know how I could obtain the gas momentum?

Best regards and thank you very much,
Palma.


All times are GMT -4. The time now is 01:29.