|
[Sponsors] |
Error arise after alpha smooth modification in interfaceProperties::calculateK |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 2, 2014, 12:47 |
Error arise after alpha smooth modification in interfaceProperties::calculateK
|
#1 | |
New Member
Join Date: Jul 2014
Posts: 12
Rep Power: 11 |
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:
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 |
||
September 3, 2014, 05:30 |
|
#2 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21 |
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 |
|
September 3, 2014, 05:40 |
|
#3 |
New Member
Join Date: Jul 2014
Posts: 12
Rep Power: 11 |
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 |
|
March 24, 2015, 18:02 |
|
#4 |
New Member
Join Date: Apr 2012
Posts: 4
Rep Power: 13 |
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, |
|
March 25, 2015, 09:50 |
|
#5 |
New Member
Join Date: Jul 2014
Posts: 12
Rep Power: 11 |
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 |
|
March 7, 2016, 12:46 |
|
#6 | |
New Member
Join Date: Jan 2016
Posts: 19
Rep Power: 10 |
Quote:
So it seems convenient to use a smoothed alpha field only for the calculation of interface properties. |
||
Tags |
extend library, smooth alpha |
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |