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

scalar points to vectorField

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

Like Tree1Likes
  • 1 Post By niklas

Reply
 
LinkBack Thread Tools Display Modes
Old   January 25, 2012, 20:12
Default scalar points to vectorField
  #1
Senior Member
 
n/a
Join Date: Sep 2009
Posts: 198
Rep Power: 6
deji is on a distinguished road
Hello to all the Foamers all around the world. I have a set of points, x, y, and z coordinates, and I would like to put them into a vectorField. The code that I have written thus far gives me an error message when I try to execute it:

scalar xVSL = 0.8;
vectorField WallCell = mesh.C().boundaryField()[patchK];
scalarField XNearWall = WallCell.component(vector::X)+ xVSL;
scalarField YNearWall = WallCell.component(vector::Y);
scalarField ZNearWall = WallCell.component(vector::Z);
label vectorLength = XNearWall.size();
vectorField positions;
positions.component(vector::X)= XNearWall;
positions.component(vector::Y)= YNearWall;
positions.component(vector::Z)= ZNearWall;


OpenFOAM doesn't like the way I am assigning the positions vectorFIeld, the error states the error is "attempted to assign to a const reference to constant object...

Any thoughts on this?? I have checked the forum, but nothing really near what I need...
deji is offline   Reply With Quote

Old   January 26, 2012, 11:52
Default
  #2
Super Moderator
 
niklas's Avatar
 
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 691
Rep Power: 18
niklas will become famous soon enough
why not write it like this
Code:
vector VSL(0.8, 0, 0);
vectorField positions = mesh.C().boundaryField()[patchK] + VSL;
seems shorter
deji likes this.
niklas is offline   Reply With Quote

Old   January 26, 2012, 12:28
Default
  #3
Senior Member
 
n/a
Join Date: Sep 2009
Posts: 198
Rep Power: 6
deji is on a distinguished road
Hey Niklas. Thanks for the feedback, it works this time...

Cheers,
Deji
deji 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
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 2 November 25, 2012 08:54
Climbing inlet pressure with simpleFoam and directMappedPatches chegdan OpenFOAM Running, Solving & CFD 1 January 2, 2012 19:35
Solving for an additional species CO in coalChemistryFoam N. A. OpenFOAM 1 August 11, 2010 11:52
dieselFoam problem!! vivek070176 OpenFOAM 7 August 4, 2010 15:29
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36


All times are GMT -4. The time now is 11:36.