Computing Nusselt number

Hi FEniCS community. Im struggling to compute average Nusselt number below form paper (Nasrin & Parvin,2011)

Local Nusselt number:
nasrin_nu

Average Nusselt number:
nasrin_nu_2

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).

Please read Read before posting: How do I get my question answered?

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?

In addition, I want to find the average Nusselt number on the wavy wall. Using the problem above, the wavy wall is on the left (mark 5).

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).

As far as I understand, the chord length for the wavy surface is 1. Is it wrong?

As the length of one straight side of your box is 1, the choord length cannot be one.

I see. How can i calculate the chord length? So far i found the way to calculate chord length on circle. I dont know how to find on the wavy surface.

assemble(Constant(1)*ds(5))

Sorry, Dokken. Can I know, Constant(1) stands for?

Does it mean chord length or arc length? Thank you for your help Dokken.

I do not know how one defines chord length on a non circular segment,which is why i assumed it should be arch length.

Still can’t find the right value. Could someone help me to check the Nusselt coding? Thanks in advance!

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

Thank you Bragostin. Will try this!

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.