CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Assigning a component of a volTensorField a particular value (https://www.cfd-online.com/Forums/openfoam-programming-development/239783-assigning-component-voltensorfield-particular-value.html)

backscatter November 23, 2021 15:27

Assigning a component of a volTensorField a particular value
 
Hi,

Is there any elegant way to manually assign one component of a volTensorField a particular value? Let's say we have to replace the (1,1) component of the tensor field by zero, how would you elegantly get this done?

mAlletto November 24, 2021 09:13

https://www.openfoam.com/documentati...1_1Tensor.html

you can assess the (1,1) via the xx() function.

s1291 November 24, 2021 13:14

Quote:

Originally Posted by backscatter (Post 817208)
Hi,

Is there any elegant way to manually assign one component of a volTensorField a particular value? Let's say we have to replace the (1,1) component of the tensor field by zero, how would you elegantly get this done?


if T is tensor, you can access its components via:

Code:

T.xx();
T.xy();
T.xz();
...
// etc.

You can also assign values to the components, e.g:

Code:

T.xx() = 5.0;
T.xy() = -99.0;
...
//etc



All times are GMT -4. The time now is 14:37.