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

How do you extract a component of a tensor

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 8, 2020, 10:15
Post How do you extract a component of a tensor
  #1
New Member
 
王子阳
Join Date: Aug 2019
Posts: 29
Rep Power: 7
wangziyang is on a distinguished road
Hello everyone!

I now have a tensor S, whose type is volSymmTensorField, i try to extract its component "zz", but it had an error.

My corresponding code is as follows:

const volSymmTensorField S = symm(gradU);

const volScalarField Z = S.zz();

And the error is as follows:

DCNM.C: In member function ‘Foam::dimensionedVector Foam::compressible::LESNonlinearModels:CNM::C(co nst volTensorField&) const’:
DCNM.C:83:28: error: ‘const volSymmTensorField’ has no member named ‘zz’
const volScalarField Z = S.zz();

How can I solve this problem? I think this operation is very common.

best wishes!

ziyang
wangziyang is offline   Reply With Quote

Old   October 8, 2020, 10:17
Default
  #2
Member
 
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10
frobaux is on a distinguished road
I just came by this post with a file open at this line:
Code:
    

volScalarField Udx(Ud.component(vector::X));
Is this what you are looking for?


Edit:
Oh sorry I read to fast, you are looking for a tensor component, maybe an adaptation of this then. Found this with a grep

Code:
finiteVolume/lnInclude/eddy.C:286:    const vector axisDir = tensor::I.vectorComponent(dir1_);
frobaux is offline   Reply With Quote

Old   October 11, 2020, 23:39
Smile
  #3
New Member
 
王子阳
Join Date: Aug 2019
Posts: 29
Rep Power: 7
wangziyang is on a distinguished road
Quote:
Originally Posted by frobaux View Post
I just came by this post with a file open at this line:
Code:
    

volScalarField Udx(Ud.component(vector::X));
Is this what you are looking for?


Edit:
Oh sorry I read to fast, you are looking for a tensor component, maybe an adaptation of this then. Found this with a grep

Code:
finiteVolume/lnInclude/eddy.C:286:    const vector axisDir = tensor::I.vectorComponent(dir1_);
Hi frobaux

Thank you very much!

This is the code I want!! My model now runs very stable.

best wishes!

ziyang
wangziyang 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
OpenFOAM extended 4.0 Error with Multinode Set-up Liweix OpenFOAM Running, Solving & CFD 1 February 18, 2020 01:50
wmake libso error while compiling library for dynamic mesh Naveed Salman OpenFOAM Programming & Development 3 August 28, 2017 21:53
extract certain vector component while OF is running ngcw1986 OpenFOAM Running, Solving & CFD 0 August 4, 2012 04:13
how to extract vector from tensor ? Cyp OpenFOAM Programming & Development 6 March 3, 2011 08:47
sampling a strain-rate tensor single component vkrastev OpenFOAM Post-Processing 0 March 2, 2010 08:21


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