Question: How to vectorField & dimensionedVector?
So, I was wondering how to do the inner product between a dimensionedVector and a vectorField other than looping directly over the vectorField itself.
|
Did you try just using "&" operator.
I've used it and I get the expected values as if I dot the vector by each vector in the vector field. Here is the code: Code:
object U; Code:
dimensionedVector v1 ("v1", dimVelocity, vector (0.2, 0.3, 0.4)); Code:
dimensions [0 1 -1 0 0 0 0]; Code:
outlet |
Not so fast...
Hi @me.ouda
Well, I though so as well, that the & operator should be overloaded. But the thing is that my vectorField is not a volVectorField, but rather is over a patch. When I do the operation, the compiler throws a type-cast error. Ok, to be precise let me show what I'm trying to do: Code:
|
Quote:
Extracting the non-dimensional value should work too: Code:
topPatchVelocity = momentumDensityRatio.value() & topPatchVelocity; |
Quote:
Code:
setDirichlet.H: In function ‘int main(int, char**)’: |
I kind of forgot my lessons on Tensor Analysis... Sorry
Guys, I saw what the problem was: I was doing the contraction of two vector, and I needed a linear application on a vector (to scale it of course). I changed the scaling term to a dimensionedTensor and everything runs smoothly. Now I'll run the code and see what comes out.
Thanks |
All times are GMT -4. The time now is 18:57. |