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

How to create a vector field out of scalar fields

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 6, 2006, 14:37
Default Hi all, does someone know h
  #1
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi all,

does someone know how to create a vector field out of scalar fields (concerning user defined bc)? Or anything similar?

here is the problem:
I do have scalar fields for Ux, Uy, Uz and want to create a vector field for the velocity of an inlet. but inlet=vector(Ux Uz Uy) does not work.

thanks
Anja
anja is offline   Reply With Quote

Old   April 7, 2006, 10:45
Default But something like that does n
  #2
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
But something like that does not work:
scalarField Ux = sqrt((s-d*d*a)*(s-d*d*a)/(n_1*n_1 + n_2*n_2))* n_1;
scalarField Uy = sqrt((s-d*d*a)*(s-d*d*a)/(n_1*n_1 + n_2*n_2))* n_2;
scalar Uz = 0.0;
forAll(U.boundaryField()[inletPatchID], faceI)
{
U.boundaryField()[inletPatchID][faceI] = vector(Ux, Uy, Uz);
}

here is the error message:
no matching function for call to 'Foam::Vector<foam::scalar>::Vector(Foam::scalarFi eld&, Foam::scalarField&, Foam::scalar&)'

Do you see the mistake?

regards Anja
anja is offline   Reply With Quote

Old   April 7, 2006, 16:20
Default You're trying to combine two s
  #3
brooksmoses
Guest
 
Posts: n/a
You're trying to combine two scalar fields and one individual scalar into an individual vector. You can't stuff an entire field into a vector.

What you need instead is (I think):

U.boundaryField()[inletPatchID][faceI]
= vector(Ux.boundaryField()[inletPatchID][faceI], Uy.boundaryField()[inletPatchID][faceI], Uz);

That way, you're making the vector out of three individual scalar values.
  Reply With Quote

Old   April 8, 2006, 11:15
Default probably do it like that. Defi
  #4
Senior Member
 
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17
hartinger is on a distinguished road
probably do it like that. Define a function which returns the desired vector with the faceCentre as an argument

vector getInletVector(const vector centre)
{
vector inletVector;

inletVector.x() = centre.x() * ....
inletVector.y() = ....
inletVector.z() = 0.0;

return inletVector;
}

and then call your geometry function like

forAll(U.boundaryField()[inletPatchID], faceI)
{
U.boundaryField()[inletPatchID][faceI] =
getInletVector(mesh.boundaryMesh[inletPatchID].faceCentres()[faceI]);
}
hartinger is offline   Reply With Quote

Old   May 31, 2006, 03:20
Default Hi, is there a command for edi
  #5
newbee
Guest
 
Posts: n/a
Hi, is there a command for editing the outermost cells that are next to a specific patch without having to loop throu a cell index?

Thanks
/Erik
  Reply With Quote

Old   May 31, 2006, 04:48
Default Not as far as I know, you'll h
  #6
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
Not as far as I know, you'll have to get the patchCells and work your way through them.

(I assume with editing you mean changing the value)
mattijs is offline   Reply With Quote

Old   May 31, 2006, 06:35
Default Thanks for your answer, Wit
  #7
newbee
Guest
 
Posts: n/a
Thanks for your answer,

With editing I actually ment setting a value that will be constant and uniform for the whole celllayer.

I found the following entry on cellFace on the forum that might help me:

" If you want lots of faces and cells, go onto the boundary patch and as for faceCells(), which gives you cells on the inside of the patch. This is good if you want to do lots of them, but if you only want one face of one cell, that would involve search, which is not good.

This would look something like:

const fvPatchVectorField& patchU = U.boundaryField()[patchI];

const labelList::subList fc = patchU.patch().faceCells();
"

/Erik
  Reply With Quote

Old   May 31, 2006, 11:56
Default Yup, just use faceCells - that
  #8
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Yup, just use faceCells - that gives you the cell index hext to a patch face.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] Paraview Vector Field simone Marras ParaView 2 April 3, 2013 06:34
Convective schemes for vector fields edoardo OpenFOAM Running, Solving & CFD 6 February 16, 2009 11:05
Initializing vector field gorgeta OpenFOAM Post-Processing 0 January 9, 2008 11:32
How do I define a custom vector field? MHDWill FLUENT 0 September 29, 2007 17:04
ability of fluent to predict scalar fields in reacting flows ? Mounir Main CFD Forum 1 January 21, 1999 10:08


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