CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   boundaryField vs. internalField (http://www.cfd-online.com/Forums/openfoam/83898-boundaryfield-vs-internalfield.html)

sebonator January 14, 2011 08:23

boundaryField vs. internalField
 
Hi there,

maybe this sounds a bit like a stupid question, but the answer is not clear to me:

Can you tell me, what the 'boundaryField', like it is returned for example from a volScalarField by

Code:

volScalarField.boundaryField();
really is? Are those values the values of the cells that are located next to the boundary (=> The very first cells when you move from the patch into your field???) or are those values the values of the faces which lie on the patch?

This makes a difference!

Thanks in advance,
Greetings Sebastian

akidess January 14, 2011 08:42

I'm pretty sure it's the patch value. The near-patch cell values can be read by patchInternalField I think.

sebonator January 14, 2011 09:50

Problem solved!!!
 
Thanks Anton!

Greetings Sebastian

AlmostSurelyRob January 14, 2011 10:45

As suggested above through this construct you can access patch values. You can also reinforce it with an id in a following way
Code:

q.boundaryField()[i]
where i is the ID of your patch as stated in blockMeshDict.

Another example is:
Code:

sum( q.boundaryField()[i] * mesh.Sf().boundaryField()[i] );

which will calculate a surface integral of quantity q on patch i.

Hope that helps.




benk January 14, 2011 11:53

Along the same line of questioning, how can I access the value at a corner of a 2D mesh?

akidess January 17, 2011 05:45

I don't think you can, because values are not stored on vertices. You will have to manually find the corner cell and then interpolate the appropriate face values to get something at the corner.

sebonator January 17, 2011 09:13

Hi Ben,

I don't really know a correct answer for your question, but I doubt that there is a method in volVectorField or volScalarField that returns such a "corner" value.

Maybe you can create the value with some "if"-construct, because such a corner cell would be defined as "a cell that has two different patches on two of her faces". I can't tell a proper implementation, but maybe that's something you can start from!

But as Anton already mentioned, you will have to separate between cell-centre-values and face-centre values.

Hope that helps,
Greetings Sebastian

mirko January 24, 2011 16:25

Quote:

Originally Posted by AlmostSurelyRob (Post 290440)
As suggested above through this construct you can access patch values. You can also reinforce it with an id in a following way
Code:

q.boundaryField()[i]
where i is the ID of your patch as stated in blockMeshDict.

Another example is:
Code:

sum( q.boundaryField()[i] * mesh.Sf().boundaryField()[i] );

which will calculate a surface integral of quantity q on patch i.

Hope that helps.




I am writing a boundary condition (I will use oscillatingFixedValue as guide) in a radiation problem, which calculates Qr (see fvDOM.c). I want to get the patch value using the procedure you describe.

But, how can I get hold of Qr? I am assuming it is a property of the fvDOM object. I'm not sure how to get hold of it in my code.

Thank you,

Mirko

AlmostSurelyRob January 24, 2011 16:48

Quote:

Originally Posted by mirko (Post 291965)
I am writing a boundary condition (I will use oscillatingFixedValue as guide) in a radiation problem, which calculates Qr (see fvDOM.c). I want to get the patch value using the procedure you describe.

But, how can I get hold of Qr? I am assuming it is a property of the fvDOM object. I'm not sure how to get hold of it in my code.

Hello Mirko,

I have no experience with radiation models in OpenFOAM. Also, I am not sure what do you mean by patch value. Do you want to use a value for each face on the patch or just some sort of integral?

In the latter case I believe that the code you're looking for
Code:

dimensionedScalar result =
sum(fvDOMInstance.Qr().boudaryField()[patchIndex] *
mesh.Sf().boundaryField()[patchIndex])

where fvDOMInstance is simply an instance of the fvDOM class.

mirko January 24, 2011 16:53

Quote:

Originally Posted by AlmostSurelyRob (Post 291969)
Hello Mirko,

I have no experience with radiation models in OpenFOAM. Also, I am not sure what do you mean by patch value. Do you want to use a value for each face on the patch or just some sort of integral?

In the latter case I believe that the code you're looking for
Code:

dimensionedScalar result =
sum(fvDOMInstance.Qr().boudaryField()[patchIndex] *
mesh.Sf().boundaryField()[patchIndex])

where fvDOMInstance is simply an instance of the fvDOM class.

Yes, I think that is what I am after. But how to get to the fvDOMinstance? :-)

Thanks,

Mirko

AlmostSurelyRob January 24, 2011 17:43

Right, now I see your problem and I am afraid can't claim any competence in OpenFOAM radiation models.

Perhaps you could look for some hints in

/$FOAMSRC/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField. C

/$FOAMSRC/
thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C

Both of these codes are executing Qr and using fvDOM. Let me know if you find an answer.


All times are GMT -4. The time now is 14:23.