|
[Sponsors] |
July 31, 2014, 05:44 |
Writing a function object
|
#1 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Dear Foamers,
I am writing a function object and I do have some issues to be solved. I hope someone can help: I am attaching a very simple case. Could you have a look? I case: Enter the case directory and launch: "scalarTransportFoam" Everything is ok. In the 10 dir I have the T*2 field. II case: Enter the case directory and launch: "scalarTransportFoam -noFunctionObjects" and as a post processing run "execFlowFunctionObjects -noZero -latestTime" I get this error: Code:
samuele@pc-zampini:~/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry$ execFlowFunctionObjects -noZero -latestTime /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.3.0-f5222ca19ce6 Exec : execFlowFunctionObjects -noZero -latestTime Date : Jul 31 2014 Time : 10:53:20 Host : "pc-zampini" PID : 21188 Case : /home/samuele/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry 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 = 10 Using dynamicCode for functionObject difference at line 57 in "/home/samuele/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry/system/controlDict.functions.difference" Time = 10 Reading phi Reading U Reading p --> FOAM Warning : --> FOAM FATAL IO ERROR: cannot find file file: /home/samuele/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry/10/p at line 0. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 73. samuele@pc-zampini:~/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry$ Code:
samuele@pc-zampini:~/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry$ execFlowFunctionObjects -noZero -latestTime /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.3.0-f5222ca19ce6 Exec : execFlowFunctionObjects -noZero -latestTime Date : Jul 31 2014 Time : 10:52:07 Host : "pc-zampini" PID : 21126 Case : /home/samuele/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry 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 = 10 Using dynamicCode for functionObject difference at line 57 in "/home/samuele/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry/system/controlDict.functions.difference" Time = 10 Reading phi Reading U Reading p Looking up field T --> FOAM FATAL ERROR: request for volScalarField T from objectRegistry region0 failed available objects of type volScalarField are 1(p) From function objectRegistry::lookupObject<Type>(const word&) const in file /home/samuele/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 198. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1 Foam::error::abort() in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/lib/libincompressibleRASModels.so" #3 Foam::mixingEvaluationFunctionObject::write() at /usr/include/c++/4.7/bits/basic_string.h:536 #4 Foam::OutputFilterFunctionObject<Foam::mixingEvaluationFunctionObject>::execute(bool) at ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/OutputFilterFunctionObject.C:173 #5 Foam::functionObjectList::execute(bool) in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #6 in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/bin/execFlowFunctionObjects" #7 in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/bin/execFlowFunctionObjects" #8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #9 in "/home/samuele/OpenFOAM/OpenFOAM-2.3.0/platforms/linux64GccDPOpt/bin/execFlowFunctionObjects" Annullato samuele@pc-zampini:~/Documenti/PhD/02tesiDomenico/workingDirLocal/dummyCase/passiveScalarBaseGeometry$ Also, one more question: how abaout if I want to get an average on each section? Thanks a lot, Samuele |
|
July 31, 2014, 09:53 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21 |
You also need to -noFlow flag for execFlowFunctionObjects. All variables will then be loaded.
|
|
July 31, 2014, 10:13 |
|
#3 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
Hi Bernard and thanks for helping.
Also, about my secondo issue, I was thinking about exploiting the sample function and then to average it. The point is that I would insert a loop in the sampleDict. Is that possible? I wrote something like: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object sampleDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // interpolationScheme cellPoint; surfaceFormat foamFile; points = 100; L = 3000; dx = $points/$L; for i = 1:$points { surfaces ( plane%d, i { type plane; basePoint (0.0001 -0.0016+($dx*%i) 0.0001); normalVector (0 1 0); } ); } end fields ( U ); Thanks again. |
|
July 31, 2014, 11:46 |
|
#4 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 18 |
I tryed the following solution:
Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application scalarTransportFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 10; // T = 7.5e-3 deltaT 1; writeControl adjustableRunTime; writeInterval 1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; adjustTimeStep yes; maxCo 0.9; functions { new_planes { type faceSource; functionObjectLibs ("libfieldFunctionObjects.so"); enabled true; outputControl timeStep; log true; valueOutput true; source sampledSurface; surfaceFormat vtk; sampledSurfaceDict { type plane; basePoint (0.0001 -0.00115 0.0001); normalVector (0 1 0); } sampledSurfaceDict { type plane; basePoint (0.0001 -0.00065 0.0001); normalVector (0 1 0); } operation areaAverage; fields ( T ); } |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
foamToTecplot360 | thomasduerr | OpenFOAM Post-Processing | 121 | June 11, 2021 10:05 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 09:56 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 04:37 |
Error with Wmake | skabilan | OpenFOAM Installation | 3 | July 28, 2009 00:35 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 06:27 |