Skip to content

Commit 1202491

Browse files
committed
Apply reasonable formatting to the codedBoundaryConditions in OF partitioned heat
1 parent 1c66fe9 commit 1202491

File tree

2 files changed

+52
-51
lines changed
  • partitioned-heat-conduction
    • dirichlet-openfoam/0
    • neumann-openfoam/0

2 files changed

+52
-51
lines changed

partitioned-heat-conduction/dirichlet-openfoam/0/T

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,41 @@ internalField #codeStream
1313
{
1414
codeInclude
1515
#{
16-
#include "fvCFD.H"
16+
#include "fvCFD.H"
1717
#};
1818

1919
codeOptions
2020
#{
21-
-I$(LIB_SRC)/finiteVolume/lnInclude \
22-
-I$(LIB_SRC)/meshTools/lnInclude
21+
-I$(LIB_SRC)/finiteVolume/lnInclude \
22+
-I$(LIB_SRC)/meshTools/lnInclude
2323
#};
2424

2525
codeLibs
2626
#{
27-
-lmeshTools \
28-
-lfiniteVolume
27+
-lmeshTools \
28+
-lfiniteVolume
2929
#};
3030

3131
code
3232

3333
#{
34-
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
35-
const fvMesh& mesh = refCast<const fvMesh>(d.db());
34+
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
35+
const fvMesh& mesh = refCast<const fvMesh>(d.db());
36+
const vectorField& CC = mesh.C(); // cell center
3637

37-
scalarField T(mesh.nCells());
3838

39-
const vectorField& CC = mesh.C(); //cell center
39+
// assign values
4040

4141

42-
forAll(CC,cellI)
43-
{
44-
scalar x = CC[cellI].x();
45-
scalar y = CC[cellI].y();
42+
scalarField T(mesh.nCells());
43+
forAll(CC, cellI)
44+
{
45+
scalar x = CC[cellI].x();
46+
scalar y = CC[cellI].y();
4647

47-
T[cellI] = 1+pow(x,2)+(3*pow(y,2));//t is zero for initial conditions
48-
}
49-
T.writeEntry("", os);
48+
T[cellI] = 1 + pow(x, 2) + (3 * pow(y, 2)); // t is zero for initial conditions
49+
}
50+
T.writeEntry("", os);
5051
#};
5152
};
5253

@@ -65,14 +66,15 @@ boundaryField
6566
name DirichletBoundary;
6667
code
6768
#{
68-
const vectorField& Cf = patch().Cf();
69-
scalarField& field = *this;
69+
const vectorField& Cf = patch().Cf();
7070
const scalar t = this->db().time().value();
71-
forAll(Cf,faceI)
71+
scalarField& field = *this;
72+
forAll(Cf, faceI)
7273
{
73-
const scalar x=Cf[faceI][0];
74-
const scalar y=Cf[faceI][1];
75-
field[faceI]=1+pow(x,2)+(3*pow(y,2))+1.2*t;
74+
const scalar x = Cf[faceI].x();
75+
const scalar y = Cf[faceI].y();
76+
77+
field[faceI] = 1 + pow(x, 2) + (3 * pow(y, 2)) + 1.2 * t;
7678
}
7779

7880
#};

partitioned-heat-conduction/neumann-openfoam/0/T

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,44 @@ internalField #codeStream
1313
{
1414
codeInclude
1515
#{
16-
#include "fvCFD.H"
16+
#include "fvCFD.H"
1717
#};
1818

1919
codeOptions
2020
#{
21-
-I$(LIB_SRC)/finiteVolume/lnInclude \
22-
-I$(LIB_SRC)/meshTools/lnInclude
21+
-I$(LIB_SRC)/finiteVolume/lnInclude \
22+
-I$(LIB_SRC)/meshTools/lnInclude
2323
#};
2424

2525
codeLibs
2626
#{
27-
-lmeshTools \
28-
-lfiniteVolume
27+
-lmeshTools \
28+
-lfiniteVolume
2929
#};
3030

3131
code
3232

3333
#{
34-
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
35-
const fvMesh& mesh = refCast<const fvMesh>(d.db());
36-
37-
scalarField T(mesh.nCells());
38-
39-
const vectorField& CC = mesh.C(); //cell center
40-
41-
42-
forAll(CC,cellI)
43-
{
44-
scalar x = CC[cellI].x();
45-
scalar y = CC[cellI].y();
46-
47-
T[cellI] = 1+pow(x,2)+(3*pow(y,2));//t is zero for initial conditions
48-
}
49-
T.writeEntry("", os);
34+
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
35+
const fvMesh& mesh = refCast<const fvMesh>(d.db());
36+
const vectorField& CC = mesh.C(); // cell center
37+
38+
// assign values
39+
scalarField T(mesh.nCells());
40+
forAll(CC, cellI)
41+
{
42+
scalar x = CC[cellI].x();
43+
scalar y = CC[cellI].y();
44+
45+
T[cellI] = 1 + pow(x, 2) + (3 * pow(y, 2)); // t is zero for initial conditions
46+
}
47+
T.writeEntry("", os);
5048
#};
5149
};
5250

5351
boundaryField
5452
{
55-
interface
53+
interface
5654
{
5755
type fixedGradient;
5856
gradient uniform -2;
@@ -65,16 +63,17 @@ boundaryField
6563
name DirichletBoundary;
6664
code
6765
#{
68-
const vectorField& Cf = patch().Cf();
69-
scalarField& field = *this;
66+
const vectorField& Cf = patch().Cf();
7067
const scalar t = this->db().time().value();
71-
forAll(Cf,faceI)
68+
69+
scalarField& field = *this;
70+
forAll(Cf, faceI)
7271
{
73-
const scalar x=Cf[faceI][0];
74-
const scalar y=Cf[faceI][1];
75-
field[faceI]=1+pow(x,2)+(3*pow(y,2))+1.2*t;
76-
}
72+
const scalar x = Cf[faceI].x();
73+
const scalar y = Cf[faceI].y();
7774

75+
field[faceI] = 1 + pow(x, 2) + (3 * pow(y, 2)) + 1.2 * t;
76+
}
7877
#};
7978
}
8079

0 commit comments

Comments
 (0)