CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

get position of interface and store it

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 7, 2011, 10:46
Default get position of interface and store it
  #1
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi all,

I am wondering if it might be possible to get and store the interface position to have it avaible for the next time step. The reason is that it would be interesting to have the distance the interface moved within one timestep. With this information the contact line velocity used in the dynamicAlphaContactAngle could be more precise as it is independent of the mesh.

I would be glad for any suggestions or comments.

Thank you!
lindstroem is offline   Reply With Quote

Old   June 8, 2011, 12:27
Default
  #2
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 233
Rep Power: 7
Phicau is on a distinguished road
Hi

you can try to store the alpha1 = 0.5 isosurface and then compare it. Just add the following code to the controlDict file. You can also change the surfaceFormat to raw (easier to read).

Code:
functions
{
    elevation
    {
        type            surfaces;
        functionObjectLibs
        (
            "libsampling.so"
        );
        outputControl   outputTime;
        surfaceFormat   vtk;
        fields
        (
            alpha1
        );
        surfaces
        (
            topFreeSurface
            {
                type        isoSurface;
                isoField    alpha1;
                isoValue    0.5;
                interpolate true;
            }
        );
    }

}
Phicau is offline   Reply With Quote

Old   June 9, 2011, 04:06
Default
  #3
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Thanks for the hint. So you mean that I then should read the output file from the dynamicAlphaContactAngle..C. Ok, I'll givr it a try and maybe come back with new questions thanks!
lindstroem is offline   Reply With Quote

Old   June 9, 2011, 10:37
Default
  #4
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi Phicau,

thanks again for your suggestion, it works actually as you said. Do you think it would be possible to get the data as an array e.g. within my C functions? Another problem is, that I only get these information at the timesteps i print out my data, but I need them for every timestep.
Thanks in advance!
lindstroem is offline   Reply With Quote

Old   June 9, 2011, 11:10
Default
  #5
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 233
Rep Power: 7
Phicau is on a distinguished road
Hi

yes, sorry for that, you can change the outputControl value to match your needs:
Code:
        outputControl   timeStep;
        outputInterval  1;
You should also include some code to purge old results, since raw ASCII files are usually very large if the case is big.

Reading the files will be easy, since the first line states the number of points and the second one states the format (x, y, z, alpha=0.5).

The most difficult part is to calculate the displacement between the surfaces, I hope someone can help you with that.
Phicau is offline   Reply With Quote

Old   June 9, 2011, 11:33
Default
  #6
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi!

Ok I get what you mean, so I delete all the results after getting my information except every 1e-05 step for example..
Yeah your right. After having the data from the timestep before I have the difficulty to compute the distance to the current timestep. So maybe I need sth like the 0.5 isosurface of the current timestep.. I'll think about that.

Thanks again!
lindstroem is offline   Reply With Quote

Old   June 14, 2011, 08:36
Default
  #7
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi again,

maybe someone can help me with that question again:
in the dynamicAlphaContactAngleFvPatchScalarField.C in the function Foam::dynamicAlphaContactAngleFvPatchScalarField:: theta we start by extracting some values
Code:
    const fvPatchVectorField& Up,
    const fvsPatchVectorField& nHat
where Up is the velocity in the center of a cell, if I get that right. Is it possible to extract in the same way the value of alpha1 of a cell? Something like:
Code:
const fvPatchScalarField& alpha1
...
scalarField alpha1wall = alpha1.patchInternalField();
As it is done for Uwall?!
lindstroem is offline   Reply With Quote

Old   June 14, 2011, 10:41
Default
  #8
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 233
Rep Power: 7
Phicau is on a distinguished road
Hi

I guess that might be possible, you can load the alpha field within the BC by:

Code:
    const volScalarField& alpha = db().lookupObject<volScalarField>("alpha1");
Phicau is offline   Reply With Quote

Old   June 14, 2011, 10:53
Default
  #9
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 6
lindstroem is on a distinguished road
Hi again

thanks for your hint! Then I need to extract the values from the desired patch and delete the other lines.. Allright, I'll give that a try! That's similar to what andrea said. Thanks!
lindstroem is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
interface tension question with interFoam solver openTom OpenFOAM Running, Solving & CFD 4 May 29, 2009 13:18


All times are GMT -4. The time now is 00:02.