CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   forces and moment in slosing tank (http://www.cfd-online.com/Forums/openfoam-post-processing/72642-forces-moment-slosing-tank.html)

anmartin February 12, 2010 12:20

forces and moment in slosing tank
 
Hi to everybody
Iím trying to simulate sloshing inside a tank. The tank is excited laterally (Y) with a SKA (6DoF.dat) function that represent a sinusoidal excitation.
I would like to obtain the lateral and vertical forces and moment around X axis produced by the water inside to be compared with experimental data.
I will be very gratefully If someone can help me
Best regards,

anmartin February 18, 2010 15:35

forces and moment in slosing tank
 

I guess my posts must be really stupid, since they seem to never get answered.
Well, I am fully aware that OpenFOAM is open-source and that all replies and support is voluntarily and that of course nobody has any right to his or her problems being answered.
Still, I was hoping to get some support, especially since I am actually trying to validate OpenFOAM against some experimental data. I have done many test with differents tanks sections excitate with a sinusoidal displacement
in orden to optain a mechanical analogy that can be incorporate in an truck model, and now i will like to finish my phd thesis, with a foam simulation to completed the work done.

I have triyed to use interFoamPressure, but i have several error:
a)readEnvironmentalProperties.H is not present (It is possible to get from OF1.5)
b) -llduSolvers is not present (i have comment it in the file) and the compiled with wmake
c) when run interFoamPressure appears:
Not all fields are present.
pd gamma missing.

Anyway, I have read in the forum some cases where it is possible to obtain the forces by adding some functions at the end of the controlDict
(http://www.cfd-online.com/Forums/ope...es-v1-6-a.html)
that i will try

I will be very gratefully If someone can help me
Best regards,

musahossein January 29, 2012 20:10

reading pressure from files
 
Quote:

Originally Posted by anmartin (Post 246503)
I guess my posts must be really stupid, since they seem to never get answered.
Well, I am fully aware that OpenFOAM is open-source and that all replies and support is voluntarily and that of course nobody has any right to his or her problems being answered.
Still, I was hoping to get some support, especially since I am actually trying to validate OpenFOAM against some experimental data. I have done many test with differents tanks sections excitate with a sinusoidal displacement in orden to optain a mechanical analogy that can be incorporate in an truck model, and now i will like to finish my phd thesis, with a foam simulation to completed the work done.

I have triyed to use interFoamPressure, but i have several error:
a)readEnvironmentalProperties.H is not present (It is possible to get from OF1.5)
b) -llduSolvers is not present (i have comment it in the file) and the compiled with wmake
c) when run interFoamPressure appears:
Not all fields are present.
pd gamma missing.

Anyway, I have read in the forum some cases where it is possible to obtain the forces by adding some functions at the end of the controlDict
(http://www.cfd-online.com/Forums/ope...es-v1-6-a.html)
that i will try

I will be very gratefully If someone can help me
Best regards,

Did you ever solve this problem? I am running sloshingTank2d. I have modified the controlDict file as required so that at each time increment OpenFoam outputs phase and pressure. My confusion is, since for each displacement value in the 6DoF.dat file, OpenFoam generates a bunch of pressure and phase, do I take the last file that is output for a particular displacement as the correct one, or do we need to check for some kind of convergence? Any suggestions would be greatly appreciated, Thanks.
Musa

anmartin January 30, 2012 19:58

Quote:

Originally Posted by musahossein (Post 341802)
Did you ever solve this problem? I am running sloshingTank2d. I have modified the controlDict file as required so that at each time increment OpenFoam outputs phase and pressure. My confusion is, since for each displacement value in the 6DoF.dat file, OpenFoam generates a bunch of pressure and phase, do I take the last file that is output for a particular displacement as the correct one, or do we need to check for some kind of convergence? Any suggestions would be greatly appreciated, Thanks.
Musa

Hello,

I put this lines in my controldict and works perfectly.
functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (walls);
rhoName rhoInf;
rhoInf 998.2; //Reference density for fluid
CofR (0 -0.071 0.25); //Origin for moment calculations
outputControl outputTime;
}
}

