CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   GradientInternalCoeffs (http://www.cfd-online.com/Forums/openfoam-solving/60107-gradientinternalcoeffs.html)

kumar2 July 17, 2006 05:37

Hello friends Hope everyone
 
Hello friends

Hope everyone is having a good start to the week.

I introduced a new variable called gammaStar in rasInterFoam. the idea is to implement henrik rusche's phd thesis to smoothen out the interface.

volScalarField gammaStar = 1.0*gamma;

but when i do

fvScalarMatrix gammaStarEqn
(
fvm::laplacian(1.0,gammaStar) == gammaStar+gamma
) ;


i get the following error


--> FOAM FATAL ERROR : gradientInternalCoeffs cannot be called for a calculatedFvPatchField.
You are probably trying to solve for a field with a calculated or default boundary conditions.

From function calculatedFvPatchField<type>::gradientInternalCoef fs() const
in file fields/fvPatchFields/basicFvPatchFields/calculated/calculatedFvPatchField.H at line 174.

Any help is appreciated.

thanks

Kumar

stefanke July 17, 2006 06:12

You have to specify any bounda
 
You have to specify any boundary conditions for gammaStar otherwise you cannot solve the gammaStarEqn!

The error messages you have reported gave you already a hint what you have to do.

stefanke July 17, 2006 06:14

You have to specify any bounda
 
You have to specify any boundary conditions for gammaStar otherwise you cannot solve the gammaStarEqn!

The error messages you have reported gave you already a hint what is going wrong.

kumar2 July 17, 2006 23:14

Hi Stefan, Thanks a lot for
 
Hi Stefan,

Thanks a lot for pointing out the mistake. I implemented the boundary condition ( ofcourse through a boundary file in /0 and things are working fine.)

Do you know by anychance , how to access the vector d . d is the vector from any cell to its neighbour ?

Thanks for the reply

Kumar

chris1980 July 18, 2006 00:19

I'am not sure but I think you
 
I'am not sure but I think you can use the function directions() from the fvMesh class. Have a look at the member functions of the fvMesh class!

kumar2 July 18, 2006 06:29

Hi chris Thanks for your re
 
Hi chris

Thanks for your reply , as you pointed out directions is indeed a function in fvMesh class. but when i do

volVectorField ddNew = gammaStar.mesh().directions();

i get the following error.

gammaEqn.H:4: error: conversion from ‚const Foam::Vector<foam::label>‚ to non-scalar type ‚Foam::GeometricField<foam::vector,>‚ requested


any ideas ?

kumar

chris1980 July 18, 2006 06:50

I do not know what you are try
 
I do not know what you are trying to do but as you can see in the error message the function directions() returns a 'const Vector<label>&'

kumar2 July 18, 2006 07:07

Hi Chris what i want to do
 
Hi Chris

what i want to do is solve this equation which is

laplacian(A,gammaStar)=gammaStar + gamma

where A = 0.25/(mag(d))^2 . here d is defined as the vector between the centre of the cell of interest P and the centre of a neighbouring cell N. gammaStar is for smoothening gamma , which is the volume fraction. ( this formulation is in henrik rusche's thesis)

i need to access 'd' but not sure how. my C++ skills are pretty poor. as you can see i am still stuck. can you think of an alternate way of accessing 'd'.

thanks

kumar

chris1980 July 18, 2006 07:11

May be I get you wrong but a c
 
May be I get you wrong but a cell might have more than one neighbour?

kumar2 July 18, 2006 07:26

You are totally right. But i f
 
You are totally right. But i feel the 'd' is similar to Sf. just as each cell can have as many Sf as there are faces , it can also have as many 'd' s

But i am not sure how to include this idea into laplacian given in henrik's phd. let me also give you his equation:

div.( 0.25/|d|^2 grad[gammaStar] ) = [gammaStar] +gamma

maybe i am totally wrong in my approach , but i would love to hear from you

thanks again chris
kumar

stefanke July 18, 2006 08:01

Ok I have looked into Hendrik'
 
Ok I have looked into Hendrik's thesis and I assume you want to solve Eqn (4.16).
You do not discretise the laplacian operator directly instead you are applying Gauss' theorem. So in theory you have to come up with the face gradients of gammaStar and the vector between the cell center and the cell center of the neighbouring cell for each face of the cell of interest.

What you need to do is to construct a surfaceVectorField containing the desired cell center connection vectors for each face.

kumar2 July 19, 2006 06:06

Hi Stefan, Many thanks for
 
Hi Stefan,

Many thanks for your reply. i have been desperately looking for a function to find cell centre connection vectors . i came across ( what i think ) will do the job . i got this function from /interpolations . Could you please take a look at the function and the following errors.

const volVectorField& cellCentres = mesh.C();
const unallocLabelList& owner = mesh.owner();
const unallocLabelList& neighbour = mesh.neighbour();

forAll (owner, faceI)
{

const vector& dist = cellCentres[neighbour[faceI]] - cellCentres[owner[faceI]];
}
[ all ok till here ! ]

But when i assign

surfaceVectorField New = dist

i get this error:

error: dist was not declared in this scope

Hoping to hear from you .

Kumar

kumar2 July 19, 2006 23:55

Hi Stefan , I think i got a
 
Hi Stefan ,

I think i got a better function for 'd' ( which is the vector from any cell centre to its neighbour ) . got this function from Co.C

mesh.surfaceInterpolation::deltaCoeffs() . This seems to be 1/mag(d). Is this correct?

Thanks

Kumar

chris1980 July 20, 2006 02:14

I don't know. Look at the impl
 
I don't know. Look at the implementation of deltaCoeffs() and you know if you are right!


to calculate the connection vector you can do something like this:

forAll(owner, faceI)
{
d[faceI] = cellCentres[neighbour[faceI]] - cellCentres[owner[faceI]];
}

kumar2 July 20, 2006 15:33

Hi chris as you suggested i
 
Hi chris

as you suggested i went back and took a look at the deltaCoeffs . turs out they are derived from a loop similar to what you have. which makes me think it is correct.

thanks a lot to chris and stefan for helping me out here. i really appreciate the support. good luck to both of you

kumar

kumar2 July 20, 2006 21:20

Hi Stefan i am still stuck
 
Hi Stefan

i am still stuck with equation 4.16

Stefan said>
Ok I have looked into Hendrik's thesis and I assume you want to solve Eqn (4.16).
You do not discretise the laplacian operator
directly instead you are applying Gauss' theorem

Are you saying that i should split the laplacian into a div.grad . but both div and grad are explicit. is this not a problem

thanks

kumar


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