Project 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Project 1

“Conduction and Convection”


MEEN5323: Advanced Heat Transfer and Applications
Spring 2024

Submitted By:
Subash Pradhan
(L20565255)

Submitted To:
Dr. Ping He
Professor, Department of Mechanical Engineering
Lamar University

Mar 3, 2024
1: Introduction
1.1. Governing equations for conduction

Laplacian term:-

1.2. OpenFOAM
OpenFOAM (Open Field Operation and Manipulation) is an open-source computational fluid dynamics
(CFD) software package widely used for simulating fluid flow and heat transfer phenomena. Within
OpenFOAM, the Laplacian operator plays a crucial role in solving partial differential equations (PDEs)
governing various physical processes, including heat conduction.

The Laplacian operator is a differential operator that represents the divergence of the gradient of a
scalar field. In the context of heat conduction, the Laplacian operator is used to describe the spatial
variation of temperature within a domain. In OpenFOAM, the Laplacian operator is employed in
discretized form to solve the heat conduction equation numerically.

Where: k is the thermal conductivity of the material, T is the temperature field.

2: Problem Statement and project description:-


Problem Statement:
A solid copper column is attached to two surfaces on the bottom and top sides, whose temperatures
are fixed at 50°C and 500°C, respectively. Force convection is used to cool down the column using the
room temperature air at 25°C at the heat transfer coefficient of 25 W/m2⋅K. The width and height of
the column as well as the thermal conductivity are shown in the following figure. What is the
temperature distribution of the copper column along the vertical direction in the steady state? What
is the total heat transfer rate from the column to air?
Project description:
 To Construct and execute the simulation case using commercial or open-source software.
 To select an appropriate mesh size, such as 100,000 computational cells.
 To visualize the temperature field's evolution from initiation to steady state and produce a
video of this visualization for inclusion in the report.
 To execute on-the-fly processing or post-processing techniques to obtain the temperature
distribution along the vertical axis and the overall heat transfer rate from the column to the
air.
 To compare the simulation outcomes with analytical solutions provided in the attachment.
 To Plot a graph of T(z) featuring two curves: (1) simulation results and (2) analytical solution.
 To demonstrate the setup and execution of the simulation and record them.

3: Numerical Approach
OpenFOAM is used to carry out the simulation and obtain the required temperature field for the
given Problem.
Preprocessing

Case setup
First, set-up for a case file is done. For this, a model from tutorial folder named “flange” is used.

Transport Properties
Under the case folder, and constant sub folder, transport properties is set up where the value of
thermal diffusivity is supplied.

Modeling and Discretization


Using the “blockMeshdict” file inside the case folder, the model for the copper column is created.
Thereafter, discretization (mesh generation) is carried out using the same file.
For this, coordinates of different faces and there types are assigned. Along with that, the number of
mesh elements along different directions are assigned.

