CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > 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 Search this Thread Display Modes
Old   September 2, 2014, 12:47
Default Error arise after alpha smooth modification in interfaceProperties::calculateK
  #1
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 11
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, 05:30
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
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, 05:40
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 12
Rep Power: 11
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: 4
Rep Power: 13
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: 11
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

Old   March 7, 2016, 12:46
Default
  #6
New Member
 
Join Date: Jan 2016
Posts: 19
Rep Power: 10
mheinz is on a distinguished road
Quote:
Originally Posted by red.yxg View Post
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
I would add that smoothing the alpha field would likely be counterproductive because in general one wants the interface to be sharp. The calculation of the curvature on the other hand is quite inaccurate for a sharp alpha field.

So it seems convenient to use a smoothed alpha field only for the calculation of interface properties.
mheinz is offline   Reply With Quote

Reply

Tags
extend library, smooth alpha

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TwoPhaseEulerFoam and Boundary conditions raagh77 OpenFOAM Running, Solving & CFD 99 February 6, 2018 19:31
alphaEqn.H in twoPhaseEulerFoam cheng1988sjtu OpenFOAM Bugs 15 May 1, 2016 17:12
bubbleFoam tutorial case with turbulence setzberg OpenFOAM Running, Solving & CFD 6 October 15, 2015 14:29
setfields for alpha belkadi OpenFOAM Programming & Development 7 November 25, 2014 12:53
Determining alpha and beta for porous baffle Liaqat Khan Siemens 1 October 27, 2000 05:44


All times are GMT -4. The time now is 11:34.