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

How to evaluate a surfaceScalarField face by face?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 15, 2013, 15:25
Default How to evaluate a surfaceScalarField face by face?
  #1
New Member
 
Zheng.Zhi
Join Date: Jul 2009
Location: Beijing China
Posts: 9
Rep Power: 8
Zheng.Zhi is on a distinguished road
rhoPhi is defined as

surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.timeName(),
mesh
),
dimensionedScalar("0",dimensionSet(1,0,-1,0,0),0)
);

and it is updated after alphaEqn solved.

Now I want to create a new surfaceScalarField rhoPhi2 ,which is a function of rhoPhi, so I define

surfaceScalarField rhoPhi2
(
IOobject
(
"rhoPhi2",
runTime.timeName(),
mesh
),
dimensionedScalar("0",dimensionSet(1,0,-1,0,0),0)
);

and evaluate rhoPhi2 face by face :

forAll (rhoPhi2 , facei)
{
rhoPhi2[facei] = rhoPhi[facei];
}

but it doesn't work as same as

rhoPhi2 = rhoPhi;

Is there any mistake in my testing code? And How to evaluate a surfaceScalarField face by face?

Thanks!
Zheng.Zhi is offline   Reply With Quote

Old   July 15, 2013, 18:03
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
Have a look at what operator= does for fields in GeometricField.C

You need to also loop over boundaries. I would question why you need to loop though.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Reply

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
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00
Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 July 15, 2005 04:15


All times are GMT -4. The time now is 22:20.