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

Type conversion question

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 15, 2011, 03:33
Default Type conversion question
  #1
Member
 
Yuri Feldman
Join Date: Mar 2011
Posts: 30
Rep Power: 5
feldy77 is on a distinguished road
Dear forum,
I need to compare the value of z coordinate of my boundary mesh with some variable, let say of a double or scalar type

scalar min=10.0;
forAll (ccSph.boundaryField(), patchI)
{
ccSph.boundaryField()[patchI] = sph.localVector(mesh.C().boundaryField()[patchI]);
if (ccSph.boundaryField()[patchI].component(vector::Z)>max) {do something };
}
Unfortunately this code does not pass compilation, since the first argument in if return reference to a surface field. How can I circumvent the problem? Is there any standard way of type conversion in OpenFoam.
Many thanks, Yuri
feldy77 is offline   Reply With Quote

Old   December 15, 2011, 03:50
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
Hi Yuri

You are comparing a scalarField with a scalar, which does not make much sense. Instead, you should loop over the scalarField and make the comparison one boundary face at the time.

Best regards,

Niels
ngj 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
CGNS converters available mbeaudoin OpenFOAM Meshing & Mesh Conversion 123 April 9, 2013 09:53
Fluent3DMeshToFoam simvun OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 48 May 14, 2012 05:20
cgnsToFoam problems with "QUAD_4" cells lentschi OpenFOAM Meshing & Mesh Conversion 1 March 9, 2011 04:49
compilation problem with "fvPatch::lookupPatchField" Ya_Squall2010 OpenFOAM Programming & Development 4 May 25, 2010 09:29
boundary conditions for simpleFoam calculation foam_noob OpenFOAM Running, Solving & CFD 7 March 3, 2010 20:17


All times are GMT -4. The time now is 12:43.