CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Reading values of internal faces

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2009, 05:17
Default Reading values of internal faces
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello World.

I need to read the values on some internal faces.
I thought of interpolating the volume field to the surfaces with e.g.
surfaceScalarField s = fvc::interpolate(p)

After this step I want to read the center value of the surface field for a set of specific faces I declared in faceSet.

How can I access this information?

Thanks.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 10, 2009, 03:17
Default
  #2
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
Check how large your surfaceScalarField is (ie, how many faces it has).
Access the ones you want.
olesen is offline   Reply With Quote

Old   July 10, 2009, 03:22
Default
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Quote:
Originally Posted by olesen View Post
Access the ones you want.
How can I do that?
I don't know the code!

Furthermore: how can I loop through I set of faces I selected with faceSet prior?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 10, 2009, 03:46
Default
  #4
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 sega View Post
How can I do that?
I don't know the code!

Furthermore: how can I loop through I set of faces I selected with faceSet prior?
A faceSet is essentially a labelHashSet, you thus have all the usual methods as per HashSet. There are plently of places in the code that use some form of HashSet.
The command "git grep HashSet" is a quick way to find them all.
olesen is offline   Reply With Quote

Old   July 19, 2009, 09:16
Default
  #5
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello World.

No that it comes to the implementation of this internal field reading stuff I'm experiencing strange errors with a very simple tryout.

This is the code:
Code:
    for (label i=startTime; i<endTime; i++)
    {

    runTime.setTime(Times[i], i);
        Info<< "Time = " << runTime.timeName() << endl;

    // Reading field  p
    volScalarField p
    (
        IOobject
        (
        "p",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
        ),
        mesh
    );

    //Create face values from field values
    surfaceScalarField ps = fvc::interpolate(p);
   
    Info<< "face value on face 61103"<< ps[61103]<< endl;
    }
which compiles smoothly. But when hitting the case this is the message:

Code:
Attempt to cast type patch to type lduInterface#0  Foam::error::printStack(Foam::Ostream&) in "/home/sega/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::error::abort() in "/home/sega/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  Foam::Ostream& Foam::operator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) in "/home/sega/OpenFOAM/sega-1.5/applications/bin/linux64GccDPOpt/listFaceSet"
#3  Foam::lduInterface const& Foam::refCast<Foam::lduInterface const, Foam::fvPatch const>(Foam::fvPatch const&) in "/home/sega/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#4  Foam::cyclicFvPatchField<double>::cyclicFvPatchField(Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/sega/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#5  Foam::fvPatchField<double>::adddictionaryConstructorToTable<Foam::cyclicFvPatchField<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&,Foam::dictionary const&) in "/home/sega/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libfiniteVolume.so"
#6  Foam::fvPatchField<double>::New(Foam::fvPatch const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/sega/OpenFOAM/sega-1.5/applications/bin/linux64GccDPOpt/listFaceSet"
#7  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::GeometricBoundaryField(Foam::fvBoundaryMesh const&, Foam::DimensionedField<double, Foam::volMesh> const&, Foam::dictionary const&) in "/home/sega/OpenFOAM/sega-1.5/applications/bin/linux64GccDPOpt/listFaceSet"
#8  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::readField(Foam::Istream&) in "/home/sega/OpenFOAM/sega-1.5/applications/bin/linux64GccDPOpt/listFaceSet"
#9  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/home/sega/OpenFOAM/sega-1.5/applications/bin/linux64GccDPOpt/listFaceSet"
#10  main in "/home/sega/OpenFOAM/sega-1.5/applications/bin/linux64GccDPOpt/listFaceSet"
#11  __libc_start_main in "/lib/libc.so.6"
#12  _start at /build/buildd/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:116


    From function refCast<To>(From&)
    in file /home/dm2/henry/OpenFOAM/OpenFOAM-dev/src/OpenFOAM/lnInclude/typeInfo.H at line 106.

FOAM aborting
Which looks very strange to me, as there is something about cyclic patches, which are not involved in this case...

Any ideas?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 19, 2009, 11:24
Default
  #6
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Stupid. There were cyclics involved. Who put them there?
Must have been me...
Sorry.

So far it's working, but I bet I'm coming back ...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 29, 2017, 22:09
Default
  #7
Member
 
Sugajen
Join Date: Jan 2012
Location: Tempe, USA
Posts: 52
Rep Power: 14
Sugajen is on a distinguished road
Hi all,

I am trying to access and modify a field value on a face using this code
Code:
//Create face values from field values
surfaceScalarField ps = fvc::interpolate(p);
But getting an error,
Code:
error: assignment of read-only location
Is it possible to access and change internal face values of a cell in OpenFOAM?

Thanks,
Sugajen
Sugajen 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
[Commercial meshers] Problem converting fluent mesh vinz OpenFOAM Meshing & Mesh Conversion 28 October 12, 2015 07:37
[Commercial meshers] Converting a mesh with splitted cells using fluentMeshToFoam jlpelerin OpenFOAM Meshing & Mesh Conversion 4 April 25, 2011 17:56
DecomposePar unequal number of shared faces maka OpenFOAM Pre-Processing 6 August 12, 2010 10:01
[Commercial meshers] TGridFluent mesh with internal by prism layer and internal face for diagnostic sponiar OpenFOAM Meshing & Mesh Conversion 2 March 30, 2009 16:02
Unaligned accesses on IA64 andre OpenFOAM 5 June 23, 2008 11:37


All times are GMT -4. The time now is 17:53.