forked from idaholab/TMAP8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding val-1fa and val-1fb verification cases idaholab#12
- Loading branch information
1 parent
1a46419
commit b34d2e0
Showing
21 changed files
with
607 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# val-1fa | ||
|
||
# Heat Conduction with Heat Generation | ||
|
||
This heat transfer verification problem is taken from [!cite](longhurst1992verification). In this problem heat conduction through a slab is modeled. The slab has heat generation. One end of the slab is kept at a constant temperature of 300K while the other end acts as an adiabatic surface. The analytical solution for this case is given as: | ||
|
||
\begin{equation} | ||
T = T_s \;+\; \frac{QL^2}{2k} \left(1-\frac{x^2}{L^2}\right) | ||
\end{equation} | ||
|
||
where: | ||
|
||
$Q$ : internal heat generation rate (10,000 W/m$^3$) | ||
|
||
$L$ : length of the slab (1.6 m) | ||
|
||
$k$ : thermal conductivity (10 W/m-K) | ||
|
||
$T_s$ : imposed surface temperature (300 K) | ||
|
||
|
||
The slab is assumed to have a density of 1 kg/m$^3$ and a specific heat capabity of 1 J/kg-K. | ||
|
||
Comparison of the temperature computed through TMAP8 and calculated analytically is shown in | ||
[val-1fa_comparison_temperature]. The TMAP8 code predictions match very well with | ||
the analytical solution. | ||
|
||
!media figures/val-1fa_comparison_temperature.png | ||
style=width:60%;margin-bottom:2% | ||
id=val-1fa_comparison_temperature | ||
caption=Comparison of temperature along the slab calculated | ||
through TMAP8 and analytically | ||
|
||
!bibtex bibliography |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# val-1fb | ||
|
||
# Thermal Transient in a Slab | ||
|
||
This verification problem is taken from [!cite](ambrosek2008verification). In this problem thermal transient in a slab is modeled. The ends of a slab are kept fixed at different temperatures. The temperature distribution in the slab evolves from an initial state to steady-state. The analytical solution for this case is given as: | ||
|
||
\begin{equation} | ||
T(x,t) = T_o \;+\; (T_1-T_o)\Bigg\{1-\frac{x}{L}-\frac{2}{L}\sum_{m=1}^{\infty} \left(\frac{1}{\lambda_m} \sin(\lambda_m x) \exp(-\alpha \lambda_m^2 t) \right)\Bigg\} | ||
\end{equation} | ||
|
||
where: | ||
|
||
|
||
$T$ : temperature in the slab (K) | ||
|
||
|
||
$x$ : distance across the slab (m) | ||
|
||
$t$ : time (seconds) | ||
|
||
$T_o$ : fixed temperature at one end of the slab (400 K) | ||
|
||
$T_1$ : fixed temperature at the other end of the slab (300 K) | ||
|
||
$L$ : length of the slab (4.0 m) | ||
|
||
$\lambda_m$ : $\frac{m\pi}{L}$ | ||
|
||
$\alpha$ : thermal diffusivity (1.0 m$^2$/s) where | ||
|
||
\begin{equation} | ||
\alpha = \frac{k}{\rho C_p} | ||
\end{equation} | ||
|
||
$k$ is the thermal conductivity, $\rho$ is the density and $C_p$ is the specific heat capacity of the slab material. | ||
|
||
# | ||
|
||
|
||
Comparison of the temperature distribution in the slab, computed through TMAP8 and calculated analytically, is shown in [val-1fb_comparison_temperature]. The TMAP8 code predictions match very well with the analytical solution. | ||
|
||
!media figures/val-1fb_comparison_temperature.png | ||
style=width:60%;margin-bottom:2% | ||
id=val-1fb_comparison_temperature | ||
caption=Comparison of temperature distribution in the slab calculated | ||
through TMAP8 and analytically | ||
|
||
!bibtex bibliography |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import csv | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from matplotlib import gridspec | ||
import pandas as pd | ||
from scipy import special | ||
|
||
|
||
|
||
fig = plt.figure(figsize=[6.5,5.5]) | ||
gs = gridspec.GridSpec(1,1) | ||
ax = fig.add_subplot(gs[0]) | ||
|
||
analytical_x = np.linspace(0.0, 1.6, 40) | ||
Ts = 300 | ||
k = 10 | ||
L = 1.6 | ||
Q = 10000 | ||
analytical_temp = Ts + Q*L**2 * (1- analytical_x**2/L**2) / (2*k) | ||
ax.scatter(analytical_x,analytical_temp,label=r"Analytical",c='k', marker='^') | ||
|
||
tmap_sol = pd.read_csv("./gold/u_vs_x.csv") | ||
tmap_x = tmap_sol['id'] | ||
tmap_temp = tmap_sol['temp'] | ||
ax.plot(tmap_x,tmap_temp,label=r"TMAP8",c='tab:gray') | ||
|
||
ax.set_xlabel(u'Distance along slab (m)') | ||
ax.set_ylabel(u"Temperature (K)") | ||
ax.legend(loc="best") | ||
#ax.set_xlim(left=0) | ||
ax.set_ylim(bottom=0) | ||
plt.grid(visible=True, which='major', color='0.65', linestyle='--', alpha=0.3) | ||
|
||
ax.minorticks_on() | ||
plt.savefig('val-1fa_comparison_temperature.png', bbox_inches='tight'); | ||
plt.close(fig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
id,temp,x,y,z | ||
0,1579.9999253845,0,0,0 | ||
0.041025641025641,1578.3588998614,0.041025641025641,0,0 | ||
0.082051282051282,1576.553771786,0.082051282051282,0,0 | ||
0.12307692307692,1571.630695216,0.12307692307692,0,0 | ||
0.16410256410256,1566.3794135412,0.16410256410256,0,0 | ||
0.20512820512821,1558.1742859222,0.20512820512821,0,0 | ||
0.24615384615385,1549.4768506453,0.24615384615385,0,0 | ||
0.28717948717949,1537.9896719737,0.28717948717949,0,0 | ||
0.32820512820513,1525.8460830905,0.32820512820513,0,0 | ||
0.36923076923077,1511.0768533612,0.36923076923077,0,0 | ||
0.41025641025641,1495.4871108659,0.41025641025641,0,0 | ||
0.45128205128205,1477.4358300725,0.45128205128205,0,0 | ||
0.49230769230769,1458.3999339575,0.49230769230769,0,0 | ||
0.53333333333333,1437.0666020922,0.53333333333333,0,0 | ||
0.57435897435897,1414.5845523486,0.57435897435897,0,0 | ||
0.61538461538462,1389.9691694025,0.61538461538462,0,0 | ||
0.65641025641026,1364.0409660198,0.65641025641026,0,0 | ||
0.6974358974359,1336.1435319825,0.6974358974359,0,0 | ||
0.73846153846154,1306.7691749489,0.73846153846154,0,0 | ||
0.77948717948718,1275.5896898089,0.77948717948718,0,0 | ||
0.82051282051282,1242.7691791112,0.82051282051282,0,0 | ||
0.86153846153846,1208.307642856,0.86153846153846,0,0 | ||
0.9025641025641,1172.0409784799,0.9025641025641,0,0 | ||
0.94358974358974,1134.2973910957,0.94358974358974,0,0 | ||
0.98461538461538,1094.5845730256,0.98461538461538,0,0 | ||
1.025641025641,1053.5589344981,1.025641025641,0,0 | ||
1.0666666666667,1010.3999627174,1.0666666666667,0,0 | ||
1.1076923076923,966.09227303116,1.1076923076923,0,0 | ||
1.1487179487179,919.48714752242,1.1487179487179,0,0 | ||
1.1897435897436,871.8974066612,1.1897435897436,0,0 | ||
1.2307692307692,821.84612740614,1.2307692307692,0,0 | ||
1.2717948717949,770.97433535315,1.2717948717949,0,0 | ||
1.3128205128205,717.47690233283,1.3128205128205,0,0 | ||
1.3538461538462,663.32305907068,1.3538461538462,0,0 | ||
1.3948717948718,606.37947226561,1.3948717948718,0,0 | ||
1.4358974358974,548.94357777648,1.4358974358974,0,0 | ||
1.4769230769231,488.55383716672,1.4769230769231,0,0 | ||
1.5179487179487,427.83589143245,1.5179487179487,0,0 | ||
1.5589743589744,363.99999699781,1.5589743589744,0,0 | ||
1.6,300,1.6,0,0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Tests] | ||
design = 'HeatConduction.md HeatConductionTimeDerivative.md HeatSource.md' | ||
issues = '#12' | ||
[heat_conduction_generation] | ||
type = Exodiff | ||
input = val-1fa.i | ||
exodiff = val-1fa_out.e | ||
requirement = 'The system shall be able to model heat conduction in a slab that has heat generation' | ||
verification = 'val-1fa.md' | ||
[] | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 1 | ||
xmax = 1.6 | ||
nx = 20 | ||
[] | ||
|
||
[Variables] | ||
[./temp] | ||
initial_condition = 300.0 | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
[./heat] | ||
type = HeatConduction | ||
variable = temp | ||
[../] | ||
[./heatsource] | ||
type = HeatSource | ||
function = volumetric_heat | ||
variable = temp | ||
[../] | ||
[./HeatTdot] | ||
type = HeatConductionTimeDerivative | ||
variable = temp | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
[./lefttemp] | ||
type = DirichletBC | ||
boundary = right | ||
variable = temp | ||
value = 300 | ||
[../] | ||
[./rightflux] | ||
type = NeumannBC | ||
boundary = left | ||
variable = temp | ||
value = 0 | ||
[../] | ||
[] | ||
|
||
[Materials] | ||
[./density] | ||
type = GenericConstantMaterial | ||
prop_names = 'density thermal_conductivity specific_heat' | ||
prop_values = '1.0 10.0 1.0' | ||
[../] | ||
[] | ||
|
||
[Functions] | ||
[./volumetric_heat] | ||
type = ParsedFunction | ||
value = 1.0e4 | ||
[../] | ||
[] | ||
|
||
[Preconditioning] | ||
[./SMP] | ||
type = SMP | ||
full = true | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Transient | ||
scheme = bdf2 | ||
solve_type = PJFNK | ||
petsc_options_iname = '-pc_type -ksp_grmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap' | ||
petsc_options_value = 'asm 101 preonly ilu 1' | ||
nl_rel_tol = 1e-8 | ||
nl_abs_tol = 1e-10 | ||
l_tol = 1e-4 | ||
dt = 1 | ||
end_time = 10 | ||
automatic_scaling = true | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[line] | ||
type = LineValueSampler | ||
start_point = '0 0 0' | ||
end_point = '1.6 0 0' | ||
num_points = 40 | ||
sort_by = 'x' | ||
variable = temp | ||
[] | ||
[] | ||
|
||
[Outputs] | ||
execute_on = FINAL | ||
exodus = false | ||
csv = true | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import csv | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from matplotlib import gridspec | ||
import pandas as pd | ||
from scipy import special | ||
|
||
|
||
|
||
fig = plt.figure(figsize=[6.5,5.5]) | ||
gs = gridspec.GridSpec(1,1) | ||
ax = fig.add_subplot(gs[0]) | ||
|
||
num_summation_terms = 10 | ||
|
||
def summation_terms(n, x, t, alph): | ||
sum = 0.0 | ||
for m in range(1, n): | ||
lambdaa = m * np.pi / L | ||
sum += np.sin(lambdaa * x) * np.exp(-1 * alph * lambdaa**2 * t) / lambdaa | ||
return sum | ||
|
||
analytical_x = np.linspace(0.0, 4.0, 40) | ||
To = 300 | ||
T1 = 400 | ||
alpha = 1.0 | ||
L = 4.0 | ||
time = [0.1, 0.5, 1.0, 5.0] | ||
|
||
analytical_temp =[] | ||
for i in range(len(time)): | ||
analytical_temp.append(To + (T1-To) * (1 - (analytical_x/L) - (2/L) * summation_terms(num_summation_terms, analytical_x, time[i], alpha))) | ||
|
||
ax.scatter(analytical_x,analytical_temp[0],label=r"Analytical 0.1 seconds",c='k', marker='^') | ||
ax.scatter(analytical_x,analytical_temp[1],label=r"Analytical 0.5 seconds",c='r', marker='^') | ||
ax.scatter(analytical_x,analytical_temp[2],label=r"Analytical 1.0 seconds",c='b', marker='^') | ||
ax.scatter(analytical_x,analytical_temp[3],label=r"Analytical 5.0 seconds",c='c', marker='^') | ||
|
||
tmap_temp = [] | ||
tmap_sol = pd.read_csv("./gold/u_vs_x_0pt1sec.csv") | ||
tmap_x = tmap_sol['id'] | ||
tmap_temp.append(tmap_sol['temp']) | ||
tmap_sol = pd.read_csv("./gold/u_vs_x_0pt5sec.csv") | ||
tmap_temp.append(tmap_sol['temp']) | ||
tmap_sol = pd.read_csv("./gold/u_vs_x_1pt0sec.csv") | ||
tmap_temp.append(tmap_sol['temp']) | ||
tmap_sol = pd.read_csv("./gold/u_vs_x_5pt0sec.csv") | ||
tmap_temp.append(tmap_sol['temp']) | ||
|
||
ax.plot(tmap_x,tmap_temp[0],label=r"TMAP8 0.1 seconds",c='k') | ||
ax.plot(tmap_x,tmap_temp[1],label=r"TMAP8 0.5 seconds",c='r') | ||
ax.plot(tmap_x,tmap_temp[2],label=r"TMAP8 1.0 seconds",c='b') | ||
ax.plot(tmap_x,tmap_temp[3],label=r"TMAP8 5.0 seconds",c='c') | ||
|
||
|
||
ax.set_xlabel(u'Distance along slab (m)') | ||
ax.set_ylabel(u"Temperature (K)") | ||
ax.legend(loc="best") | ||
#ax.set_xlim(left=0) | ||
ax.set_ylim(bottom=300) | ||
plt.grid(visible=True, which='major', color='0.65', linestyle='--', alpha=0.3) | ||
|
||
ax.minorticks_on() | ||
plt.savefig('val-1fb_comparison_temperature.png', bbox_inches='tight'); | ||
plt.close(fig) |
Oops, something went wrong.