create volTensorField from volScalarField
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? |
You could always set each value explicitly; e.g.
Code:
forAll(T,cellI) Code:
tensor select(1,0,0,1,0,0,0,0,1); Code:
T = a*tensor(1,0,0,1,0,0,0,0,1); |
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. |
Quote:
|
Ok, thanks!
Code:
Cool |
All times are GMT -4. The time now is 13:41. |