CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   how to monitor free surface elevation vs time in OF? (https://www.cfd-online.com/Forums/openfoam-post-processing/64462-how-monitor-free-surface-elevation-vs-time.html)

ozgur May 12, 2009 09:22

how to monitor free surface elevation vs time in OF?
 
Hello,

I am pretty new to OF, but I am amazed to discover new and hidden features every day. Thanks to all the developers and contributors :cool:.

My problem is:

I want to monitor and plot the free surface elevation vs time
(in iterFoam, interDymfoam etc) at a probed location. :confused:

For example, in the sloshingTank2D tutorial, what should I do if I want to monitor the elevation (i.e. z coordinate of the free surface) over point x=0, and y=0?:confused:

I am confused whether should I use, "sampling" or "probing". :confused:

I have made several attempts to do this but couldn't manage it. My best attempt was to sample gamma values over a line from (0 0 -10) to (0 0 20). My sampleDict file is like this:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
interpolationScheme cell;
setFormat gnuplot;
sets
(
centerPatch
{
type uniform;
axis xyz;
start (0 0 -10);
end (0 0 20);
nPoints 100;
}
);

surfaces
();

fields
(
gamma
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Then using my own interpolation algorithm I can determine the z-coordinate where gamma=0.5.

But I think this not an elegant way, and I am sure that this can be done automatically by OF utilities, which I haven't discovered yet.:rolleyes:

For example, in the tutorials the "probes" utility produces very nice outputs (in a single file) for p vales against time. :rolleyes: I want to produce something like this for the free surface height??

Any ideas?

Thanks,

Ozgur

sega May 12, 2009 12:30

I am using OpenFOAM for allmost a year and mainly with interFoam.
I think, currently there is no other way than you doing this on your own.

Using a sample line and finding the value of gamma = 0.5 is a good way of calculating the elevation. But I guess this will be hard work, because sample is writing individual files for each time step, so you have to read a file for every individual time step.

BTW, which software do you want to use for post-processing?

ozgur May 12, 2009 18:39

Thanks a lot for the reply Sega,

In the literature about sloshing, wave elevations, or free surface elevations is one of the basic recordings used in reporting the results. And I want to obtain a result similar to:

http://atlas.cc.itu.edu.tr/%7Ekirlangico/sloshing.jpg


Yes, sample writes individual files for each time step, so it is hard to go from this way. I think use of probe instead of sample is more suitable, since it produces only one file with the content written line by line for every time step.

Therefore, I need to be able to define a probe, which:
  1. can be a line (not individual points like in tutorials) For example: start (0 0 -10); end (0 0 20);
  2. has got the capacity to make the interpolation and filter out the required results by itself.
Searching through the forum, I have come up with something sampleSurface, which could at least produce interpolatedIsoSurface (http://www.cfd-online.com/Forums/ope...e-problem.html).

The usage is:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
surfaceFormat raw;
interpolationScheme cellPointFace;
surfaces
{
interpolatedIsoSurface
{
name freeSurface;
field gamma;
value 0.5;
}
);
fields
(
gamma
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Unfortunately, as far as I figured out, this utility is not available in OF 1.5+.

Another thing that I tired was in paraFoam: First, I did a slice cut of X_Normal plane at (0,0,0), then a contour filter for ccy=0 and another contour filter for gamma=0.5. Finally, a calculator filter for Z_Coordinate. When I switch to spreadsheet view I can see that, I end up with a single value of wave height for a time instant. However, I failed to plot it over time.

Anyway, I would prefer if I could make OF do all the interpolations and filterings, and use gnuplot to view the results.

Has anybody worked on a similar thing. I would be happy if someone can show me a way.

Thanks,

Ozgur

ngj May 13, 2009 05:37

Hi Ozgur

What you could also do (in stead of using gamma=0.5), is to integrate your sampled data over the vertical using e.g. the trapezoidal rule. Substract the lower most vertical coordinate and you will end up with the surface elevation relative to z=0. I have considered if it would not be possible to make use of the sample class to generate a functionObject which do exactly that, however as always, time is indeed a limited resource.

Have fun,

Niels

ozgur May 13, 2009 23:02

Hi Niels,

Thanks for the hints.. In fact I myself was suspicious about to locate gamma=0.5 (at least by a linear interpolation).

Anyway after some dirty coding, I managed to get following results for the sloshingTank2D3DoF tutorial.

http://atlas.cc.itu.edu.tr/~kirlangico/grafik.jpeg

The correct location of the free surface is important for me, because I want make comparisons with experimental results.

Ozgur



Just to complete, a sampled gamma data looks like this for an individual time step:


x y z gamma
0 0 -10 1
0 0 -9.69697 1
0 0 -9.39394 1
0 0 -9.09091 1
0 0 -8.78788 1
0 0 -8.48485 1
0 0 -8.18182 1
0 0 -7.87879 1
0 0 -7.57576 1
0 0 -7.27273 1
0 0 -6.9697 1
0 0 -6.66667 1
0 0 -6.36364 1
0 0 -6.06061 1
0 0 -5.75758 1
0 0 -5.45455 1
0 0 -5.15152 1
0 0 -4.84848 1
0 0 -4.54545 1
0 0 -4.24242 1
0 0 -3.93939 0.999999
0 0 -3.63636 0.999999
0 0 -3.33333 0.999999
0 0 -3.0303 0.998297
0 0 -2.72727 0.998297
0 0 -2.42424 0.998297
0 0 -2.12121 0.875845
0 0 -1.81818 0.875845
0 0 -1.51515 0.875845
0 0 -1.21212 0.251325
0 0 -0.909091 0.251325
0 0 -0.606061 0.251325
0 0 -0.30303 0.00170957
0 0 -4.10783e-15 0.00201351
0 0 0.30303 0.00201351
0 0 0.606061 0.00201351
0 0 0.909091 2.12627e-05
0 0 1.21212 2.12627e-05
0 0 1.51515 2.12627e-05
0 0 1.81818 5.35303e-08
0 0 2.12121 5.35303e-08
0 0 2.42424 5.35303e-08
0 0 2.72727 1.30219e-11
0 0 3.0303 1.30219e-11
0 0 3.33333 1.30219e-11
0 0 3.63636 1.03978e-16
0 0 3.93939 1.03978e-16
0 0 4.24242 1.03978e-16
0 0 4.54545 4.42707e-24
0 0 4.84848 4.42707e-24
0 0 5.15152 4.42707e-24
0 0 5.45455 3.07062e-36
0 0 5.75758 3.07062e-36
0 0 6.06061 3.07062e-36
0 0 6.36364 1.69305e-52
0 0 6.66667 1.69305e-52
0 0 6.9697 1.69305e-52
0 0 7.27273 -1.2664e-58
0 0 7.57576 -1.2664e-58
0 0 7.87879 -1.2664e-58
0 0 8.18182 -1.11574e-57
0 0 8.48485 -1.11574e-57
0 0 8.78788 -1.11574e-57
0 0 9.09091 -2.91388e-57
0 0 9.39394 -2.91388e-57
0 0 9.69697 -2.91388e-57
0 0 10 -2.91388e-57
0 0 10.303 -2.28496e-57
0 0 10.6061 -2.28496e-57
0 0 10.9091 -1.05445e-57
0 0 11.2121 -1.05445e-57
0 0 11.5152 -1.05445e-57
0 0 11.8182 -3.28503e-58
0 0 12.1212 -3.28503e-58
0 0 12.4242 -3.28503e-58
0 0 12.7273 -7.07185e-59
0 0 13.0303 -7.07185e-59
0 0 13.3333 -7.07185e-59
0 0 13.6364 -1.11157e-59
0 0 13.9394 -1.11157e-59
0 0 14.2424 -1.32059e-60
0 0 14.5455 -1.32059e-60
0 0 14.8485 -1.32059e-60
0 0 15.1515 -1.17364e-61
0 0 15.4545 -1.17364e-61
0 0 15.7576 -1.17364e-61
0 0 16.0606 -7.47976e-63
0 0 16.3636 -7.47976e-63
0 0 16.6667 -7.47976e-63
0 0 16.9697 -3.43373e-64
0 0 17.2727 -3.43373e-64
0 0 17.5758 -8.76047e-66
0 0 17.8788 -1.34639e-65
0 0 18.1818 -1.34639e-65
0 0 18.4848 -1.48939e-67
0 0 18.7879 -1.48939e-67
0 0 19.0909 -1.48939e-67
0 0 19.3939 -1.95727e-70
0 0 19.697 -1.95727e-70
0 0 20 -1.95727e-70

gautami July 1, 2009 13:49

Hello Ozgur,

I want to plot the free surface elevation vs time (in interFoam & interDymfoam) at a probe location,exactly the way you have got your results for sloshingTank2D3DoF tutorial.

I am using OpenFoam-1.5 and I could not use sampleSurface.
Though you have mentioned how to get the plot,I am not able to understand it clearly how to obtain the plot for free surface elevation vs time.

If you don't mind can you please guide me with this.

Regards,
Gautami.

gopala July 2, 2009 03:59

Hello,

In few of my projects I also need to keep in track of the elevation of the free surface and the best way I found was to use the sampling utility over a line for the gamma field! Then I use the gradient of gamma to find the free surface elevation. Ofcourse, sampling utility will provide a data file for every timestep. So I use a simple matlab script (octave as well) to read through the file in every time step directory.

Though this is probably not the best way to handle the problem, it seemed to work fine for me.

If someone can suggest an efficient way to do this will be greatly appreciated.

Vinay

ozgur July 2, 2009 12:00

Dear friends,

It is nice to hear from people working on similar subjects.

As I have posted earlier, my final conclusion was use of "sample" utility. I use the "sampleDict" file with the command "sample"...

An example sampleDict file:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
interpolationScheme cell;
setFormat gnuplot;
sets
(
centerPatch
{
type uniform;
axis xyz;
start (0 0 -10);
end (0 0 20);
nPoints 100;
}
);

surfaces
();

fields
(
gamma
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

This will create a folder named "sets/" and subfolders named as your timesteps. Within each timestep folder you will have a file with the content similar to:

x y z gamma
0 0 -10 1
0 0 -9.69697 1
0 0 -9.39394 1
0 0 -9.09091 1
0 0 -8.78788 1
...

After this point, I haven't heard any "standard way" to extract the location of the free surface. I also don't know (for now) while imposing the free surface boundary conditions how OF algorithm does handle this. :confused: :confused:

What I did was, I wrote a C program named genHOF.c. I placed and run it's executable in the folder named "sets/". The location is important otherwise it won't work.

But also as I said this is a dirty code written in a rush.. There may be errors or I am sure that what it does can be done in a much better way by bash scripts, but I have no time to work on that. I listened to ngj's advise and used integration methods.

Here is the code:



#include <stdio.h>
#include <string.h>


int main()
{
FILE *myfile,*mywfile,*myfolders;
double x[1500],y[1500],z[1500],gamma[1500],h,z_base;
char c[500],f[300],filename[300];
int i, N,count;
float j, swl;

system("ls -1R|grep : | sed 's/:$//g' | sed 's/..//'>times");
mywfile=fopen("heights.dat","w");
myfolders=fopen("times","r");

fscanf(myfolders,"%s",filename);
fscanf(myfolders,"%s",filename);

puts("enter the still water level");
scanf("%f",&swl);

while(fscanf(myfolders,"%s",filename)==1)
{
fprintf(mywfile,"%s\t",filename);
strcat (filename,"/centerPatch_gamma.gplt");
printf("%s\n",filename);
myfile=fopen(filename,"r");
for (i=0;i<12;i++) fscanf(myfile,"%s",c);
for (i=0;!feof(myfile);i++){
fscanf(myfile,"%lf %lf %lf %lf",&x[i],&y[i],&z[i],&gamma[i]);
}
N=i-1;
z_base=z[0];
for (i=0;i<N;i++)
z[i]=z[i]-z_base;

/*Trapez*/
h=(gamma[0]+gamma[N]);
for (i=1;i<N-1;i++)
h=h+2*gamma[i];
h=h*(z[1]-z[0])/2;
fprintf(mywfile,"%f\t",h-swl);

/*simpson*/
h=(gamma[0]+gamma[N]);
for (i=1;i<N-1;i=i+2) h=h+4*gamma[i];
for (i=2;i<N-2;i=i+2) h=h+2*gamma[i];
h=h*(z[1]-z[0])/3;
fprintf(mywfile,"%f\n",h-swl);

/*
for (i=0;i<N;i++)
{
if(gamma[i]>=0.5 && gamma[i+1]<=0.5)
{
printf("%f %f %f %f \n",x[i],y[i],z[i],gamma[i]);
printf("%f %f %f %f \n",x[i+1],y[i+1],z[i+1],gamma[i+1]);
h=z[i+1]+(0.5-gamma[i+1])*(z[i+1]-z[i])/(gamma[i+1]-gamma[i]);
printf("h=%f\n",h);
fprintf(mywfile,"%f\n",h);
}
}*/
fclose(myfile);
}

fclose(mywfile);


}

NOTE: The output is "heights.dat". But it should be sorted against timesteps before plotting. !!!

The results are much better than I expected:

http://www.be.itu.edu.tr/~ozgur/sloshing2.jpg



Ozgur

gautami July 2, 2009 17:04

Hello Gopala & Ozgur,

Thank you very much for your suggestions.

Ozgur I did exactly what you told to do,using your code and it works fine.I got the elevation plot and the result looks really good.

Thank you.

Regards,
Gautami.

gopala July 3, 2009 04:30

Dear Ozgur,

Thanks for the quick response. I tried the code and indeed it works much better than my previous trials.

Out of curiosity, the elevation plot you have posted in your reply, what kind of setup or case have you used. Did you validate the interDyMFoam with some analytical or experimental results? I am working on similar problem and right now cannot find a validation case, so if you could give some reference it will definitely help.

Thanks again,

Vinay

ozgur July 4, 2009 07:57

Hello Vinay,

Yes, I have made a validation study of interDymFoam for 2D and 3D cases. A good reference that I can point to may be "A numerical study of three-dimensional liquid sloshing in tanks, Liu, D. / Lin, P. , Journal of Computational Physics 227 (8), p.3921-3939, Apr 2008"

Özgür

kumar September 10, 2009 11:09

how to extract wavelength from an LES simulation of two dimensional liquid sheet
 
Hello foamers,
I think my problem is not directly related to this post but, i am also looking into extraction of surface elevation from the results of an lesInterfoam solution. I have succesfully performed the simulation of a two dimensional liquid sheet. I would like to extract the surface elevation information and make a plot with the fourier transform of the surface elevation of the liquid film interface on the y axis and the wave length nondimensionalised by the sheet thickness on the x axis, so that i can perform a linear stability analysis and compare my results with them.

I already found some information on extracting the surface elevation by using a sampledict with a line. I will try to extract the surface elevation by using the sample dict.

i would also like to know if somebody has performed a similar calculation of performing a fourier transform of the eurface elevation. Because i have some doubts

if i can directly apply fourier transform on the data i get from my sampledict , or do i have to do some filtering or modifications to the data.

any suggestions will be very helpful

bye
with regards
K.Suresh kumar

ngj September 11, 2009 04:58

Hi Kumar

The data you are going to get from the sample-tool are not directly applicable. You need to evaluate the data and get the actual location of the surface, i.e. have say 100 points per line and turn these points into one number.

The integration routine outlined above is definitely the best way to go.

Best regards,

Niels

kumar September 12, 2009 08:10

using sampledict to extract the surface elevation
 
3 Attachment(s)
Attachment 1061

Attachment 1062

Attachment 1063

I am trying to use the sample utility to extract the surface elevation of the liquid film from the results which i have shown above. My mesh is a two dimensional mesh with just one cell in the z direction. I have also shown my mesh in the figures.
Assuming that the sample utility works on the reconstructed files obtained after the parallel run , i tried to use the sample utility with a sampledict file as shown below:

// Set output format : choice of
// xmgr
// jplot
// gnuplot
// raw
setFormat raw;

// Surface output format. Choice of
// null : suppress output
// foamFile : separate points, faces and values file
// dx : DX scalar or vector format
// vtk : VTK ascii format
// raw : x y z value format for use with e.g. gnuplot 'splot'.
// stl : ascii stl. Does not contain values!
surfaceFormat null;

// interpolationScheme. choice of
// cell : use cell-centre value only; constant over cells (default)
// cellPoint : use cell-centre and vertex values
// cellPointFace : use cell-centre, vertex and face values.
// 1] vertex values determined from neighbouring cell-centre values
// 2] face values determined using the current face interpolation scheme
// for the field (linear, gamma, etc.)
interpolationScheme cell;

// Fields to sample.
fields
(
gamma
);


// Set sampling definition: choice of
// uniform evenly distributed points on line
// face one point per face intersection
// midPoint one point per cell, inbetween two face intersections
// midPointAndFace combination of face and midPoint
//
// curve specified points, not nessecary on line, uses
// tracking
// cloud specified points, uses findCell
//
// axis: how to write point coordinate. Choice of
// - x/y/z: x/y/z coordinate only
// - xyz: three columns
// (probably does not make sense for anything but raw)
// - distance: distance from start of sampling line (if uses line) or
// distance from first specified sampling point
//
// type specific:
// uniform, face, midPoint, midPointAndFace : start and end coordinate
// uniform: extra number of sampling points
// curve, cloud: list of coordinates
sets
(
lineX1
{
type uniform;
axis xyz;

//- cavity
start (0.0 0.0 0.0);
end (0.0 -1500.0 0.0);
nPoints 10;
}

);


// Surface sampling definition: choice of
// plane : values on plane defined by point, normal.
// patch : values on patch.
//
// 1] planes are triangulated by default
// 2] patches are not triangulated by default
surfaces
(
constantPlane
{
type plane;
basePoint (0.0501 0.0501 0.005);
normalVector (0.1 0.1 1);

//- Optional: restrict to a particular zone
// zoneName zone1;

// Optional: whether to leave as faces or triangulate (=default)
triangulate false;
}

interpolatedPlane
{
type plane;
// make plane relative to the coordinateSystem (Cartesian)
coordinateSystem
{
origin (0.0501 0.0501 0.005);
}
basePoint (0 0 0);
normalVector (0.1 0.1 1);
triangulate false;
interpolate true;
}

movingWall_constant
{
type patch;
patchName movingWall;
// Optional: whether to leave as faces (=default) or triangulate
}

movingWall_interpolated
{
type patch;
patchName movingWall;
interpolate true;
// Optional: whether to leave as faces (=default) or triangulate
}

/* not yet (re)implemented --
constantIso
{
name iso;
field rho;
value 0.5;
}
someIso
{
type iso;
field rho;
value 0.5;
interpolate true;
}
*/
);


// ************************************************** ********************* //
the initial point that i specify 0,0,0 is at the top point of the offset that can be seen in my simulation results. But when i run sample from the case directory the sets directory is generated with all the time directories, but there is no data with in the directories.

I am working on making a plot with the Fourier transform of the elevation of the liquid film interface on the y axis and i want the wave length normalised by the sheet thickness on the x axis.
Any suggestions on performing this on the mesh shown above are welcome.

bye
with regards
K.Suresh kumar

kumar September 14, 2009 12:02

Hello everybody,
I got the sample utility to work on my results and extract the gamma value along a line. The problem was that while specifying the lines point values i was not considering the scaling factor with which i multiply my points (ie. the scaling factor used in my blockMesh file). Now i will try to apply the integration routine outlined above on my files.

Thanks again Niels, Just one more general question, Niels, i want to validate the results of my lesInterfoam calculation with the linear stability results. I already have developed a linear stability model with the viscosity of the liquid included.the model is also working fine as i compared my results with literature.

So now i want to perform a fast fourier transform on the elevation of the liquid film interface and compare it with the linear stability results.

if you have seen any literature where this kind of comparison has been done, could you please let me know the title.
any sugeestions from your side will also be very helpful to me.

bye
with regards
K.Suresh kumar

kumar September 17, 2009 06:29

Regarding the extraction of elevation of liquid film interface
 
3 Attachment(s)
Hello everybody,
I have been trying to extract the elevation of liquid film interface and perform a fourier transform of that. I have sucesfully extracted the value of gamma along a line using sample utility. But before going to the next step i would like to have some suggestions

Attachment 1081

Attachment 1082

Attachment 1083
i would like to perform something like this shown in the figure.
But i have no clue how to extract this information from my results that i have shown in the previous posts.
Anybody with the experience of performing something similar can give me suggestions.

thanking you
K.Suresh kumar

rcastilla October 27, 2009 13:19

Hi, kumar,

I am doing that with paraFoam. Just make a contour of gamma=0.5 and save the data with csv format. It will give you a lot of columns with the data shown in screen. The data for gamma will be only 0.5, but you will have in other columns (the three at the end, if I remember well) the x,y and coordinates of the interface. You have also the option to do that with all the times (it will generate a file for each time).

I usually import this file in xmgrace. If you want to do that, you have to process the "csv" files in order to convert to "dat" file. I do that with the command

$for i in `ls *.csv`; do sed -e '1d' $i | tr ',' ' ' > ${i/csv/dat};done

Hope it will help you.

Robert

kumar October 28, 2009 09:33

hello Robert,
Thankyou very much for your reply. But I had already figured out the problem and now i am postprocessing the data on Matlab. And i did it the same way as you have specified but i used samplesurface to extract the contour, then loaded it in paraview and then extracted the points.

As you know it takes a long time to figure out simple things in OpenFOAM, I would have saved some time if somebody had given me this information before. Still thankyou very much for your reply.

Could you give me some more information about your work you did , may be it is helpful for me if i have any problem in the future to contact you.

bye
thank you again
with regards
K.Suresh kumar

rcastilla October 28, 2009 11:01

Hi, kumar,

I am now working with capillary flows (microfluids). My main problem is how to reduce the parasitic flows (have you managed it?). There are some methods, but, as you say, it is not easy to implement things in OpenFoam. At least not for newbies (I am working with OF for only one year).

Of course, don't hesitate to contact me if you some any problem.

Best regards

Robert

kumar October 30, 2009 09:32

Hello Robert,
It is interesting to know that you are studying on how to reduce the parasitic currents. But I have some basic questions regarding parasitic currents. I have read that parasitic currents are generated in surface tension dominated fluid problems like the one you are studyiing. my knowledge about the parasitic currents is less.

But i once read soomewhere in the posts that interFoam is very good in damping the parasitic currents. I have never looked my problem for parasitic currents point of view. I am studying the breakup of liquid sheets where my reynolds number is around 2000 and weber number is around 1000, so surface tension effects are also dominant in my problem. Do you think parasitic currents at the interface are really a problem , and if so how have been it handled in OpenFOAM till now.

bye
with regrds
K.Suresh kumar

rcastilla October 30, 2009 11:01

Hi, Kumar,
in fact, parasitic current are important in my case. I have found a way to reduce them. As this subject is so different to "contour plottings", I have open a new thread. Please, have a look in http://www.cfd-online.com/Forums/ope...tml#post234662 and give me your opinnion.

Best regards

Robert

yannH July 6, 2010 05:01

Hi everyone,

Is there an other way to get surface elevation, I mean without using a personnal script ?

My goal is to have the distance between my still water level and the interface when alpha1 is 0.5.

thanks

Yann

kumar July 6, 2010 06:09

Hello yannH,
It is possible to extract the elevation of the liquid interface without using a personal script in paraview. But you still have to run the sample script, which comes with OpenFoam. You can extract the isosurface as at alpha 0.50 and then write the solution in vtk format. Then open paraview (not paraFoam) and load the .vtk file. The you can can use the slice option to get a section of your surface. Then use the (select points on) option from the edit menu. Then use the (extract selection) filter from the filters menu. Then open another window on the same screen by using split horizontal option, then use spread sheet view.

This will give you the coordinates of the interFace based on the points you selected. This is an easy way of extraction of elevation of the interface.

hope it helps

yannH July 7, 2010 11:32

Hi Kumar,

Thanks for replying, I succeed with your explaination (I'm just looking after how to create a plot using the spreadsheet)

Do you think it's possible, I mean not too hard, to implement a variable for surface elevation directly in my interDyMFoam code ? because it would be quite simple for postprocess my cases !

regards,

Yann

krishnaprasad November 11, 2010 00:50

urgent help needed...surface elevetion in wave tank
 
i am doing a wave tank problem in fluent. i have generated waves..i got wave elevation v/s tank length plot at iso-vof=o.5.. but i have a problem in ploting wave elevation v/s time..please help me.. it is urgent,,,...thank you in advance

lindstroem December 1, 2010 08:52

Hi all,

I as well used the suggested code from ozgur. But I have a Problem: The genHOF.c doesnt finish the line "scanf("%f",&swl);" (round about line 20). I placed an output in the line afterwards, which was never reached.

The file height.dat is build, but empty and times contains all my timesteps.

Does anyone has an idea what might be wrong?

-> My fault.. I just have to enter it.. maybe sth was wrong in my input before...

Thanks in advance!

duongquaphim December 10, 2010 05:29

Hi Krishna,

I think you can use sampleDict to extract isosurface plane at each time step in post-processing. Or more simple, just load data to paraview and plot the isosurface alpha = 0.5 in time.

Regards,

Duong

cheng1988sjtu January 1, 2011 13:03

Doubt about the integration method
 
Hi ozgur,

I'm actually not so comfortable with the integration method. We can find it OK in theoretic work, but there are many grids in which the gamma are between 0 and 1.

moreover, when there are some special situations such as overturning, then the integration method should be invalid.

In fact, if we have enough nPoints in the sampling, I believe, the criteria gamma[n]>0.5, gamma[n+1]<0.5 may be a better choice.

Any opinions are welcome. Thank you!

Zhen Cheng


Quote:

Originally Posted by ozgur (Post 216019)
Hi Niels,

Thanks for the hints.. In fact I myself was suspicious about to locate gamma=0.5 (at least by a linear interpolation).

Anyway after some dirty coding, I managed to get following results for the sloshingTank2D3DoF tutorial.

http://atlas.cc.itu.edu.tr/~kirlangico/grafik.jpeg

The correct location of the free surface is important for me, because I want make comparisons with experimental results.

Ozgur



Just to complete, a sampled gamma data looks like this for an individual time step:


x y z gamma
0 0 -10 1
0 0 -9.69697 1
0 0 -9.39394 1
0 0 -9.09091 1
0 0 -8.78788 1
0 0 -8.48485 1
0 0 -8.18182 1
0 0 -7.87879 1
0 0 -7.57576 1
0 0 -7.27273 1
0 0 -6.9697 1
0 0 -6.66667 1
0 0 -6.36364 1
0 0 -6.06061 1
0 0 -5.75758 1
0 0 -5.45455 1
0 0 -5.15152 1
0 0 -4.84848 1
0 0 -4.54545 1
0 0 -4.24242 1
0 0 -3.93939 0.999999
0 0 -3.63636 0.999999
0 0 -3.33333 0.999999
0 0 -3.0303 0.998297
0 0 -2.72727 0.998297
0 0 -2.42424 0.998297
0 0 -2.12121 0.875845
0 0 -1.81818 0.875845
0 0 -1.51515 0.875845
0 0 -1.21212 0.251325
0 0 -0.909091 0.251325
0 0 -0.606061 0.251325
0 0 -0.30303 0.00170957
0 0 -4.10783e-15 0.00201351
0 0 0.30303 0.00201351
0 0 0.606061 0.00201351
0 0 0.909091 2.12627e-05
0 0 1.21212 2.12627e-05
0 0 1.51515 2.12627e-05
0 0 1.81818 5.35303e-08
0 0 2.12121 5.35303e-08
0 0 2.42424 5.35303e-08
0 0 2.72727 1.30219e-11
0 0 3.0303 1.30219e-11
0 0 3.33333 1.30219e-11
0 0 3.63636 1.03978e-16
0 0 3.93939 1.03978e-16
0 0 4.24242 1.03978e-16
0 0 4.54545 4.42707e-24
0 0 4.84848 4.42707e-24
0 0 5.15152 4.42707e-24
0 0 5.45455 3.07062e-36
0 0 5.75758 3.07062e-36
0 0 6.06061 3.07062e-36
0 0 6.36364 1.69305e-52
0 0 6.66667 1.69305e-52
0 0 6.9697 1.69305e-52
0 0 7.27273 -1.2664e-58
0 0 7.57576 -1.2664e-58
0 0 7.87879 -1.2664e-58
0 0 8.18182 -1.11574e-57
0 0 8.48485 -1.11574e-57
0 0 8.78788 -1.11574e-57
0 0 9.09091 -2.91388e-57
0 0 9.39394 -2.91388e-57
0 0 9.69697 -2.91388e-57
0 0 10 -2.91388e-57
0 0 10.303 -2.28496e-57
0 0 10.6061 -2.28496e-57
0 0 10.9091 -1.05445e-57
0 0 11.2121 -1.05445e-57
0 0 11.5152 -1.05445e-57
0 0 11.8182 -3.28503e-58
0 0 12.1212 -3.28503e-58
0 0 12.4242 -3.28503e-58
0 0 12.7273 -7.07185e-59
0 0 13.0303 -7.07185e-59
0 0 13.3333 -7.07185e-59
0 0 13.6364 -1.11157e-59
0 0 13.9394 -1.11157e-59
0 0 14.2424 -1.32059e-60
0 0 14.5455 -1.32059e-60
0 0 14.8485 -1.32059e-60
0 0 15.1515 -1.17364e-61
0 0 15.4545 -1.17364e-61
0 0 15.7576 -1.17364e-61
0 0 16.0606 -7.47976e-63
0 0 16.3636 -7.47976e-63
0 0 16.6667 -7.47976e-63
0 0 16.9697 -3.43373e-64
0 0 17.2727 -3.43373e-64
0 0 17.5758 -8.76047e-66
0 0 17.8788 -1.34639e-65
0 0 18.1818 -1.34639e-65
0 0 18.4848 -1.48939e-67
0 0 18.7879 -1.48939e-67
0 0 19.0909 -1.48939e-67
0 0 19.3939 -1.95727e-70
0 0 19.697 -1.95727e-70
0 0 20 -1.95727e-70


Eliz August 7, 2011 13:08

segmentation fault
 
Hi everybody,

I also try to plot surface elevation vs time and I copied Ozgur's C code, compiled and execute but it gives segmentation fault for some reason. Do you have any idea why it might happen?? Thanks in advance

Regards,
Eliz

cheng1988sjtu August 7, 2011 17:36

check the code for openfile name?
 
please check the file name that you need to read and also the size of the dimensions in the code ( defaultly 15000, I think , but not sure, this number should be larger than the size of the file that you need to read) cheers!

Zhen

Quote:

Originally Posted by Eliz (Post 319201)
Hi everybody,

I also try to plot surface elevation vs time and I copied Ozgur's C code, compiled and execute but it gives segmentation fault for some reason. Do you have any idea why it might happen?? Thanks in advance

Regards,
Eliz


Eliz August 8, 2011 08:29

Thanks for your reply Zhen, The dimensions are 1500 and the name of the file looks fine.

I run it by using "gdb" with the help of this link, to see what the error is,

http://www.unknownroad.com/rtfm/gdbtut/gdbsegfault.html

and it said "Source file name is more recent than executable" . Do you have any idea why it says so??any suggestions??Thanks a lot!!

Regards,
Eliz

cheng1988sjtu August 8, 2011 09:03

make sure the file is ok
 
Hi,

what format is the data file?

try to use vim to open the file and see if the first few lines are data or description words.

and make sure that the executive file (e.g> a.out) is in the right folder, :-)

Zhen

Quote:

Originally Posted by Eliz (Post 319308)
Thanks for your reply Zhen, The dimensions are 1500 and the name of the file looks fine.

I run it by using "gdb" with the help of this link, to see what the error is,

http://www.unknownroad.com/rtfm/gdbtut/gdbsegfault.html

and it said "Source file name is more recent than executable" . Do you have any idea why it says so??any suggestions??Thanks a lot!!

Regards,
Eliz


Jane L December 21, 2012 01:52

sample with solidBodyMotionFvMesh
 
Hi FOAMers!

I have another question related to this topic. I'm also using the sample-utility to write the values for alpha1 (gamma) along a line into files for each time step. This can be read easily by octave.
I figured out that sample takes the data along a line in the fixed coordinate system. In my case (sloshing in a tank) I would like to sample the data along a line in the relative coordinate system of the tank which is moved by solidBodyMotionFvMesh.
Does anyone know how to do that?

Thanks a lot!

luchen2408 May 1, 2013 09:18

hello,jane, I have the same problem with you ,I also need to make the plot of the liquid level with time, and I want to make the relative coordiate system moving with the model. Have you solved the problem?

Jane L May 6, 2013 02:05

1 Attachment(s)
Hi luchen2408!

I hope my reply still helps a few days later. Go to the folder for the sample utility (OpenFOAM-2.1.1/applications/utilities/postProcessing/sampling/sample), make your own copy of that folder (for example relatveSample) and outcomment following lines in the *.C file:

// Handle geometry/topology changes
// polyMesh::readUpdateState state = mesh.readUpdate();

// sSets.readUpdate(state);
// sSurfs.readUpdate(state);

Make all necessary changes in the other files in that folder and compile with wmake. If everything worked fine, you can run your of relatveSample right after the calculation like the normal sample utility. You may have a look in the attached example which I called dynamicSample for some reasons

kind regards

luchen2408 May 9, 2013 10:26

hello,jane, I copy your attached file into my case, I look through the file, but I can't catch them very much. I input " wmake", but failed, I got following result,
Making dependency list for source file dynamicSample.C
SOURCE=dynamicSample.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/meshTools/lnInclude -I/opt/openfoam171/src/sampling/lnInclude -I/opt/openfoam171/src/surfMesh/lnInclude -I/opt/openfoam171/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/dynamicSample.o
dynamicSample.C: In function ‘int main(int, char**)’:
dynamicSample.C:100:5: error: ‘addOption’ is not a member of ‘Foam::argList’
dynamicSample.C:112:26: error: ‘class Foam::argList’ has no member named ‘optionLookupOrDefault’
dynamicSample.C:112:52: error: expected primary-expression before ‘>’ token
dynamicSample.C:112:62: warning: left operand of comma operator has no effect [-Wunused-value]
dynamicSample.C:119:9: error: ‘MUST_READ_IF_MODIFIED’ is not a member of ‘Foam::IOobject’
dynamicSample.C:128:9: error: ‘MUST_READ_IF_MODIFIED’ is not a member of ‘Foam::IOobject’
make: *** [Make/linux64GccDPOpt/dynamicSample.o] Error 1
luch@ctcnwk843-ubuntu:~/Desktop/test/testheight/00/system/dynamicSample$

can you explain it more about it and how can I get the final result? Thanks very much

luchen2408 May 21, 2013 10:45

hello ,Dear Jane, I have tried the method you referred, I can wmake and generate a file--dynamicsample, when I run the file, I also got an error as following.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



--> FOAM FATAL IO ERROR:
cannot open file

file: /home/luch/Desktop/test/testheight/00/system/newdynamicSample/system/controlDict at line 0.

From function regIOobject::readStream()
in file db/regIOobject/regIOobjectRead.C at line 61.

FOAM exiting

luch@ctcnwk843-ubuntu:~/Desktop/test/testheight/00/system/newdynamicSample$


after I copy the controlDict into the folder and run the file, I also got error:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



--> FOAM FATAL ERROR:
No times selected

From function dynamicsample
in file db/Time/timeSelector.C at line 240.

FOAM exiting

luch@ctcnwk843-ubuntu:~/Desktop/test/testheight/00/system/newdynamicSample$


can you give me more hint ?how can I make it ? thanks

Jane L July 2, 2013 01:32

Hi luchen!

Did does the ordinary "sample" utilty which comes with OpenFOAM give results? This was described in the previous posts.

Kind regards

luchen2408 July 4, 2013 09:20

Dear Jane,I have tried "sample" utility, it can give a height with the original coordinate system, however, my simulation object is moving, I have to make a local coordinate system with my object and give the sample with the local coordinate system,but I don't konw how to make it. do you have any suggestion?

Jane L July 11, 2013 06:41

Hi Luchen,

so we're talking about the same problem ;)
I faced the same problem as you do and I found that the "sample" utility gives the coordinates in the global inertial coordinate system. Therefore it needs to updade the geometry changes (movement). I disabled this updating progress so in the sample routine the movement of the geometry is not known and it writes the coordinates in the local system.
If the original sample works on vour machine you could try the following:
Outcomment the lines
Quote:

// Handle geometry/topology changes
// polyMesh::readUpdateState state = mesh.readUpdate();

// sSets.readUpdate(state);
// sSurfs.readUpdate(state);
directly in the sample.C file without any renaming or copying. You have to run wmake in that folder to compilethe change in sample. If that works you may run sample after your simulation and check if the results are in a local coordinate system.

Which version of OF do you use by the way?

kind regards


All times are GMT -4. The time now is 18:33.