|
[Sponsors] |
November 11, 2010, 07:27 |
create volTensorField from volScalarField
|
#1 |
Senior Member
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 16 |
Hi does anyone have an idea how to create a volTensorField from volScalarField.
For instance I have volScalarField a and want to create the following volTensorField: random example: [a , 0 ,0, a, 0 ,0, 0, 0, a] How do I program this? |
|
November 12, 2010, 11:19 |
|
#2 |
Senior Member
David Boger
Join Date: Mar 2009
Location: Penn State Applied Research Laboratory
Posts: 146
Rep Power: 17 |
You could always set each value explicitly; e.g.
Code:
forAll(T,cellI) { T[cellI].xx() = a[cellI]; } Code:
tensor select(1,0,0,1,0,0,0,0,1); T = a*select; Code:
T = a*tensor(1,0,0,1,0,0,0,0,1);
__________________
David A. Boger |
|
November 15, 2010, 04:23 |
|
#3 |
Senior Member
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 16 |
Hi David,
no I solved it like this: volTensorField T ( IOobject ( "Transform", runTime.timeName(), mesh //IOobject::NO_READ //IOobject::NO_WRITE ), mesh, tensor(0,0,0,0,0,0,0,0,0) ); T=tensor(0,0,0,0,0,0,1,0,0)+(tensor(0,-1,0,0,0,0,0,0,0)*sin(theta))+(tensor(0,0,1,0,0,0,0 ,0,0)*cos(theta))+(tensor(0,0,0,0,-1,0,0,0,0)*cos(theta))+(tensor(0,0,0,0,0,-1,0,0,0)*sin(theta)); T.write(); Where theta is a volScalarField. So there really is no constructor which can handle volScalarFields as an argument I guess. P.S. How do I post code like you? Couldn't find how to do it but it looks more nice. |
|
November 16, 2010, 03:22 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
If you are posting with the WYSIWYG forum editor, use the '#' from the toolbar. This wraps "[ CODE ]" ... "[/ CODE ]" tags around the selected text, but of course without the spaces that I've need to add in order to post it.
|
|
November 16, 2010, 04:16 |
|
#5 |
Senior Member
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 16 |
Ok, thanks!
Code:
Cool |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to create initiate a volScalarField p without reading from disk NO_READ does not seem to work | dbxmcf | OpenFOAM Running, Solving & CFD | 14 | March 25, 2022 07:08 |
how to create a volScalarField of mesh.V() ??? | sebware | OpenFOAM Programming & Development | 12 | June 25, 2019 04:34 |
Actuator disk model | audrich | FLUENT | 0 | September 21, 2009 08:06 |
Where's the singularity/mesh flaw? | audrich | FLUENT | 3 | August 4, 2009 02:07 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |