Download data/src/functionObjects/utilities/generateZone/generateZone.H from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 5.15 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/functionObjects/utilities/generateZone/generateZone.H
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/functionObjects/utilities/generateZone/generateZone.H
-
curl -L -o generateZone.H https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/functionObjects/utilities/generateZone/generateZone.H
5.15 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Copyright (C) 2026 OpenFOAM Foundation | |
| \\/ M anipulation | | |
| ------------------------------------------------------------------------------- | |
| License | |
| This file is part of OpenFOAM. | |
| OpenFOAM is free software: you can redistribute it and/or modify it | |
| under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| for more details. | |
| You should have received a copy of the GNU General Public License | |
| along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | |
| Class | |
| Foam::functionObjects::generateZone | |
| Description | |
| Generates, registers and optionally writes the \c zoneSet generated by | |
| a \c zoneGenerator. | |
| Usage | |
| \table | |
| Property | Description | Required | Default value | |
| type | type name: generateZone | yes | | |
| zone | zoneGenerator specification | yes | | |
| \endtable | |
| Example of a functionObjects::generateZone which creates a \c cellZone named | |
| \c kZone of the cells in which the value of the turbulent kinetic energy is | |
| within the highest 10% and then functionObjects::volFieldValue | |
| is used to average the velocity within this zone: | |
| \verbatim | |
| kZone | |
| { | |
| type generateZone; | |
| libs ("libutilityFunctionObjects.so"); | |
| executeControl writeTime; | |
| writeControl writeTime; | |
| zone | |
| { | |
| type coded; | |
| code | |
| #{ | |
| // Lookup field from the objectRegistry, e.g. k | |
| const volScalarField& k = | |
| mesh().lookupObject<volScalarField>("k"); | |
| // Calculate the minimum and maximum k values | |
| const scalar mink = min(k).value(); | |
| const scalar maxk = max(k).value(); | |
| // Fraction of the range of k | |
| const scalar f = 0.1; | |
| // Lowest k in selection | |
| const scalar lowk = f*mink + (1.0 - f)*maxk; | |
| cellIndices = selectIndices | |
| ( | |
| k, | |
| [&](const scalar k) | |
| { | |
| return k > lowk; | |
| } | |
| ); | |
| #}; | |
| } | |
| } | |
| UAverage | |
| { | |
| type volFieldValue; | |
| libs ("libfieldFunctionObjects.so"); | |
| executeControl writeTime; | |
| writeControl writeTime; | |
| writeFields no; | |
| cellZone kZone; | |
| operation volAverage; | |
| fields (U); | |
| } | |
| \endverbatim | |
| See also | |
| Foam::functionObject | |
| SourceFiles | |
| generateZone.C | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| namespace Foam | |
| { | |
| namespace functionObjects | |
| { | |
| /*---------------------------------------------------------------------------*\ | |
| Class generateZone Declaration | |
| \*---------------------------------------------------------------------------*/ | |
| class generateZone | |
| : | |
| public fvMeshFunctionObject | |
| { | |
| // Private Data | |
| //- Run-time selected zoneGenerator | |
| autoPtr<zoneGenerator> zg_; | |
| public: | |
| //- Runtime type information | |
| TypeName("generateZone"); | |
| // Constructors | |
| //- Construct from Time and dictionary | |
| generateZone | |
| ( | |
| const word& name, | |
| const Time& runTime, | |
| const dictionary& dict | |
| ); | |
| //- Disallow default bitwise copy construction | |
| generateZone(const generateZone&) = delete; | |
| //- Destructor | |
| virtual ~generateZone(); | |
| // Member Functions | |
| //- Return the list of fields required | |
| virtual wordList fields() const | |
| { | |
| return wordList::null(); | |
| } | |
| //- Remove the registered objects | |
| virtual bool execute(); | |
| //- Do nothing | |
| virtual bool write(); | |
| // Member Operators | |
| //- Disallow default bitwise assignment | |
| void operator=(const generateZone&) = delete; | |
| }; | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| } // End namespace functionObjects | |
| } // End namespace Foam | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| // ************************************************************************* // | |