You only need to set on turbulence and printCoeffs in constant/RASProperties
RASModel laminar; //or any other type of turbulence
turbulence on;
printCoeffs on;

best regards

musahossein February 3, 2012 22:22

how can you tell if the force is from your fluid or atmosphere. I have done something similar in controldict, where I have openfoam ouput alpha (phase value) and the pressure. Now I have to write a code that will only give me the pressures from cells that have a phase less than zero, since I am interested in obtaining fluid pressures only on the left and right walls of a tank. My code in control dict is as follows:
wallPressure
{
type surfaces;
functionObjectLibs ("libsampling.so");
outputControl outputTime;
outputInterval 5;
surfaceFormat raw;
interpolationScheme cell;

fields ( alpha1
p
);
surfaces
(
leftwalls
{
type patch;
patches (leftWall);
interpolate true;
triangulate false;
}
rightwalls
{
type patch;
patches (rightWall);
interpolate true;
triangulate false;
}
);
}

anmartin February 4, 2012 08:43

Hello,
In my case forces are for both air (alpha 0-0.5) and water (alpha>0.5). Try to multiply cell value by alpha.
With swak4foam wold be possible to do something similar.
In my controldict i fix write interval to 0.025 then with outputTime i obtain a force value every that time to compare with experimental data. You have one more line fixed outputinterval to 5.

musahossein February 4, 2012 11:22

Quote:

Originally Posted by anmartin (Post 342013)
Hello,

I put this lines in my controldict and works perfectly.
functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (walls);
rhoName rhoInf;
rhoInf 998.2; //Reference density for fluid
CofR (0 -0.071 0.25); //Origin for moment calculations
outputControl outputTime;
}
}

You only need to set on turbulence and printCoeffs in constant/RASProperties
RASModel laminar; //or any other type of turbulence
turbulence on;
printCoeffs on;

best regards

I copied the above into my controlDict file for sloshingTank2D. When I ran it, I got the following complaint in the log.interDyMFoam file as follows:

--> FOAM FATAL IO ERROR:
keyword nu is undefined in dictionary "/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/constant/transportProperties"

file: /home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/constant/transportProperties from line 23 to line 35.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting

But I have defined nu in the transport properties file as follows:
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Phase1 is water; phase2 is air. Values for Standard Temperature and pressure (0 deg C, 14.69 psi
// or 101.325 kPa, ) in accordance with NIST
//

phase1
{
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1e-06;
rho rho [ 1 -3 0 0 0 0 0 ] 998.2;
}

phase2
{
transportModel Newtonian;
nu nu [ 0 2 -1 0 0 0 0 ] 1.50e-05;
rho rho [ 1 -3 0 0 0 0 0 ] 1.2;
}

sigma sigma [ 1 0 -2 0 0 0 0 ] 0;


// ************************************************** *********************** //

I have set turbulence as laminar as I am not expecting any wave breaking or huge amount of sloshing. Could that be the problem?

Any advice would be greatly appreciated.

anmartin February 4, 2012 14:20

Hello,


libforces need to set any turbulence model, but in OF tutorial appears that laminar is a dummy turbulence model, then you only need to set on turbulence properliey:

In tubulenceProperites file
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;

In RASProperites file
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
RASModel laminar;
turbulence off;
printCoeffs on;
As I mentioned you in the previously, set on printCoeffs in constant/RASProperties and
RASModel laminar; //or any other type of turbulence
turbulence on;
printCoeffs on;

best regards

mina.basta August 5, 2013 10:22

Dear all,

I add this section in my controlDict:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (stlSurface_ascii); // change to your patch name
pName p;
Uname U;
rhoName rho;
rhoInf 1.225; //Reference density for fluid
CofR (0 0 0); //Origin for moment calculations
outputControl timeStep;
outputInterval 1;
}
);

