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

operator for creating squared components of a tensor

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 8, 2014, 08:45
Question operator for creating squared components of a tensor
  #1
New Member
 
Blaž Mikuž
Join Date: Sep 2011
Location: Ljubljana
Posts: 29
Rep Power: 13
bmikuz is on a distinguished road
Hi!

I need a simple operator which works on a tensor and calculates another tensor with squared components (a_{ij} -> (a_{ij})^2). Is there already an operator, which does that in OF?

I've tried an outer product (gradU*gradU):
Code:
tmp<volTensorField> S2(const tmp<volTensorField>& gradU) const
        {
        return (gradU * gradU);
        }
but it seems not to be defined on tensors since compiling produces:
Code:
error: no match for ‘operator*’ in ‘gradU * gradU’
Than I tried also sqr(gradU), but compiling says
Code:
error: no matching function for call to ‘sqr(const Foam::tmp<Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh> >&)’
Any help would be appreciated. THX!

Blaz
bmikuz is offline   Reply With Quote

Old   December 10, 2014, 10:24
Default
  #2
New Member
 
Blaž Mikuž
Join Date: Sep 2011
Location: Ljubljana
Posts: 29
Rep Power: 13
bmikuz is on a distinguished road
I may not be clear enough. I need to create a new volTensorField, which tensor's elements are squared tensor elements of gradU field (gradU is also a volTensorField typedef):
PHP Code:
gradU[cellI] =  ( abcdefgh
newTensor[cellI] = ( a^2b^2c^2d^2e^2f^2g^2h^2i^
Now, I realized that there is no existent operation on volTensorField, which could directly produce such a result.

So, my idea is to define a new operation among volTensorField objects, which would directly produce required new volTensorField. Is this easy to implement or not? What do you suggest?

Thanks!
Blaz
bmikuz is offline   Reply With Quote

Old   January 10, 2019, 06:56
Default
  #3
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 181
Rep Power: 7
gu1 is on a distinguished road
Quote:
Originally Posted by bmikuz View Post
I may not be clear enough. I need to create a new volTensorField, which tensor's elements are squared tensor elements of gradU field (gradU is also a volTensorField typedef):
PHP Code:
gradU[cellI] =  ( abcdefgh
newTensor[cellI] = ( a^2b^2c^2d^2e^2f^2g^2h^2i^
Now, I realized that there is no existent operation on volTensorField, which could directly produce such a result.

So, my idea is to define a new operation among volTensorField objects, which would directly produce required new volTensorField. Is this easy to implement or not? What do you suggest?

Thanks!
Blaz
Is this possible to do?
gu1 is offline   Reply With Quote

Old   January 13, 2019, 22:09
Default
  #4
Senior Member
 
zhangyan's Avatar
 
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 10
zhangyan is on a distinguished road
cmptMultiply(gradU,gradU)?
__________________
https://openfoam.top
zhangyan is offline   Reply With Quote

Reply

Tags
component, operator, square, tensor

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
tensor components LM4112 OpenFOAM Post-Processing 0 June 17, 2013 11:02
Accessing the components of the resolved Reynolds stress tensor in a LES flotus1 FLUENT 8 January 21, 2013 03:34
Problems compiling with the 'diag' tensor function (diagonal components matrix) danihuso OpenFOAM Programming & Development 12 January 31, 2012 10:45
Strain-rate tensor components vkrastev OpenFOAM 2 March 2, 2010 02:39
Stress tensor components ap FLUENT 0 February 26, 2004 12:16


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