/*--------------------------------*- C++ -*----------------------------------*\


| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale 1;

vertices
(
(0 0 0)
(0.2 0 0)
(0.2 0.2 0)
(0 0.2 0)
(0 0 2)
(0.2 0 2)
(0.2 0.2 2)
(0 0.2 2)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 200) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
sides
{
type patch;
faces
(
(3 7 6 2)
(0 4 7 3)
(1 5 4 0)
(2 6 5 1)
);
}
top
{
type patch;
faces
(
(4 5 6 7)
);
}
bottom
{
type patch;
faces
(
(0 3 2 1)
);
}
);

mergePatchPairs
(
);

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

Boundary conditions
Thereafter, initial conditions and boundary conditions like temperatures are assigned in the T file
under the 0 folder of a case folder.

/*--------------------------------*- C++ -*----------------------------------*\


| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 1 0 0 0];

internalField uniform 298; //initial temperature condition

boundaryField
{
top
{
type fixedValue;
value uniform 773; // T2=500 C
}

bottom
{
type fixedValue;
value uniform 323; //T1=50 C
}

sides
{
type mixed;
refValue uniform 298; //Tair
refGradient uniform 0; //must be zero
valueFraction uniform 0.03; // 1/(1+c) and c=2k/(h+dx) ; here dx=0.005
value uniform 298; //ambient temperature
}
}

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

Post-Processing
After assigning the boundary conditions, various simulation conditions or analysis parameters are
supplied for solving in “controlDict” file so that we can control the simulation and obtain the output
as per our requirements.
Here, simulation was done until the endtime of 15000 s to see the achievement of steady state with
the step time (deltaT) of 10 s.
Also, the coding is done to obtain the temperatures along Z axis (Tz) after defining the Tz line which
is at the centroidal axis of the column fin.
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application laplacianFoam;

//startFrom latestTime;
//endTime 4.0; // three second simulated time
startFrom startTime;
endTime 15000 ; // shorter time range to fill the insufficient data points
writeInterval 1;

startTime 0;

stopAt endTime;

deltaT 10;

writeControl runTime;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{
sample1
{
type sets;
libs ("libsampling.so");
writeControl runTime;
writeInterval 1.0;
setFormat raw;
interpolationScheme cellPoint;
//fields (T gradTx gradTy gradTz);
fields ( T );

sets
(
lineZ
{
type uniform;
axis distance;
start (0.1 0.1 0.0);
end (0.1 0.1 2.0);
nPoints 201;
}

lineX1
{
type uniform;
axis distance;
start (0.0 0.005 0.01);
end (0.01 0.005 0.01);
nPoints 210;
}
lineX2
{
type uniform;
axis distance;
start (0.0 0.005 0.02);
end (0.01 0.005 0.02);
nPoints 20;
}
lineX3
{
type uniform;
axis distance;
start (0.0 0.005 0.03);
end (0.01 0.005 0.03);
nPoints 20;
}
lineX4
{
type uniform;
axis distance;
start (0.0 0.005 0.04);
end (0.01 0.005 0.04);
nPoints 20;
}
);
}

totalHeatRate
{
libs ("libutilityFunctionObjects.so");
type coded;
name totalHeatRate;
writeControl timeStep;
writeInterval 1;

codeWrite
#{
// input parameters
const scalar Ta = 298; // air T [C]
const scalar h = 25; // convection coef. [W/m^2/K]
const scalar k = 400; // thermal conduct. [W/m/K]

// processing code
const Time& runTime = mesh().time();
const volScalarField& T = mesh().lookupObject<volScalarField>("T");
volVectorField gradT(fvc::grad(T));
label patch1 = mesh().boundaryMesh().findPatchID("sides");
label patch2 = mesh().boundaryMesh().findPatchID("top");
label patch3 = mesh().boundaryMesh().findPatchID("bottom");

const scalarField& T1p = T.boundaryField()[patch1];


const scalarField& T2p = T.boundaryField()[patch2];
const scalarField& T3p = T.boundaryField()[patch3];
const vectorField& gT1 = gradT.boundaryField()[patch1];
const vectorField& gT2 = gradT.boundaryField()[patch2];
const vectorField& gT3 = gradT.boundaryField()[patch3];

const scalarField& S1p = mesh().magSf().boundaryField()[patch1];


const scalarField& S2p = mesh().magSf().boundaryField()[patch2];
const scalarField& S3p = mesh().magSf().boundaryField()[patch3];
const vectorField& S1v = mesh().Sf().boundaryField()[patch1];
const vectorField& S2v = mesh().Sf().boundaryField()[patch2];
const vectorField& S3v = mesh().Sf().boundaryField()[patch3];

scalar sidewiseheatRate1 = 0.0;


scalar sidewiseheatRate2 =0.0;
scalar topheatRate1=0.0;
scalar bottomheatRate1 = 0.0;
forAll(T1p, facei) ///sidewise cooling
{
// Newton's law of cooling
sidewiseheatRate1 += h * (T1p[facei] - Ta) * S1p[facei];
// Fourier's law
sidewiseheatRate2 += (- k * (gT1[facei] & S1v[facei]));
}
forAll(T2p, facei)
{

topheatRate1 += (- k * (gT2[facei] & S2v[facei]));


}
forAll(T3p, facei)
{
bottomheatRate1 +=(- k* (gT3[facei] & S3v[facei]));
}

Info<< "Total heat rate: " << runTime.timeName() << "\t"


<<sidewiseheatRate1 << "\t" <<sidewiseheatRate2<<"\t"
<<topheatRate1 <<"\t" <<bottomheatRate1 <<"\t"
<< endl;

#};
}
}

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

 Finally, solving is done using “lalpacianFoam” solver.


 Also the heat rate along different faces are obtained.

4: Analytical Approach
To validate the results obtained using numerical approach, detailed analytical calculation is
done. For this, the problem was modeled as a columnar fin with fixed temperatures at tip
end i.e (Case C)

Thus, for our problem:


Tb= 500 °C TL=50°C T∞=25°C
L=2 m, Let x=0:0.1:2
𝑀≡√(ℎ𝑃𝑘𝐴𝑐) * θ𝑏 and 𝑚≡√(ℎ𝑃/𝑘𝐴𝑐)
Equations:
𝜃/𝜃𝑏=[ (θ𝐿/θ𝑏) sinh𝑚𝑥+sinh𝑚(𝐿−𝑥) ] / (sinh𝑚𝐿)
From above, equation we can get 𝜃 and Tz(temperature along z-axis or length of column)
Heat transfer rate 𝑞=𝑀[(cosh𝑚𝐿−θ𝐿/θ𝑏)/(sinh𝑚𝐿) ]

The above equations are fed to excel and solved with which Tz values were obtained.
(Table shown in Appendix)
m 1.118033989
M 8497.058314
Heat transfer rate (q)= 8596.724 W/m2
5: Results and Discussions
After running the simulation and obtaining the results, the “proj1.foam” file is created and
results were saved. And using the Paraview software, the results were seen in graphical
format.
 Heat transfer rate obtained at the end-time was 83269.5 W/m2

Figure 1:Tz at 15000 s


Figure 2: GradTx

Figure 3: GradTy
Figure 4: GradTz

After solving the numerical model of the problem, the results were obtained. The solution at
the end time 15000 s were selected and the temperature data (Tz) were obtained and
compared with the analytical results.

Temperatures (analytical vs simulation)


500
450
400
350
300
250
200
150
100
50
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Tz (analytical) Tz(simulation)

6: Conclusion
The problem was modelled and solved using both numerical and analytical approach. The
evolution of the temperature field from initiation to steady state was visualized. On-the-fly
processing or post-processing techniques were executed to obtain the temperature
distribution along the vertical axis and the overall heat transfer rate from the column to the
air. The simulation outcomes were compared with analytical solutions provided in the
attachment. A graph of T(z) featuring two curves for both simulation results and analytical
solution were plotted.
7: Appendix

L 2
m 1.118034 M 8497.058
x thetaL thetaB theta/thetaB Tz q 8596.724 W/m2
0 25 475 1 500
0.01 25 475 0.988750786 494.6566232
0.02 25 475 0.977625167 489.3719542
0.03 25 475 0.966621752 484.1453322
0.04 25 475 0.955739166 478.976104
0.05 25 475 0.944976049 473.8636234
0.06 25 475 0.934331055 468.8072513
0.07 25 475 0.923802854 463.8063558
0.08 25 475 0.91339013 458.8603116
0.09 25 475 0.90309158 453.9685004
0.1 25 475 0.892905918 449.130311
0.11 25 475 0.88283187 444.3451383
0.12 25 475 0.872868178 439.6123844
0.13 25 475 0.863013595 434.9314575
0.14 25 475 0.85326689 430.3017726
0.15 25 475 0.843626844 425.7227509
0.16 25 475 0.834092253 421.1938201
0.17 25 475 0.824661924 416.7144141
0.18 25 475 0.81533468 412.2839729
0.19 25 475 0.806109353 407.9019426
0.2 25 475 0.796984791 403.5677756
0.21 25 475 0.787959853 399.2809301
0.22 25 475 0.779033411 395.0408702
0.23 25 475 0.770204349 390.8470658
0.24 25 475 0.761471564 386.6989929
0.25 25 475 0.752833964 382.5961327
0.26 25 475 0.744290469 378.5379726
0.27 25 475 0.735840011 374.5240052
0.28 25 475 0.727481534 370.5537287
0.29 25 475 0.719213993 366.6266469
0.3 25 475 0.711036355 362.7422688
0.31 25 475 0.702947598 358.900109
0.32 25 475 0.69494671 355.0996871
0.33 25 475 0.687032691 351.3405282
0.34 25 475 0.679204552 347.6221622
0.35 25 475 0.671461314 343.9441244
0.36 25 475 0.663802011 340.305955
0.37 25 475 0.656225683 336.7071993
0.38 25 475 0.648731384 333.1474074
0.39 25 475 0.641318177 329.6261343
0.4 25 475 0.633985137 326.1429399
0.41 25 475 0.626731345 322.6973887
0.42 25 475 0.619555895 319.2890501
0.43 25 475 0.612457891 315.9174981
0.44 25 475 0.605436444 312.582311
0.45 25 475 0.598490678 309.2830722
0.46 25 475 0.591619724 306.0193691
0.47 25 475 0.584822724 302.7907938
0.48 25 475 0.578098827 299.5969427
0.49 25 475 0.571447193 296.4374166
0.5 25 475 0.56486699 293.3118205
0.51 25 475 0.558357397 290.2197637
0.52 25 475 0.551917599 287.1608598
0.53 25 475 0.545546792 284.1347263
0.54 25 475 0.539244179 281.1409849
0.55 25 475 0.533008972 278.1792616
0.56 25 475 0.526840391 275.2491859
0.57 25 475 0.520737667 272.3503918
0.58 25 475 0.514700035 269.4825167
0.59 25 475 0.508726742 266.6452023
0.6 25 475 0.50281704 263.8380939
0.61 25 475 0.496970191 261.0608405
0.62 25 475 0.491185463 258.3130951
0.63 25 475 0.485462135 255.5945141
0.64 25 475 0.47979949 252.9047577
0.65 25 475 0.47419682 250.2434897
0.66 25 475 0.468653426 247.6103774
0.67 25 475 0.463168614 245.0050917
0.68 25 475 0.457741699 242.427307
0.69 25 475 0.452372002 239.8767009
0.7 25 475 0.447058852 237.3529547
0.71 25 475 0.441801585 234.8557529
0.72 25 475 0.436599544 232.3847833
0.73 25 475 0.431452078 229.9397371
0.74 25 475 0.426358545 227.5203087
0.75 25 475 0.421318306 225.1261955
0.76 25 475 0.416330733 222.7570984
0.77 25 475 0.411395202 220.4127212
0.78 25 475 0.406511096 218.0927708
0.79 25 475 0.401677805 215.7969572
0.8 25 475 0.396894723 213.5249936
0.81 25 475 0.392161254 211.2765958
0.82 25 475 0.387476806 209.0514828
0.83 25 475 0.382840793 206.8493765
0.84 25 475 0.378252635 204.6700016
0.85 25 475 0.373711759 202.5130857
0.86 25 475 0.369217598 200.3783591
0.87 25 475 0.36476959 198.2655551
0.88 25 475 0.360367178 196.1744095
0.89 25 475 0.356009812 194.1046609
0.9 25 475 0.351696949 192.0560506
0.91 25 475 0.347428048 190.0283226
0.92 25 475 0.343202575 188.0212233
0.93 25 475 0.339020004 186.0345019
0.94 25 475 0.33487981 184.06791
0.95 25 475 0.330781477 182.1212017
0.96 25 475 0.326724492 180.1941339
0.97 25 475 0.322708348 178.2864655
0.98 25 475 0.318732543 176.3979581
0.99 25 475 0.31479658 174.5283757
1 25 475 0.310899967 172.6774845
1.01 25 475 0.307042217 170.8450531
1.02 25 475 0.303222848 169.0308526
1.03 25 475 0.299441381 167.2346562
1.04 25 475 0.295697346 165.4562393
1.05 25 475 0.291990273 163.6953795
1.06 25 475 0.288319699 161.9518569
1.07 25 475 0.284685165 160.2254534
1.08 25 475 0.281086218 158.5159533
1.09 25 475 0.277522406 156.8231429
1.1 25 475 0.273993285 155.1468105
1.11 25 475 0.270498414 153.4867467
1.12 25 475 0.267037355 151.8427438
1.13 25 475 0.263609677 150.2145965
1.14 25 475 0.26021495 148.6021012
1.15 25 475 0.25685275 147.0050562
1.16 25 475 0.253522657 145.4232621
1.17 25 475 0.250224255 143.856521
1.18 25 475 0.246957131 142.3046372
1.19 25 475 0.243720877 140.7674166
1.2 25 475 0.240515089 139.2446671
1.21 25 475 0.237339365 137.7361983
1.22 25 475 0.234193309 136.2418216
1.23 25 475 0.231076527 134.7613504
1.24 25 475 0.22798863 133.2945994
1.25 25 475 0.224929232 131.8413854
1.26 25 475 0.221897951 130.4015268
1.27 25 475 0.218894407 128.9748434
1.28 25 475 0.215918225 127.5611571
1.29 25 475 0.212969034 126.160291
1.3 25 475 0.210046463 124.7720701
1.31 25 475 0.207150149 123.3963208
1.32 25 475 0.204279729 122.0328712
1.33 25 475 0.201434844 120.6815509
1.34 25 475 0.198615139 119.3421908
1.35 25 475 0.19582026 118.0146237
1.36 25 475 0.19304986 116.6986835
1.37 25 475 0.190303591 115.3942057
1.38 25 475 0.18758111 114.1010274
1.39 25 475 0.184882077 112.8189868
1.4 25 475 0.182206155 111.5479237
1.41 25 475 0.179553009 110.2876792
1.42 25 475 0.176922307 109.0380957
1.43 25 475 0.17431372 107.7990171
1.44 25 475 0.171726923 106.5702886
1.45 25 475 0.169161592 105.3517564
1.46 25 475 0.166617407 104.1432682
1.47 25 475 0.164094049 102.9446731
1.48 25 475 0.161591203 101.7558212
1.49 25 475 0.159108555 100.5765639
1.5 25 475 0.156645797 99.40675369
1.51 25 475 0.15420262 98.24624445
1.52 25 475 0.151778718 97.09489109
1.53 25 475 0.149373789 95.95254969
1.54 25 475 0.146987531 94.81907744
1.55 25 475 0.144619648 93.69433268
1.56 25 475 0.142269842 92.57817479
1.57 25 475 0.139937819 91.47046426
1.58 25 475 0.13762329 90.37106263
1.59 25 475 0.135325963 89.27983247
1.6 25 475 0.133045552 88.19663736
1.61 25 475 0.130781772 87.12134192
1.62 25 475 0.12853434 86.05381173
1.63 25 475 0.126302975 84.99391335
1.64 25 475 0.124087398 83.94151428
1.65 25 475 0.121887333 82.89648298
1.66 25 475 0.119702503 81.85868881
1.67 25 475 0.117532636 80.82800206
1.68 25 475 0.115377461 79.80429388
1.69 25 475 0.113236708 78.7874363
1.7 25 475 0.11111011 77.77730223
1.71 25 475 0.108997401 76.77376538
1.72 25 475 0.106898316 75.77670033
1.73 25 475 0.104812595 74.78598242
1.74 25 475 0.102739974 73.80148784
1.75 25 475 0.100680197 72.8230935
1.76 25 475 0.098633004 71.8506771
1.77 25 475 0.096598141 70.88411711
1.78 25 475 0.094575353 69.92329269
1.79 25 475 0.092564387 68.96808374
1.8 25 475 0.090564991 68.01837086
1.81 25 475 0.088576916 67.07403532
1.82 25 475 0.086599914 66.1349591
1.83 25 475 0.084633736 65.20102481
1.84 25 475 0.082678138 64.27211569
1.85 25 475 0.080732875 63.34811564
1.86 25 475 0.078797703 62.42890915
1.87 25 475 0.076872382 61.51438132
1.88 25 475 0.074956669 60.60441784
1.89 25 475 0.073050326 59.69890496
1.9 25 475 0.071153115 58.79772949
1.91 25 475 0.069264797 57.90077878
1.92 25 475 0.067385138 57.0079407
1.93 25 475 0.065513902 56.11910367
1.94 25 475 0.063650856 55.23415656
1.95 25 475 0.061795766 54.35298875
1.96 25 475 0.0599484 53.47549012
1.97 25 475 0.058108528 52.60155095
1.98 25 475 0.05627592 51.73106201
1.99 25 475 0.054450346 50.8639145
2 25 475 0.052631579 50

Figure 5: thermal analysis using FEA approach

You might also like