Hi FEniCS community. Im struggling to compute average Nusselt number below form paper (Nasrin & Parvin,2011)
Local Nusselt number:
Average Nusselt number:
This is my code:
ds = Measure( 'ds', domain=mesh, subdomain_data=boundaries)
n = Facetnormal(mesh)
#local Nu
grad_norm = -dot(grad(T), n)* ds(3) #mark:3 for bottom wavy wall, L=1 for the length of cavity
#average Nu
Nu = assemble(grad_norm)
print(Nu)
Could you please point out the mistake? I get the value but not the right one. Thanks in advance!
As far as I am aware, this is the correct definititon of the Nusslet number.
Note that in the paper you are considering they have scaled the temperature \theta=\frac{T-T_{cold}}{T_{hot}-T_{cold}} which you have not done in your equation, and can account for a difference.
Note that just supplying a snippet of your code is not very helpful, as you have not provided what problem you are solving (mathematically), a minimal working code example, and what values you expect (and which you actually achieve).
Thank you Dokken. I am solving this problem sinusoidal cavity. I already got the solution of dimensionless(scaled) velocity u, temperature T (same as theta) and concentration C. Using the solution T, I want to find the Nusselt number. However, I can’t get the right value. Could you point it out?
I do not have the bandwidth to familiarize myself with the that paper, the PDEs and the corresponding weak formulations, as well as debugging your whole code. You should:
a) Make sure you have the correct weak formulation, check if your streamlines matches those of the paper
b) Check with a flat geometry
c) Refine your mesh and check if the Nusselt number converges
d) Check your definititon of the Nusselt number. You have not scaled it with 1/S (where S is the chord length).
I am using this method to calculate the average Nusselt number along a duct:
def boundary_values(var, FS, boundaries, association_table, bc):
vs = list(set(sum((f.entities(0).tolist() for f in SubsetIterator(boundaries, association_table[bc])), [])))
# Get degrees of freedom associated to vertices (by indices)
v2d = vertex_to_dof_map(VP)
d = v2d[vs]
nd = VP.dim()
dim = mesh.geometry().dim()
coordinates = VP.tabulate_dof_coordinates()
coordinates.resize((nd, dim))
xyz = coordinates[d]
bnd_val = var[d]
return bnd_val
Area = assemble(T/T*ds_bc(association_table["noslip"]))
VP = FunctionSpace(mesh, 'P', 1)
Tmin = boundary_values(np.array(T.vector()), VP, boundaries, association_table, "outlet").min()
Tm = max(T_0+1e-3, Tmin)
def DTm(T, T_0, Tm): # Log Mean Tempearature Difference is used to calculate Nu_m_T in Shah & London, Laminar Flow Forced Convection in Ducts, 1978
return ((T - T_0) - (T - Tm)) / ln((T - T_0) / (T - Tm))
htc_avg = assemble(dot(n, htc)/DTm(T,T_0,Tm)*ds_bc(association_table["noslip"])) / Area
Nu = htc_avg * Dh / k
Although there is probably a better method to calculate the surface area than integrating T/T!
The whole script is there: https://github.com/bragostin/Fenics
Meanwhile I have tried a global method too: Heat Transfer Coefficient Calculation
It would seem that integrating the local Nusselt numbers requires a very fine meshing at the wall to get an accurate value.