but I still don't know how to visualize the force or moment in paraview? Could you help me ?

Best regards,

Mina

musahossein August 5, 2013 10:29

As far as I know, paraview can only work with data that has been written to disk and forcesCoeffs-functionObject doesn't write it to disk so you many not be able to visualize the forces. At least I have not seen that functionality in paraView. If you find a solution, let me know.

mina.basta August 5, 2013 10:33

Dear musaddeque hossein,

So, do you have another solution to calculate the average force or moment on a surface ? I know well that the pressure is distrubed on a surface but i want an average value for a force & where can be this average force located? Is it possible using OF and paraView?

Best regards,
Mina

musahossein August 5, 2013 10:41

One thing you can do is to write a script or code (I use fortran) that can read the pressure files that OF generates and then compile the forces from there. I have done that, but only for pressures in sloshingTand2D problem to capture the forces against the walls of the tank.

mina.basta August 5, 2013 10:44

Thanks a lot but I read something in http://www.cfd-online.com/Forums/ope...-parafoam.html
What do you think ?

musahossein August 5, 2013 10:50

You can try the steps that were outlined. But if you know some programming, then instead of doing each step manually as the poster has stated, you can run your code and generate the data you seek.

musahossein August 27, 2013 17:43

Quote:

Originally Posted by mina.basta (Post 443911)
Dear all,

I add this section in my controlDict:

functions
(
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (stlSurface_ascii); // change to your patch name
pName p;
Uname U;
rhoName rho;
rhoInf 1.225; //Reference density for fluid
CofR (0 0 0); //Origin for moment calculations
outputControl timeStep;
outputInterval 1;
}
);

but I still don't know how to visualize the force or moment in paraview? Could you help me ?

Best regards,

Mina

You have an error in your code. rhoName should be set to rhoInf and not rho.

musahossein August 29, 2013 08:31

output from libforces.so
 
Dear all:

I have the following code in controlDict for sloshingtank2D in Interdymfoam:

forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
outputControl outputTime;
patches (leftWall rightWall);
pName p;
UName U;
rhoName rhoInf;
rhoInf 998.2; //Reference density for fluid
nuInf 1e-06;
CofR (0 0 0); //Origin for moment calculations

outputControl timeStep;
outputInterval 1;
}

The output is shown below. Looking at the output, there seems to be only 1 value for force for each time. But in controldict I specified the leftwall and rightwall -- so there should be two force outputs? Can anyone clarify this for me? Thankyou.

# Time forces(pressure, viscous, porous) moment(pressure, viscous, porous)
0.00116279 ((0 6.80759 0),(1.97145e-16 0.000111794 4.4025e-08),(0 0 0)) ((1.61118 0 0),(2.07113e-05 9.32239e-17 -4.15186e-17),(0 0 0))
0.00251938 ((0 12.3413 0),(3.27553e-17 0.00033949 -5.79995e-07),(0 0 0)) ((2.92001 0 0),(6.70143e-05 2.88232e-17 5.96196e-17),(0 0 0))
0.00410207 ((0 11.8477 0),(-1.40002e-16 0.000578923 -8.757e-07),(0 0 0)) ((2.80189 0 0),(0.000123266 -3.9136e-17 -6.36765e-17),(0 0 0))
0.00593798 ((0 11.2883 0),(8.41123e-17 0.000831158 -7.59491e-07),(0 0 0)) ((2.66847 0 0),(0.00018915 3.28012e-17 1.44194e-16),(0 0 0))
0.00814109 ((0 10.42 0),(-2.99483e-16 0.00110036 -1.08114e-06),(0 0 0)) ((2.46207 0 0),(0.000264889 -1.0025e-16 -6.09408e-17),(0 0 0))

musahossein August 30, 2013 22:47

For those who are interested, the force in the first parenthesis is the resultant force. So the resultant does not have to be computed from the leftwall and rightwall force.


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