|
[Sponsors] |
About extracting the normals to faces on a patch |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 14, 2014, 10:32 |
About extracting the normals to faces on a patch
|
#1 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear All,
I am studying the flow around an airfoil. The point is that I am interested in saving a file containing the normal vectors to the faces on the patch "airfoil". Do you know how I can get this? Thanks a lot, Samuele |
|
March 14, 2014, 14:07 |
|
#2 |
Member
Hannes
Join Date: Apr 2009
Location: Schleswig, Germany
Posts: 38
Rep Power: 17 |
You could modify writeCellCentres to write Sf() instead of magSf().
__________________
FluidEngineeringSolutions |
|
March 17, 2014, 11:44 |
|
#3 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear Hannes,
thanks for writing. Actually, I was thinking to compute cell normals run-time and not as post-processing. I opened the elbow tutorial and I modified the controlDict as follows: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // libs ( "libOpenFOAM.so" ); application icoFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 10; deltaT 0.05; writeControl timeStep; writeInterval 20; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; functions { #include "computeNormals" } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ computeNormals { functionObjectLibs ("libutilityFunctionObjects.so"); type coded; redirectType computeNormals; outputControl outputTime; code #{ polyPatch velocity-inlet-5; const vectorField::subField normals = patch.faceAreas(); #}; } Code:
lab@labPC:~/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow$ icoFoam /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.2.2-9739c53ec43f Exec : icoFoam Date : Mar 17 2014 Time : 16:44:05 Host : "labPC" PID : 9593 Case : /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading transportProperties Reading field p Reading field U Reading/calculating face flux field phi Starting time loop Using dynamicCode for functionObject computeNormals at line 13 in "/home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/system/controlDict.functions.computeNormals" Creating new library in "dynamicCode/computeNormals/platforms/linux64GccDPOpt/lib/libcomputeNormals_f9d5dbd87ebb60fe8eb22f95db6cc5f67e8f26a7.so" Invoking "wmake -s libso /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/dynamicCode/computeNormals" wmakeLnInclude: linking include files to ./lnInclude Making dependency list for source file functionObjectTemplate.C Making dependency list for source file FilterFunctionObjectTemplate.C /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/system/controlDict.functions.computeNormals: In member function ‘virtual void Foam::computeNormalsFunctionObject::write()’: /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/system/controlDict.functions.computeNormals:19:19: error: expected initializer before ‘-’ token /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/system/controlDict.functions.computeNormals:20:41: error: ‘patch’ was not declared in this scope /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/system/controlDict.functions.computeNormals:20:31: warning: unused variable ‘normals’ [-Wunused-variable] make: *** [Make/linux64GccDPOpt/functionObjectTemplate.o] Error 1 --> FOAM FATAL IO ERROR: Failed wmake "dynamicCode/computeNormals/platforms/linux64GccDPOpt/lib/libcomputeNormals_f9d5dbd87ebb60fe8eb22f95db6cc5f67e8f26a7.so" file: /home/lab/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow/system/controlDict.functions.computeNormals from line 13 to line 18. From function codedBase::createLibrary(..) in file db/dynamicLibrary/codedBase/codedBase.C at line 202. FOAM exiting lab@labPC:~/OpenFOAM/OpenFOAM-2.2.2/tutorials/incompressible/icoFoam/elbow$ Thanks a lot, Samuele |
|
March 17, 2014, 13:58 |
|
#4 |
Member
Hannes
Join Date: Apr 2009
Location: Schleswig, Germany
Posts: 38
Rep Power: 17 |
Hi Samuele,
first of all the compiler does not like your patch name. If you need to have it in the code, you might want to try something like velocityInlet5 instead. Regarding the coded function object this is just a wild guess as I haven't used it: code #{ // get normals const surfaceVectorField& normals = mesh().Sf(); // Write normals.write(); #} possibly: normals.boundaryField().write() Good Luck Hannes
__________________
FluidEngineeringSolutions |
|
March 19, 2014, 09:15 |
|
#5 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear Hannes,
thanks a lot. What you suggested works pretty well and I have a file names "S" in the constant/polyMesh dir. That's very nice. Nevertheless, I am not completely satisfied, yet. I would need 2 improvements: 1. computing the normals on a patch only; 2. rescale the normals in order to have magnitude 1; Could you help in doing this? Thanks a lot, Samuele PS: attached a case. If you run blockMesh and icoFoam (it's the cavity case), you can get what I wrote above. |
|
August 9, 2018, 07:53 |
Progress??
|
#6 | |
New Member
Héctor Lodoso
Join Date: Oct 2015
Location: Spain
Posts: 15
Rep Power: 11 |
Hi Samuele,
Did you make any progress in this regard? I am dealing with the same issue... Many thanks! Héctor Quote:
__________________
Best regards! Héctor Lodoso |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
y+ and u+ values with low-Re RANS turbulence models: utility + testcase | florian_krause | OpenFOAM | 114 | August 23, 2023 06:37 |
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface | Kryo | OpenFOAM Meshing & Mesh Conversion | 13 | February 17, 2022 08:34 |
[Other] Mesh Importing Problem | cuteapathy | ANSYS Meshing & Geometry | 2 | June 24, 2017 06:29 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 10:28 |