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

interface reconstruction and point value access

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By jameswilson620
  • 1 Post By moblimostafa
  • 2 Post By roenby

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 12, 2015, 20:39
Default interface reconstruction and point value access
  #1
Member
 
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 39
Rep Power: 11
jameswilson620 is on a distinguished road
Hello all,

Im looking to utilize interface reconstruction and require access to alpha.water, for a given cell, at all 8 points (assuming i'm using a hex).

I have seen: http://www.cfd-online.com/Forums/ope...ize-x-y-z.html

and it gets me close as I have dropped some "Info << stuff << endl;" lines in interfoam to see what all of the definitions are in the above link:

Code:
const faceList & ff = mesh.faces();
const pointField & pp = mesh.points();

forAll ( mesh.C(), celli)
{
    const cell & cc = mesh.cells()[celli];
    labelList pLabels(cc.labels(ff));
    pointField pLocal(pLabels.size(), vector::zero)
      forAll (pLabels, pointi)
      {
           pLocal[pointi] = pp[pLabels[pointi]];

           scalar xDim = Foam::max(pLocal & vector(1,0,0)) - Foam::min(pLocal & vector(1,0,0));

        Info  << endl << "celli:  " << celli << endl;
        Info  << "pointi:  " << pointi << endl;
        Info  << "pLabels[pointi]:  " << pLabels[pointi]<< endl;
        Info  << "pLocal[pointi]:  " << pLocal[pointi]<< endl;
        Info  << "pLocal:  " << pLocal<< endl;
            // And similar for yDim and zDim
    }  
}
I used damBreak as a test case for the snippet of code. I have utilized paraview to generate id's for the initial condition where the liquid corner point should have a value of 0.25. And it is (see attached image)! I dumped the dambreak simulation into a log file and used grep, knowing the coordinate location of the liquid corner point (see attached):

Code:
grep -n "0.146 0.289199 0.0146" ~/Desktop/damBreak/log"
Here is a sample from grep of the cells containing this pointID (6817) and coordinate location (0.146 0.289199 0.0146):

Code:
celli:  2265
pointi:  2
pLabels[pointi]:  6817
pLocal[pointi]:  (0.146 0.289199 0.0146)
pLocal:  8((0.146 0.282499 0) (0.146 0.289199 0) (0.146 0.289199 0.0146) (0 0 0) (0 0 0) (0 0 0) (0 0 0) (0 0 0))

...


celli:  2266
pointi:  5
pLabels[pointi]:  6817
pLocal[pointi]:  (0.146 0.289199 0.0146)
pLocal:  8((0.152636 0.282499 0) (0.152636 0.289199 0) (0.152636 0.289199 0.0146) (0.152636 0.282499 0.0146) (0.146 0.289199 0) (0.146 0.289199 0.0146) (0 0 0) (0 0 0))
note: since this is 2D, there should be 4 cells that own this point ID. There are 4. i am only showing two : )

So, I would like to gain access to alpha.water's point values during runtime in the same manner paraview would such that I can derive other fields based on the point values for alpha.water.

Thanks for your time!

PS any input on decoding the meaning of the definitions in the code snippet above is welcome ; )

James
Attached Images
File Type: jpg Screenshot from 2015-05-12 19:45:04.jpg (51.7 KB, 174 views)

Last edited by wyldckat; May 18, 2015 at 15:57. Reason: fixed link
jameswilson620 is offline   Reply With Quote

Old   May 18, 2015, 16:03
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings James,

I can't figure out why you need the 8 extreme points of the mesh, but it would be helpful to know why you need them.
I ask this because the "alpha.water" is only available at the centre of the cells and/or the centre of the faces on the boundary mesh.
In order to have the "alpha.water" values at the extremities of the mesh, you would need to interpolate those values.

The closest I can think of is the example utility kit provided here: https://github.com/wyldckat/reconstr...rpolate-fields

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 18, 2015, 19:31
Default
  #3
Member
 
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 39
Rep Power: 11
jameswilson620 is on a distinguished road
Thanks for following up Bruno. I am reconstructing the fluid/fluid interface such that I can develop a more accurate surface tension force in a solver I have assembled using interFoam. Please see pg.25, Fig.3.2 (right) of:

http://tuprints.ulb.tu-darmstadt.de/...Kunkelmann.pdf

