create volTensorField out of volScalarFields
Hello everybody,
I want to create a volTensorField out of a couple of volScalarFields. The tensor should look (for example) like this JacobiMatrix=(m1, m2+m1, 0, m5*m3, m4, 0, m0, m2/m1, m2). The Moments m0-m5 are defined like this Code:
Info<< "Reading field m0" << endl; For example: Code:
Info<< "Define tensorfield jacobiMatrix" << endl; Code:
jacobiMatrix.component(0) = m1; Quote:
|
You could do a loop over all cells and then compute your components like:
Code:
// const Foam::cellList cells = mesh.cells() Best Regards Jim |
Thanks a lot, it is working.
But I have to write forAll(mesh.cells(),cellI) {... I already read that it's not a good style. But I did not find an answer on the question, how a good style would look like. |
I know this is an old post, but did you (or anyone else) find a more compact solution to this problem? Would be much appreciated!
|
What you're looking for here is the replace() member function:
Code:
jacobiMatrix.replace(0, m0); |
Brilliant, thanks!
|
All times are GMT -4. The time now is 11:56. |