Download data/test/dictionary/testCalc from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 3.64 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/test/dictionary/testCalc
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/test/dictionary/testCalc
-
curl -L -o testCalc https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/test/dictionary/testCalc
3.64 kB
| /*--------------------------------*- C++ -*----------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Version: dev | |
| \\/ M anipulation | | |
| \*---------------------------------------------------------------------------*/ | |
| FoamFile | |
| { | |
| format ascii; | |
| class dictionary; | |
| object testCalc; | |
| } | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| a 1.1; | |
| b 3.2; | |
| c | |
| // Special care is required for calc entries that include a division since | |
| // "/" is also used as the scoping operator to identify keywords in | |
| // sub-dictionaries. For example, "$a/b" expects a keyword "b" within a | |
| // sub-dictionary named "a". A division can be correctly executed by using a | |
| // space between a variables and "/", e.g. | |
| c1 | |
| // or bracketing the variable, e.g. | |
| c2 | |
| // Access to sub-entries using the "/" operator, e.g. | |
| d | |
| { | |
| b 4.8; | |
| } | |
| e | |
| // Access to higher-level sub-entries using the "../" operators, e.g. | |
| f | |
| { | |
| g | |
| } | |
| s "field"; | |
| fieldName | |
| time 100; | |
| fileName | |
| fileName2 | |
| // Additional include files for the #calc code compilation can be specified | |
| // using the #codeInclude entry, e.g. if functions from transform.H are used | |
| angle -5 [deg]; | |
| liftDir | |
| dragDir | |
| // Calculate the magnitude of the velocity and turbulent kinetic energy | |
| // where the velocity is looked-up from testCalc2 | |
| magU | |
| k | |
| // With #stream multiple code statements can be used to generate the entry using | |
| // 'os << ...;'. | |
| // This is equivalent to #codeStream but with a more compact syntax | |
| // but include files must be specified using separate #codeInclude statements | |
| maxAngle 30 [deg]; | |
| nAngles 7; | |
| Us | |
| #{ | |
| const vector U($<vector>testCalc2!U); | |
| const int nAngles = $nAngles; | |
| const scalar angleStep = ($<scalar>maxAngle)/(nAngles - 1); | |
| List<vector> Us(nAngles); | |
| for(int i=0; i<nAngles; i++) | |
| { | |
| const scalar angle = i*angleStep; | |
| Us[i] = transform(Ry(angle), U); | |
| } | |
| os << Us; | |
| #}; | |
| // List of vectors example | |
| listU ((1.1 2.1 1.1) (2.1 3.2 4.1) (4.3 5.3 0)); | |
| magU1 | |
| // Field of vectors and scalars example | |
| magUs | |
| magSqrU1 | |
| namedU (U0 (1.1 2.1 1.1) U1 (2.1 3.2 4.1) U2 (4.3 5.3 0)); | |
| magU2 | |
| // List of vectors stored as a typed compound example | |
| listU2 List<vector> ((1.1 2.1 1.1) (2.1 3.2 4.1) (4.3 5.3 0)); | |
| magU21 | |
| // Complex conditionals are also possible using #if and #calculate | |
| // but not within #codeBlock...#endCodeBlock | |
| negativeAngle $angle; | |
| positiveAngle $angle; | |
| // ************************************************************************* // | |