for reference to point interpolated values.

Since the tangential surface tension force is calculated using the interface normal and local curvature, the use of the gradient operator is commonly utilized. fvc::grad(alpha1)/(...) (or similar) get a rough estimate of the interface normal. This rough estimate tends towards large parasitic currents.

By following a method similar to that which is described in the link above, the orientation of the interface can be determined with greater precision by using point interpolated values. The orientation of the interface and the interface itself is then defined in a way where it is continuous from cell to cell (Fig.3.5b in same link).

Ive seen some interesting threads regarding cells adjacent to a given cell (http://www.cfd-online.com/Forums/ope...ent-cells.html). I'm more interested in all of the cells sharing a given point where the average of alpha1[celli] sharing some point would be averaged to yield the results shown in the link above.

Constructing the iso-plane at alpha.water=0.5 would require some geometry skills and would also rely on a consistent numbering of points and cells in the domain. If I can predictably identify for a given cell, all of its constituent points, and the adjacent cells for each of those points, I could determine the orientation of the iso-plane (alpha.water=0.5) cutting that cell.

That's it! easier said than done, I know : )

Thanks for your time, James

**EDIT

Here is a version of what I'm looking for: http://www.cfd-online.com/Forums/ope...rpolation.html

It appears to be available in 1.6-ext. Perhaps I can look at the src and port it for OF230. Bruno, you seem to be the resident porting expert around these parts ; )

Last edited by jameswilson620; May 18, 2015 at 19:38. Reason: Additional content
jameswilson620 is offline   Reply With Quote

Old   May 18, 2015, 20:58
Default
  #4
Member
 
james wilson
Join Date: Aug 2014
Location: Orlando, Fl
Posts: 39
Rep Power: 11
jameswilson620 is on a distinguished road
Sorry about this.. I made some good progress. I will follow up with further questions as I know they will arise. In interFoam, I added these


To createFields:
Code:
// Initialize a pointMesh object
pointMesh pMesh(mesh);

