def les_update(u_ab, nut_, nut_form, dt, CG1, tstep, DynamicSmagorinsky, Cs, u_CG1, u_filtered, Lij, Mij, JLM, JMM, dim, tensdim, G_matr, G_under, ll, dummy, uiuj_pairs, Sijmats, Sijcomps, Sijfcomps, delta_CG1_sq, Qij, Nij, JNN, JQN, **NS_namespace): # Check if Cs is to be computed, if not update nut_ and break if tstep % DynamicSmagorinsky["Cs_comp_step"] != 0: # Update nut_ nut_() # Break function return # All velocity components must be interpolated to CG1 then filtered for i in xrange(dim): # Interpolate to CG1 ll.interpolate(u_CG1[i], u_ab[i]) # Filter tophatfilter(unfiltered=u_CG1[i], filtered=u_filtered[i], **vars()) # Compute Lij from dynamic modules function compute_Lij(u=u_CG1, uf=u_filtered, **vars()) # Compute Mij from dynamic modules function alpha = 2. magS = compute_Mij(alphaval=alpha, u_nf=u_CG1, u_f=u_filtered, **vars()) # Lagrange average Lij and Mij lagrange_average(J1=JLM, J2=JMM, Aij=Lij, Bij=Mij, **vars()) # Now u needs to be filtered once more for i in xrange(dim): # Filter tophatfilter(unfiltered=u_filtered[i], filtered=u_filtered[i], weight=1, **vars()) # Compute Qij from dynamic modules function compute_Qij(uf=u_filtered, **vars()) # Compute Nij from dynamic modules function alpha = 4. compute_Nij(alphaval=alpha, u_f=u_filtered, **vars()) # Lagrange average Qij and Nij lagrange_average(J1=JQN, J2=JNN, Aij=Qij, Bij=Nij, **vars()) # UPDATE Cs**2 = (JLM*JMM)/beta, beta = JQN/JNN beta = (JQN.vector().array() / JNN.vector().array()).clip(min=0.5) Cs.vector().set_local((np.sqrt( (JLM.vector().array() / JMM.vector().array()) / beta))) Cs.vector().apply("insert") tophatfilter(unfiltered=Cs, filtered=Cs, N=2, weight=1, **vars()) Cs.vector().set_local(Cs.vector().array().clip(max=0.3)) Cs.vector().apply("insert") # Update nut_ nut_.vector().set_local(Cs.vector().array()**2 * delta_CG1_sq.vector().array() * magS) nut_.vector().apply("insert")
def les_update(u_ab, nut_, nut_form, dt, CG1, tstep, DynamicSmagorinsky, Cs, u_CG1, u_filtered, Lij, Mij, JLM, JMM, dim, tensdim, G_matr, G_under, ll, dummy, uiuj_pairs, Sijmats, Sijcomps, Sijfcomps, delta_CG1_sq, Qij, Nij, JNN, JQN, **NS_namespace): # Check if Cs is to be computed, if not update nut_ and break if tstep%DynamicSmagorinsky["Cs_comp_step"] != 0: # Update nut_ nut_() # Break function return # All velocity components must be interpolated to CG1 then filtered for i in xrange(dim): # Interpolate to CG1 ll.interpolate(u_CG1[i], u_ab[i]) # Filter tophatfilter(unfiltered=u_CG1[i], filtered=u_filtered[i], **vars()) # Compute Lij from dynamic modules function compute_Lij(u=u_CG1, uf=u_filtered, **vars()) # Compute Mij from dynamic modules function alpha = 2. magS = compute_Mij(alphaval=alpha, u_nf=u_CG1, u_f=u_filtered, **vars()) # Lagrange average Lij and Mij lagrange_average(J1=JLM, J2=JMM, Aij=Lij, Bij=Mij, **vars()) # Now u needs to be filtered once more for i in xrange(dim): # Filter tophatfilter(unfiltered=u_filtered[i], filtered=u_filtered[i], weight=1, **vars()) # Compute Qij from dynamic modules function compute_Qij(uf=u_filtered, **vars()) # Compute Nij from dynamic modules function alpha = 4. compute_Nij(alphaval=alpha, u_f=u_filtered, **vars()) # Lagrange average Qij and Nij lagrange_average(J1=JQN, J2=JNN, Aij=Qij, Bij=Nij, **vars()) # UPDATE Cs**2 = (JLM*JMM)/beta, beta = JQN/JNN beta = (JQN.vector().array()/JNN.vector().array()).clip(min=0.5) Cs.vector().set_local((np.sqrt((JLM.vector().array()/JMM.vector().array())/beta))) Cs.vector().apply("insert") tophatfilter(unfiltered=Cs, filtered=Cs, N=2, weight=1, **vars()) Cs.vector().set_local(Cs.vector().array().clip(max=0.3)) Cs.vector().apply("insert") # Update nut_ nut_.vector().set_local(Cs.vector().array()**2 * delta_CG1_sq.vector().array() * magS) nut_.vector().apply("insert")
def les_update(u_ab, nut_, nut_form, dt, CG1, delta, tstep, DynamicSmagorinsky, Cs, u_CG1, u_filtered, Lij, Mij, JLM, JMM, dim, tensdim, G_matr, G_under, ll, dummy, uiuj_pairs, Sijmats, Sijcomps, Sijfcomps, delta_CG1_sq, **NS_namespace): # Check if Cs is to be computed, if not update nut_ and break if tstep%DynamicSmagorinsky["Cs_comp_step"] != 0: # Update nut_ nut_() # Break function return # All velocity components must be interpolated to CG1 then filtered for i in xrange(dim): # Interpolate to CG1 ll.interpolate(u_CG1[i], u_ab[i]) # Filter tophatfilter(unfiltered=u_CG1[i], filtered=u_filtered[i], **vars()) # Compute Lij applying dynamic modules function compute_Lij(u=u_CG1, uf=u_filtered, **vars()) # Compute Mij applying dynamic modules function alpha = 2.0 magS = compute_Mij(alphaval=alpha, u_nf=u_CG1, u_f=u_filtered, **vars()) # Lagrange average Lij and Mij lagrange_average(J1=JLM, J2=JMM, Aij=Lij, Bij=Mij, **vars()) # Update Cs = sqrt(JLM/JMM) and filter/smooth Cs, then clip at 0.3. """ Important that the term in nut_form is Cs**2 and not Cs since Cs here is stored as sqrt(JLM/JMM). """ Cs.vector().set_local(np.sqrt(JLM.vector().array()/JMM.vector().array())) Cs.vector().apply("insert") tophatfilter(unfiltered=Cs, filtered=Cs, N=2, weight=1., **vars()) Cs.vector().set_local(Cs.vector().array().clip(max=0.3)) Cs.vector().apply("insert") # Update nut_ nut_.vector().set_local(Cs.vector().array()**2 * delta_CG1_sq.vector().array() * magS) nut_.vector().apply("insert")
def les_update(u_ab, nut_, nut_form, dt, CG1, delta, tstep, DynamicSmagorinsky, Cs, u_CG1, u_filtered, Lij, Mij, JLM, JMM, dim, tensdim, G_matr, G_under, ll, dummy, uiuj_pairs, Sijmats, Sijcomps, Sijfcomps, delta_CG1_sq, **NS_namespace): # Check if Cs is to be computed, if not update nut_ and break if tstep % DynamicSmagorinsky["Cs_comp_step"] != 0: # Update nut_ nut_() # Break function return # All velocity components must be interpolated to CG1 then filtered for i in xrange(dim): # Interpolate to CG1 ll.interpolate(u_CG1[i], u_ab[i]) # Filter tophatfilter(unfiltered=u_CG1[i], filtered=u_filtered[i], **vars()) # Compute Lij applying dynamic modules function compute_Lij(u=u_CG1, uf=u_filtered, **vars()) # Compute Mij applying dynamic modules function alpha = 2.0 magS = compute_Mij(alphaval=alpha, u_nf=u_CG1, u_f=u_filtered, **vars()) # Lagrange average Lij and Mij lagrange_average(J1=JLM, J2=JMM, Aij=Lij, Bij=Mij, **vars()) # Update Cs = sqrt(JLM/JMM) and filter/smooth Cs, then clip at 0.3. """ Important that the term in nut_form is Cs**2 and not Cs since Cs here is stored as sqrt(JLM/JMM). """ Cs.vector().set_local(np.sqrt(JLM.vector().array() / JMM.vector().array())) Cs.vector().apply("insert") tophatfilter(unfiltered=Cs, filtered=Cs, N=2, weight=1., **vars()) Cs.vector().set_local(Cs.vector().array().clip(max=0.3)) Cs.vector().apply("insert") # Update nut_ nut_.vector().set_local(Cs.vector().array()**2 * delta_CG1_sq.vector().array() * magS) nut_.vector().apply("insert")