CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

tensorField assigning values

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 15, 2015, 01:07
Default tensorField assigning values
  #1
New Member
 
Join Date: Mar 2012
Posts: 29
Rep Power: 14
yanxiang is on a distinguished road
Hello foamers,

I have a variable of the type of tensorField, which I would like to do some operation with:

Code:
tensorField T;
scalarField s(size, 1);

T.component(tensor::XX)() = s;
But the assignment was not successful. I also tried the forAll loop, but still no luck.

Code:
forAll(T.component(tensor::XX)(), i)
{
    T.component(tensor::XX)()[i] = s[i];
}
I was wondering if anyone can give me some hints on how to do the assignment for tensorField.

Thanks,
yanxiang
yanxiang is offline   Reply With Quote

Old   January 15, 2015, 15:06
Default
  #2
New Member
 
Join Date: Mar 2012
Posts: 29
Rep Power: 14
yanxiang is on a distinguished road
OK. I got this figured out.

Code:
forAll(T, i)
{
    T[i] =
        tensor
        (
            s[i], 0, 0,
            0, 0, 0,
            0, 0, 0
        );
}
yanxiang is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 32 June 16, 2021 06:55
Loading Cell Values in Tecplot P1361 OpenFOAM Post-Processing 3 September 16, 2014 04:02
Assigning values to a cartesian grid from a binary image (or stl) Cyp OpenFOAM Pre-Processing 1 August 5, 2014 18:02
cell values vs node values reversemermaid FLUENT 0 March 13, 2014 18:06
Plotting raw data values Wilesco Siemens 0 January 5, 2006 05:34


All times are GMT -4. The time now is 07:59.