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

Individual element of a symmetric matrix

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2019, 07:26
Default Individual element of a symmetric matrix
  #1
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
Hello,

I would like to know how to extract the xy element from the strain rate tensor:

Quote:
volSymmTensorField S = symm(fvc::grad(U()));
Could someone help me write the code? How would I call the extracted element in an equation (epsilon equation for example)?
gu1 is offline   Reply With Quote

Old   January 9, 2019, 13:31
Default
  #2
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
I wrote this snippet of code:

Code:
    Dxy_
    (
        IOobject
        (
            IOobject::groupName("Dxy", U.group()),
            runTime_.timeName(),
            mesh_,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        //symm(fvc::grad(U))().component(symmTensor::XY)
        U.mesh(),
	dimensionSet(0, 0, -1, 0, 0, 0, 0)
    ),

    volSymmTensorField D = symm(gU);    
    
    forAll(D, i)
    {
    	Dxy_[i] = D[i].xy();
    }
...and I succeeded in what I wanted.
Unfortunately, however, the gradient of xy on the wall is giving zero and this causes the solver to give a floating-point error.

log: LINK

Could someone help me with how to solve this problem?
gu1 is offline   Reply With Quote

Old   January 10, 2019, 11:51
Default
  #3
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
Anyone can help?
gu1 is offline   Reply With Quote

Old   January 11, 2019, 06:32
Default
  #4
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


Add a little number (for example SMALL) to it so you can avoid the division with zero.
simrego is offline   Reply With Quote

Old   January 11, 2019, 07:04
Default
  #5
gu1
Senior Member
 
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10
gu1 is on a distinguished road
Quote:
Originally Posted by simrego View Post
Hi!

Add a little number (for example SMALL) to it so you can avoid the division with zero.
But the problem is not this ... if I use another method, it extracts values on the wall, that is, it is missing a piece in the code that guarantees the calculation of the value of the gradient on the wall.
gu1 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
[Gmsh] 3D Mesh conversion from gmsh-2.5.0 to OpenFOAM Ancioi OpenFOAM Meshing & Mesh Conversion 17 January 8, 2019 23:50
Identifying Markers in a CGNS Mesh tjim SU2 3 October 12, 2018 01:21
[Other] Mesh Importing Problem cuteapathy ANSYS Meshing & Geometry 2 June 24, 2017 05:29
autoPatch error, mesh quality related...? Alexvader OpenFOAM 0 October 6, 2011 17:57
OpenFOAM version 1.6 details lakeat OpenFOAM Running, Solving & CFD 42 August 26, 2009 21:47


All times are GMT -4. The time now is 01:20.