pointScalarField pValues
(
    IOobject
    (
        "pValues",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    pMesh,
    dimensionedScalar("scalar", dimless, 0.0),
    "zeroGradient"
);
to interFOam.C:
Code:
...
#include "fixedFluxPressureFvPatchScalarField.H"

			//ADD
			#include "volPointInterpolation.H"
			#include "pointMesh.H"
			#include "pointFields.H"
			#include "fixedValuePointPatchFields.H"
			//END 

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

int main(int argc, char *argv[])
{
...
Then interpolate the volScalarField to pointScalarField and write at each time step. This snippet of code can be placed anywhere in the solver. I put it after alpha.water is updated:
Code:
const volPointInterpolation& pInterp = volPointInterpolation::New(mesh);

pointScalarField alpha1p(pInterp.interpolate(alpha1));

pValues.internalField() = alpha1p;

pValues.write();
I used these resources:
http://repo.or.cz/w/OpenFOAM-1.6.x.g...polationTest.C

http://www.cfd-online.com/Forums/ope...alarfield.html

http://www.cfd-online.com/Forums/ope...alarfield.html

See attached for the ideal end result of what I wish to do. paraview builds the isocontour at alpha.water=0.5 automatically; I need to build this isocontour manually during runtime. I will have issues orienting the local points in each of the cells such that they draw the hex to which they belong.

James
Attached Images
File Type: jpg Screenshot from 2015-05-18 20:45:45.jpg (44.9 KB, 189 views)
sdutta likes this.
jameswilson620 is offline   Reply With Quote

Old   September 20, 2015, 08:38
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings James,

I had this thread of yours on my to-do list for a long time and only today did I finally manage to get back to it.
From what I can understand, you've already solved this issue.

The only thing I can think of that might come in handy beyond this is the discretization schemes that use vertexes instead of cells and faces, as reported here: http://www.cfd-online.com/Forums/ope...mesh-pipe.html

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   November 9, 2015, 15:29
Default
  #6
New Member
 
Mostafa Mobli
Join Date: Feb 2015
Posts: 8
Rep Power: 11
moblimostafa is on a distinguished road
Quote:
Originally Posted by jameswilson620 View Post
Sorry about this.. I made some good progress. I will follow up with further questions as I know they will arise. In interFoam, I added these


To createFields:
Code:
// Initialize a pointMesh object
pointMesh pMesh(mesh);

pointScalarField pValues
(
    IOobject
    (
        "pValues",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    pMesh,
    dimensionedScalar("scalar", dimless, 0.0),
    "zeroGradient"
);
to interFOam.C:
Code:
...
#include "fixedFluxPressureFvPatchScalarField.H"

            //ADD
            #include "volPointInterpolation.H"
            #include "pointMesh.H"
            #include "pointFields.H"
            #include "fixedValuePointPatchFields.H"
            //END 

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

int main(int argc, char *argv[])
{
...
Then interpolate the volScalarField to pointScalarField and write at each time step. This snippet of code can be placed anywhere in the solver. I put it after alpha.water is updated:
Code:
const volPointInterpolation& pInterp = volPointInterpolation::New(mesh);

pointScalarField alpha1p(pInterp.interpolate(alpha1));

pValues.internalField() = alpha1p;

pValues.write();
I used these resources:
http://repo.or.cz/w/OpenFOAM-1.6.x.g...polationTest.C

http://www.cfd-online.com/Forums/ope...alarfield.html

http://www.cfd-online.com/Forums/ope...alarfield.html

See attached for the ideal end result of what I wish to do. paraview builds the isocontour at alpha.water=0.5 automatically; I need to build this isocontour manually during runtime. I will have issues orienting the local points in each of the cells such that they draw the hex to which they belong.

James
James

where you able to successfully implement the contour-based volume of fluid in openfoam? As far as I understood, the code you have included here can interpolate the values of alpha to corners, right? how did you do the rest? I would appreciate it if you could give me some details and insights on how to do the rest of implementation.

bests
mostafa
zangthanh likes this.
moblimostafa is offline   Reply With Quote

Old   April 7, 2016, 13:28
Default Isosurface based interface reconstruction and advection
  #7
Member
 
Johan Roenby
Join Date: May 2011
Location: Denmark
Posts: 92
Rep Power: 20
roenby will become famous soon enough
Hi James and others

Just stumpled upon this thread. You probably made your own isosurface implementation by now. But if not, I might be able to help you.
Have a look at my submitted paper here:

http://arxiv.org/abs/1601.05392

The IsoAdvector code will be released as open source once the paper is out. But if you are interested, I can share it with you before.

Cheers,
Johan
Cyp and emateo84 like this.
roenby is offline   Reply With Quote

Old   April 7, 2016, 13:33
Default
  #8
New Member
 
Mostafa Mobli
Join Date: Feb 2015
Posts: 8
Rep Power: 11
moblimostafa is on a distinguished road
Quote:
Originally Posted by roenby View Post
Hi James and others

Just stumpled upon this thread. You probably made your own isosurface implementation by now. But if not, I might be able to help you.
Have a look at my submitted paper here:

http://arxiv.org/abs/1601.05392

The IsoAdvector code will be released as open source once the paper is out. But if you are interested, I can share it with you before.

Cheers,
Johan

Dear Johan

I am still struggling with the interface reconstruction, I would much appreciate it if you could send the IsoAdvector code.
My email address is: mobli@email.sc.edu

Bests
Mostafa
moblimostafa is offline   Reply With Quote

Old   June 10, 2016, 13:09
Default
  #9
New Member
 
Emanuele
Join Date: Feb 2014
Posts: 4
Rep Power: 12
emateo84 is on a distinguished road
Quote:
Originally Posted by roenby View Post
Hi James and others

Just stumpled upon this thread. You probably made your own isosurface implementation by now. But if not, I might be able to help you.
Have a look at my submitted paper here:

http://arxiv.org/abs/1601.05392

The IsoAdvector code will be released as open source once the paper is out. But if you are interested, I can share it with you before.

Cheers,
Johan
Hi johan!
I'm extremely interested in the IsoAdvector code...Could i have more information about that?
My e-mail is emateo84@hotmail.it

regards

emanuele
emateo84 is offline   Reply With Quote

Reply

Tags
cell id, interface reconstruction, interfoam, point id


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reconstruction of the parallel case with dynamic mesh makaveli_lcf OpenFOAM Post-Processing 7 October 18, 2023 11:28
VOF: Trouble in interface reconstruction alame005 Main CFD Forum 0 February 14, 2013 15:52


All times are GMT -4. The time now is 07:59.