File size: 1,363 Bytes
5a600cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*--------------------------------*- 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;
    location    "constant";
    object      alphaInternalField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

internalField
{
    type        coded;

    name        $name;

    y0          $y0;
    y1          $y1;

    evaluate
    #{
        const vectorField& Ci(C);
        const scalarField x(Ci.component(vector::X));
        const scalarField y(Ci.component(vector::Y));

        const scalar x0 = 0.032;
        const scalar x1 = 0.064;
        const scalar x2 = 0.128;
        const scalar x3 = 0.224;

        const scalarField f
        (
            pos(x - x0)*pos(x1 - x)*(x - x0)/(x1 - x0)
          + pos(x - x1)*pos(x2 - x)
          + pos(x - x2)*pos(x3 - x)*(x3 - x)/(x3 - x2)
        );

        field.primitiveFieldRef() = 0.5*pos(y - $y0)*pos($y1 - y)*f;
    #};
};


// ************************************************************************* //