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

What does setOriented() do?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2019, 09:54
Post What does setOriented() do?
  #1
New Member
 
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9
Jesper_Roland is on a distinguished road
Hi everyone,


When constructing a field like surface field of Type like the following:

Code:
    // construct GeometricField<Type, fvsPatchField, surfaceMesh>
    tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfieldFlux
    (
        new GeometricField<Type, fvsPatchField, surfaceMesh>
        (
            IOobject
            (
                "flux("+psi_.name()+')',
                psi_.instance(),
                psi_.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            psi_.mesh(),
            dimensions()
        )
    );
    GeometricField<Type, fvsPatchField, surfaceMesh>& fieldFlux = tfieldFlux.ref();
I see the following line of code right after the construct of the field:

Code:
    fieldFlux.setOriented();
What are we specifying should be oriented here, and with respect to what?



Kind regards,


Jesper Qwist
Jesper_Roland is offline   Reply With Quote

Old   December 4, 2019, 12:43
Default
  #2
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15
einstein_zee is on a distinguished road
Hii there,

I just looked at it out of curiosity and it seems this function only exists in ESI version of OF and not the foundation one. But you may look in https://www.openfoam.com/documentati...8H_source.html to see what it does. But the description says it all "Given point flip all faces such that normals point in same direction."
You may look at member functions section to see what and how it does.
Code:
static bool orient(triSurface&, const point&, const bool orientOutside);
static bool orient
         (
             triSurface& s,
             const triSurfaceSearch& querySurf,
             const point& samplePoint,
             const bool orientOutside
         );
einstein_zee is offline   Reply With Quote

Old   December 5, 2019, 04:24
Default
  #3
New Member
 
Jesper R. K. Qwist
Join Date: Dec 2017
Posts: 22
Rep Power: 9
Jesper_Roland is on a distinguished road
Thank you for your reply.



It did however clarify the question for me. The suggested code relates to triSurfaces. I do not think this is where we need to look for this case.



I think the setOriented() function used here is the one defined in the class orientedType, which has the Detailed description: "Class to determine the 'oriented' status of surface fields."



Link to the class:

https://www.openfoam.com/documentati...e.html#details


To me it seems that it controls shift in direction caused by one of the mathematical operations defined in the class orientedType.


Still I do not understand when I would need this to be true or false.


Best Regards,


Jesper Qwist
Jesper_Roland is offline   Reply With Quote

Old   December 5, 2019, 06:45
Default
  #4
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 94
Rep Power: 15
einstein_zee is on a distinguished road
yeah I knew the link you sent me and you are right partially, cause the final function which is called is the setOriented in orientedType (the link you provided). but the problem is looking into it, would not help you at all cause orientedType is only the tool to achieve sth. And that sth should be sought in regions where this type is used . It is used in dimensionedFields and if you trace it further you would end up with the link I provided.
einstein_zee is offline   Reply With Quote

Old   June 28, 2020, 05:54
Default
  #5
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Jesper_Roland View Post
Hi everyone,

When constructing a field like surface field of Type like the following:...I see the following line of code right after the construct of the field:

Code:
    fieldFlux.setOriented();
What are we specifying should be oriented here, and with respect to what?

This has nothing to do with triSurface mesh orientation. Here is some information that I found (private communication):


Quote:

We introduced the oriented flag for surface fields to discriminate between flux fields that are oriented, i.e. where the sign depends on owner->nbr connectivity, and plain interpolated fields, e.g. pressure on faces.
If you apply a field operation that includes the area vector field Sf() the resultant field becomes oriented; similarly, taking, e.g. the mag() of an oriented field makes it 'unoriented'. The rules applied when dealing with [un]oriented fields also gives us an extra layer of protection/verification that the mathematics is consistent.
If the field is constructed without using field operations and it is a flux field, you should set the oriented type to true.

bharat_aero, missios and saladbowl like this.
olesen is offline   Reply With Quote

Reply

Tags
geometricfield, orientation, setoriented, setoriented()


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



All times are GMT -4. The time now is 18:25.