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

Exporting normal vectors of faces as surfaceVectorFields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 23, 2023, 10:54
Default Exporting normal vectors of faces as surfaceVectorFields
  #1
New Member
 
Join Date: Dec 2021
Posts: 27
Rep Power: 5
finn_amann is on a distinguished road
Hello friends,

I want to export the normal vectors of all faces as surfaceVectorField. Since I couldn't find any functionObjects that allow me to do so, I followed some basic direction that was suggested on this forum (About extracting the normals to faces on a patch).

The advice was to modify the function object writeCellCentres and that works out pretty well so far. The following code is a modification of the write-function of the mentioned function object.

Code:
bool Foam::functionObjects::writeSurfaceNormalVectors::write()
{

     surfaceVectorField nv
     (
         IOobject
         (
             "NormalVectors",
             time_.timeName(),
             mesh_,
             IOobject::READ_IF_PRESENT,
             IOobject::AUTO_WRITE
         ),
         mesh_.Sf()
     );

     Log << type() << " " << name() << " write:" << nl
         << "    writing normal vectors field " << nv.name()
         << " to " << time_.timeName() << endl;

      nv.write();
}
This way I get the normal vectors as a surfaceVectorField in my timestep folders. The files look as I imagine they should and contain the vectors.
However, when I use utilities like reconstructPar or foamToVTK -faceZones aNiceFaceZone which access these newly generated files, I get the following error:

Code:
--> FOAM FATAL ERROR: (openfoam-2206)
Not implemented

    From Foam::slicedFvsPatchField<Type>::slicedFvsPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::surfaceMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
    in file fields/fvsPatchFields/basic/sliced/slicedFvsPatchField.C at line 68.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::simpleExit(int, bool) at ??:?
#2  Foam::slicedFvsPatchField<Foam::Vector<double> >::slicedFvsPatchField(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::surfaceMesh> const&, Foam::dictionary const&) at ??:?
#3  Foam::fvsPatchField<Foam::Vector<double> >::adddictionaryConstructorToTable<Foam::slicedFvsPatchField<Foam::Vector<double> > >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::surfaceMesh> const&, Foam::dictionary const&) at ??:?
#4  Foam::fvsPatchField<Foam::Vector<double> >::New(Foam::fvPatch const&, Foam::DimensionedField<Foam::Vector<double>, Foam::surfaceMesh> const&, Foam::dictionary const&) at ??:?
#5  Foam::GeometricBoundaryField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>::readField(Foam::DimensionedField<Foam::Vector<double>, Foam::surfaceMesh> const&, Foam::dictionary const&) at ??:?
#6  Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>::readFields(Foam::dictionary const&) at ??:?
#7  Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>::readFields() at ??:?
#8  Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&, bool) at ??:?
#9  Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::fvFieldReconstructor::reconstructSurfaceField<Foam::Vector<double> >(Foam::IOobject const&) const at ??:?
#10  int Foam::fvFieldReconstructor::reconstructSurfaceFields<Foam::Vector<double> >(Foam::UPtrList<Foam::IOobject const> const&) at ??:?
#11  Foam::fvFieldReconstructor::reconstructAllFields(Foam::IOobjectList const&, Foam::wordRes const&) at ??:?
#12  ? in ~/OpenFOAM/OpenFOAM-v2206/platforms/linux64GccDPInt32Opt/bin/reconstructPar
#13  ? in /lib/x86_64-linux-gnu/libc.so.6
#14  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#15  ? in ~/OpenFOAM/OpenFOAM-v2206/platforms/linux64GccDPInt32Opt/bin/reconstructPar
 Aborted (core dumped)
I know there are other ways to get the normal vectors, e.g. export the components of the vectors individually as surfaceScalarFields and combine them afterwards in ParaView, etc., but I just really wanna know why the way described above is not working. Do the utilities mentioned above maybe not handle surfaceVectorFields? If I write out the components as surfaceScalarFields, it works.

Best regards,
Finn

Last edited by finn_amann; February 24, 2023 at 04:03.
finn_amann is offline   Reply With Quote

Reply

Tags
error, export, surfacevectorfield, vtk


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
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface Kryo OpenFOAM Meshing & Mesh Conversion 13 February 17, 2022 08:34
decomposePar -allRegions stru OpenFOAM Pre-Processing 2 August 25, 2015 04:58
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 09:14
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57


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