Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Solutions · 2. Steady diffusion and the harmonic mean at an interface

School of Engineering, Nazarbayev University

Worked solutions to the three exercises of Lecture 2. Each solution is computed here and checked with assert statements against an exact identity or an independent calculation. The first code cell sets up the notebook and runs Demonstration 1 of the lecture without showing its output, because some of the solutions use its variables.

Exercise 1

Problem. Verify the limit of a nearly perfect insulator (k0=200k_0 = 200, k1=10−8 W/(m⋅K)k_1 = 10^{-8}\ \mathrm{W/(m\cdot K)}) of harmonic_interface_conductivity on equal (ΔV=0.05,0.05\Delta V = 0.05, 0.05) and unequal (ΔV=0.02,0.08\Delta V = 0.02, 0.08) cell volumes, confirming k1/2harmk_{1/2}^{\mathrm{harm}} matches exact series thermal resistance.


Exercise 1: Perfect-Insulator Asymptotics & Non-Uniform Volume Harmonic Weighting
=================================================================================
Equal volumes   (0.05, 0.05): k_harm = 2.000000e-08 (~ 2.00 * k_ins) vs k_arith = 100.00 W/(m*K)
Unequal volumes (0.02, 0.08): k_harm = 1.250000e-08 (~ 1.25 * k_ins) vs exact = 1.250000e-08
Heat flux across insulator: FVM = 6.249820e-05 vs Exact = 6.250000e-05 W/m^2

Explanation. When k1≪k0k_1 \ll k_0, the series resistance δL/k0+δR/k1≈δR/k1\delta_L/k_0 + \delta_R/k_1 \approx \delta_R/k_1 is controlled by the insulating layer, giving k1/2harm≈δL+δRδR k1k_{1/2}^{\mathrm{harm}} \approx \frac{\delta_L + \delta_R}{\delta_R}\,k_1 (2k12 k_1 for equal cells, 1.25k11.25 k_1 for δL:δR=1:4\delta_L:\delta_R = 1:4) so the heat flux is very small (J=6.25×10−5 W/m2J = 6.25\times 10^{-5}\ \mathrm{W/m^2}).


Exercise 2

Problem. Quantify the exact heat-flux error from using full-cell distance Δx\Delta x instead of half-cell Δx/2\Delta x/2 at Dirichlet boundaries on linear conduction (k=10,L=1,TL=100,TR=0,N=10k=10, L=1, T_L=100, T_R=0, N=10), and verify ValueError guards on negative conductivity and unsupported BC names.


Exercise 2: Full-Cell vs Half-Cell Dirichlet Wall Conductance Bug
=================================================================
True half-cell FVM flux  = 1000.0000 W/m^2 (exact = 1000.0000)
Buggy full-cell FVM flux = 909.0909 W/m^2 (matches L_eff = L + dx = 909.0909, 9.09% error)

Explanation. Treating the boundary-to-centroid distance as Δx\Delta x instead of Δx/2\Delta x / 2 inserts a phantom Δx/2\Delta x / 2 slab on each wall, stretching the effective domain length to Leff=L+Δx=1.1 mL_{\mathrm{eff}} = L + \Delta x = 1.1\ \mathrm{m} and underpredicting heat flux by Δx/(L+Δx)=9.09%\Delta x / (L + \Delta x) = 9.09\%.


Exercise 3

Problem. Implement fvm_diffusion_1d_robin(x_faces, k_cells, q_source, h_left, T_inf_left, h_right, T_inf_right) using series film-plus-half-cell conductance GRobin=(1/h+δhalf/k)−1G_{\mathrm{Robin}} = (1/h + \delta_{\mathrm{half}}/k)^{-1}, and verify to rounding error against the exact Biot-number analytical parabola on [−0.05,0.05] m[-0.05, 0.05]\ \mathrm{m} (q′′′=5×105 W/m3,k=25 W/(m⋅K),h=250 W/(m2⋅K),T∞=300 Kq''' = 5\times 10^5\ \mathrm{W/m^3}, k = 25\ \mathrm{W/(m\cdot K)}, h = 250\ \mathrm{W/(m^2\cdot K)}, T_\infty = 300\ \mathrm{K}).


Exercise 3: Implement It Yourself — 1-D FVM Diffusion with Convective Robin Boundary Conditions
===============================================================================================
Biot Bi = 0.50 | Stretched Robin errors (N=16,32,64): [0.3414, 0.0875, 0.022] K (order = 1.991)
Symmetric outward wall fluxes: -J_left = 25000.00, +J_right = 25000.00 vs q*L_half = 25000.00 W/m^2

Summary. Combining convective film resistance 1/h1/h and half-cell conductive resistance δhalf/k\delta_{\mathrm{half}}/k in series reproduces Robin cooling with second-order accuracy on stretched meshes (observed order 1.99), recovering pure Neumann (GRobin→0G_{\mathrm{Robin}} \to 0 as h→0h \to 0) and pure Dirichlet (GRobin→k/δhalfG_{\mathrm{Robin}} \to k/\delta_{\mathrm{half}} as h→∞h \to \infty) as exact limits.