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

Error arise after alpha smooth modification in interfaceProperties::calculateK

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 2, 2014, 11:47
Default Error arise after alpha smooth modification in interfaceProperties::calculateK
  #1
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 3
red.yxg is on a distinguished road
Dear All:

Now I am using interFoam to simulate 2-phase flow. I smoothed the alpha by some changes in interfaceProperties.c in Foam::interfaceProperties::calculateK() according to Laplacian filter(3.51) in Onno Ubbink's thesis. No error arise in recompilation of interfaceProperties.c and interFoam.c . But when I call interFoam calculating a case, error arised:

Quote:
new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library.
So I just go back to the interfaceProperties.c and change the code line by line to check what caused this problem:

Code:
void Foam::interfaceProperties::calculateK()
{
    const fvMesh& mesh = alpha1_.mesh();
    const surfaceVectorField& Sf = mesh.Sf();
 
   
    const volScalarField& volSmoothAlpha0=alpha1_;  // added by me 
    const volScalarField& surfaceSumArea=fvc::surfaceSum(mesh.magSf()); // added by me
 
    const surfaceScalarField& surfaceSmoothAlpha0=Foam::linearInterpolate(volSmoothAlpha0); // added by me

    const surfaceScalarField& surfaceAreatimesAlpha0=surfaceSmoothAlpha0*mesh.magSf();  // added by me

    const volScalarField& surfaceSumAreatimesAlpha0=fvc::surfaceSum(surfaceAreatimesAlpha0); // added by me

    const volScalarField& volSmoothAlpha1=surfaceSumAreatimesAlpha0/surfaceSumArea; // added by me, this one cause the problem. !!!


The last line caused the error. I am new to OpenFoam. Maybe this is a simple question. So anyone has the hint ? Thanks !

Yin
red.yxg is offline   Reply With Quote

Old   September 3, 2014, 04:30
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
You are misusing references (the ampersand '&').

1. volScalarField theActualObject;
2. volScalarField& referenceToObject = objectToWhichItRefers;

1 is an actual instance of an object that takes up real memory.
2 is a reference to another object stored elsewhere, and notice it *must* be initialized by the object it points to right away.

Only use the '&' if you know the object exists already somewhere else. Hope that helps.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   September 3, 2014, 04:40
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 3
red.yxg is on a distinguished road
Hi, David:

Thank you for your reply. Yeah, you are right. I am just too new to C++ and OpenFOAM. I will check whether I can manage it.

Cheers,
Yin
red.yxg is offline   Reply With Quote

Old   March 24, 2015, 18:02
Default
  #4
New Member
 
Join Date: Apr 2012
Posts: 2
Rep Power: 0
suchi89 is on a distinguished road
Hi,

Have you been able to resolve this?
Also, I am trying to implement the same smoother in alphaEqnSubCycle.C instead of at interfaceProperties.C

Was there a specific reason why the implementation is at interfaceProperties.C and not after calculating alpha at alphaEqnSubCycle.C?\

Thanks,
suchi89 is offline   Reply With Quote

Old   March 25, 2015, 09:50
Default
  #5
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 3
red.yxg is on a distinguished road
Hi,

Yes, later I found smoothing alpha has little influence on my result. So I just quit.
We only need the smoothed alpha for surface tension calculation, so I directly modify in interfaceproperties.C, I think this is more convenient. But I am not sure.

Yin
red.yxg is offline   Reply With Quote

Reply

Tags
extend library, smooth alpha

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
setfields for alpha belkadi OpenFOAM Programming & Development 7 November 25, 2014 12:53
bubbleFoam tutorial case with turbulence setzberg OpenFOAM Running, Solving & CFD 5 January 23, 2014 12:23
TwoPhaseEulerFoam and Boundary conditions raagh77 OpenFOAM Running, Solving & CFD 98 September 23, 2013 06:31
alphaEqn.H in twoPhaseEulerFoam cheng1988sjtu OpenFOAM Bugs 14 September 18, 2011 13:46
Determining alpha and beta for porous baffle Liaqat Khan CD-adapco 1 October 27, 2000 04:44


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