|
[Sponsors] |
December 11, 2020, 08:15 |
Run function objects on final time
|
#1 |
Member
Ben Simpson
Join Date: Dec 2019
Location: UK
Posts: 32
Rep Power: 7 |
Hi all,
I am running a range of natural ventilation simulations. I have a handful of function objects and two surfaces files that I want to run on the final time/iteration of the simulation once my convergence criteria has been met. The problem I am having is that when the simulation converges some of my function objects and my two surface files are not getting updated with the results from the final simulation time. The probes and residual function objects are updated correctly at the end of the simulation but my four volFieldValue, FieldMinMax and surface files are not. Does anyone know if there is a method by which I can either get my simulation to run all my function objects at time of convergence or re-run them after the simulation has finished? The postProcessing folder is updated correctly with all my function objects and surface files values at the declared writeIntervals in the controlDict. Ideally, I want to find a way for the simulation to automatically update the postProcessing folder at the end of the simulation instead of me having to manually change the writeInterval when the simulation gets close to converging. I have looked into the postProcess tool but when I use the -list command their is no volFieldValue in the list of function objects. So I am not sure if that function object is available for use with the postProcess tool. I am using OpenFOAM 8 on Ubuntu 18.04.2. I am running buoyantSimpleFoam in parallel on 6 processors. My simulations are converging correctly and the reconstruct process appears to be working as intended. Thank you in advance for any support you can provide me. Kind regards, Ben My controlDict: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | Model: VE_Practice | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application buoyantSimpleFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 10000; deltaT 1; writeControl timeStep; writeInterval 1000; purgeWrite 3; writeFormat ascii; writePrecision 8; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; functions { #include "surfaces" #include "surfaces2" CO2 { type scalarTransport; libs ("libsolverFunctionObjects.so"); writeControl timeStep; writeInterval 1; active true; autoSchemes false; nCorr 0; resetOnStartUp false; field CO2; fvOptions { } } comfortAnalysis { type comfort; libs ("libfieldFunctionObjects.so"); metabolicRate 1.2; clothing 0.7; extWork 0.0; executeControl writeTime; writeControl writeTime; } AoA { type scalarTransport; libs ("libutilityFunctionObjects.so"); enabled true; writeControl writeTime; log yes; nCorr 1; field AoA; active true; autoSchemes false; resetOnStartUp false; DT 1e-5; nCorr 0; fvOptions { IncrementTime { type semiImplicitSource; active true; selectionMode all; volumeMode specific; sources { AoA { explicit 1; implicit 0; } } } } } fieldMinMax { type fieldMinMax; libs ("libfieldFunctionObjects.so"); log yes; writeControl writeTime; //writeInterval 1; //mode magnitude; fields ( U p T rho CO2 AoA); } breathingZoneAverages { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name breathingZone; operation volAverage; fields ( T CO2 U PMV PPD AoA ); } breathingZoneValuesAvg { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name breathingZone; operation average; fields ( T CO2 U PMV PPD AoA ); } breathingZoneValuesSum { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name breathingZone; operation sum; fields ( CO2 ); } spaceAverage { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name spaceZone; operation volAverage; fields ( T CO2 U AoA ); } residuals { type residuals; functionObjectLibs ("libutilityFunctionObjects.so"); enabled true; writeControl timeStep; writeInterval 1; fields ( p_rgh U k omega CO2 e ); } probes { type probes; libs ("libsampling.so"); writeControl timeStep; writeInterval 1; fields ( p_rgh U T CO2 k omega ); probeLocations ( (2.55 1.3 1.5) //convergence point ); } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ surfaces { type surfaces; libs ("libsampling.so"); writeControl writeTime; surfaceFormat raw; fields (U T CO2 AoA); interpolationScheme cell; surfaces ( NorthSlice { type cuttingPlane; planeType pointAndNormal; pointAndNormalDict { point (0 5.15 0); normal (0 1 0); } interpolate false; } SouthSlice { type cuttingPlane; planeType pointAndNormal; pointAndNormalDict { point (0 0.05 0); normal (0 1 0); } interpolate false; } ); } // ************************************************************************* // |
|
September 15, 2022, 05:43 |
|
#2 |
New Member
Saurabh
Join Date: Nov 2017
Posts: 6
Rep Power: 9 |
Hi,
Did you find solution to your problem? I have the same problem. |
|
September 16, 2022, 07:19 |
|
#3 |
Member
Ben Simpson
Join Date: Dec 2019
Location: UK
Posts: 32
Rep Power: 7 |
Hi,
I was unable to find a perfect solution to this problem. So what I have done is after the simulation has converged but before performing the reconstruction tasks I re-ran the solver (buoyantSimpleFoam in my case) but with an edited/updated controlDict file. In the controlDict, I made sure the startFrom was set to latestTime. I removed the startTime and set the writeInterval to 10. I also increased the endTime abit (by 200 in my case) just in case the simulation didn't converge. This then re-ran buoyantSimpleFoam from the converged solution but writing all my results every 10 iterations. My simulations usual re-converged very quickly, so it didn't take me too much extra time. Then when they re-converged I had results written out within a few iterations of the final convergence. This does not seem like a proper solution to the problem but it was the best work around I was able to come up with. I will include my edited/second controlDict in case that helps, but it will be abit different as my models have changed abit since I created this thread. I hope this helps. Regards, Ben Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | Model: VE_Practice | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application buoyantSimpleFoam; startFrom latestTime; stopAt endTime; endTime 5200; deltaT 1; writeControl timeStep; writeInterval 10; purgeWrite 3; writeFormat ascii; writePrecision 8; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable true; /*libs ( "libOpenFOAM.so" "libsimpleSwakFunctionObjects.so" "libswakFunctionObjects.so" "libgroovyBC.so" );*/ functions { #include "surfaces" #include "surfaces2" CO2 { type scalarTransport; libs ("libsolverFunctionObjects.so"); writeControl timeStep; writeInterval 1; active true; autoSchemes false; nCorr 0; resetOnStartUp false; field CO2; fvOptions { generalSource { type semiImplicitSource; active true; selectionMode cellZone; cellZone spaceZone; volumeMode absolute; sources { CO2 { explicit 1; implicit 0; } } } } } comfortAnalysis { type comfort; libs ("libfieldFunctionObjects.so"); metabolicRate 1.2; clothing 0.7; extWork 0.0; executeControl writeTime; writeControl writeTime; } AoA { type scalarTransport; libs ("libutilityFunctionObjects.so"); enabled true; writeControl writeTime; log yes; nCorr 1; field AoA; active true; autoSchemes false; resetOnStartUp false; DT 1e-5; nCorr 0; fvOptions { IncrementTime { type semiImplicitSource; active true; selectionMode all; volumeMode specific; sources { AoA { explicit 1; implicit 0; } } } } } fieldMinMax { type fieldMinMax; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; //writeInterval 1; //mode magnitude; fields ( U p T rho CO2 AoA); } breathingZoneAverages { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name breathingZone; operation volAverage; fields ( T CO2 U PMV PPD AoA ); } breathingZoneValuesAvg { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name breathingZone; operation average; fields ( T CO2 U PMV PPD AoA ); } breathingZoneValuesSum { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name breathingZone; operation sum; fields ( T CO2 U PMV PPD AoA ); } spaceVolAverage { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name spaceZone; operation volAverage; fields ( T CO2 U AoA ); } spaceAverage { type volFieldValue; libs ("libfieldFunctionObjects.so"); log true; writeControl writeTime; writeFields true; regionType cellZone; name spaceZone; operation average; fields ( T CO2 U AoA ); } residuals { type residuals; functionObjectLibs ("libutilityFunctionObjects.so"); enabled true; writeControl timeStep; writeInterval 1; fields ( p_rgh U nuTilda CO2 e AoA ); } probes { type probes; libs ("libsampling.so"); writeControl timeStep; writeInterval 1; fields ( p_rgh U T CO2 nuTilda AoA ); probeLocations ( (1.6 3.1 2) //convergence point Occ1 (3.1 3.1 2) //convergence point Center (4.6 3.1 2) //convergence point Occ2 ); } } // ************************************************************************* // |
|
September 19, 2022, 21:09 |
|
#4 |
New Member
Saurabh
Join Date: Nov 2017
Posts: 6
Rep Power: 9 |
Hi,
Thanks for the reply. Your solution might work for me even though it is not the best one. Have a nice day! |
|
Tags |
buoyantsimplefoam, function objects, openfoam 8, postprocessing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
pimpleDyMFoam computation randomly stops | babapeti | OpenFOAM Running, Solving & CFD | 5 | January 24, 2018 06:28 |
pressure in incompressible solvers e.g. simpleFoam | chrizzl | OpenFOAM Running, Solving & CFD | 13 | March 28, 2017 06:49 |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 03:20 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |
Differences between serial and parallel runs | carsten | OpenFOAM Bugs | 11 | September 12, 2008 12:16 |