|
[Sponsors] |
How to create a vector field out of scalar fields |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 6, 2006, 15:37 |
Hi all,
does someone know h
|
#1 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
April 7, 2006, 11:45 |
But something like that does n
|
#2 |
Member
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17 |
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 |
|
April 7, 2006, 17:20 |
You're trying to combine two s
|
#3 |
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. |
|
April 8, 2006, 12:15 |
probably do it like that. Defi
|
#4 |
Senior Member
Markus Hartinger
Join Date: Mar 2009
Posts: 102
Rep Power: 17 |
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]); } |
|
May 31, 2006, 04:20 |
Hi, is there a command for edi
|
#5 |
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 |
|
May 31, 2006, 05:48 |
Not as far as I know, you'll h
|
#6 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
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) |
|
May 31, 2006, 07:35 |
Thanks for your answer,
Wit
|
#7 |
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 |
|
May 31, 2006, 12:56 |
Yup, just use faceCells - that
|
#8 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Paraview Vector Field | simone Marras | ParaView | 2 | April 3, 2013 07:34 |
Convective schemes for vector fields | edoardo | OpenFOAM Running, Solving & CFD | 6 | February 16, 2009 12:05 |
Initializing vector field | gorgeta | OpenFOAM Post-Processing | 0 | January 9, 2008 12:32 |
How do I define a custom vector field? | MHDWill | FLUENT | 0 | September 29, 2007 18:04 |
ability of fluent to predict scalar fields in reacting flows ? | Mounir | Main CFD Forum | 1 | January 21, 1999 11:08 |