@@ -139,6 +139,75 @@ Subroutine Compute_Scalars(buffer)
139139 END_DO
140140 Call Add_Quantity(qty)
141141 Endif
142+
143+ ! only valid for active scalars
144+ if (ii .le. n_active_scalars) then
145+ ! NOTE: The ell=0 component of the r-momentum equation is entirely described by
146+ ! hydrostatic balance between the pressure and entropy and composition perturbations
147+ ! (the reference state is assumed to also be in hydrostatic balance).
148+ ! As such, the ell=0 buoancy force is uninteresting from the point of
149+ ! view of the flow. We explicitly separate the ell=0 component for this
150+ ! term (as with the entropy and pressure terms).
151+ ! -- full buoyancy
152+ If (compute_quantity(chi_buoyancy_force+ scoff) .or. compute_quantity(chi_buoy_work+ scoff)) Then
153+ DO_PSI
154+ qty(PSI) = ref% chi_buoyancy_coeff(ii,r)* (buffer(PSI,chivar)- &
155+ & ell0_values(r,chivar))
156+ END_DO
157+ If (compute_quantity(chi_buoyancy_force+ scoff))Call Add_Quantity(qty)
158+ If (compute_quantity(chi_buoy_work+ scoff)) Then
159+ DO_PSI
160+ qty(PSI)= buffer(PSI,vr)* qty(PSI)
161+ END_DO
162+ Call Add_Quantity(qty)
163+ Endif
164+ Endif
165+
166+ ! -- fluctuating buoyancy (ell = 0, m =0 already subtracted)
167+ If (compute_quantity(chi_buoyancy_pforce+ scoff) .or. compute_quantity(chi_buoy_work_pp+ scoff)) Then
168+ DO_PSI
169+ qty(PSI) = ref% chi_buoyancy_coeff(ii,r)* fbuffer(PSI,chivar)
170+ END_DO
171+ If (compute_quantity(chi_buoyancy_pforce+ scoff)) Call Add_Quantity(qty)
172+ If (compute_quantity(chi_buoy_work_pp+ scoff)) Then
173+ DO_PSI
174+ qty(PSI)= buffer(PSI,vr)* qty(PSI)
175+ END_DO
176+ Call Add_Quantity(qty)
177+ Endif
178+ Endif
179+
180+ ! -- mean buoyancy
181+ If (compute_quantity(chi_buoyancy_mforce+ scoff) .or. compute_quantity(chi_buoy_work_mm+ scoff)) Then
182+ DO_PSI
183+ qty(PSI) = ref% chi_buoyancy_coeff(ii,r)* (m0_values(PSI2,chivar)- &
184+ & ell0_values(r,chivar))
185+ END_DO
186+ If (compute_quantity(chi_buoyancy_mforce+ scoff)) Call Add_Quantity(qty)
187+ If (compute_quantity(chi_buoy_work_mm+ scoff)) Then
188+ DO_PSI
189+ qty(PSI)= buffer(PSI,vr)* qty(PSI)
190+ END_DO
191+ Call Add_Quantity(qty)
192+ Endif
193+ Endif
194+
195+ If (compute_quantity(chi_buoyancy_force_ell0+ scoff)) Then
196+ DO_PSI
197+ qty(PSI) = ref% chi_buoyancy_coeff(ii,r)* ell0_values(r,chivar)
198+ END_DO
199+ Call Add_Quantity(qty)
200+ Endif
201+
202+ ! Chi Buoyant Production of turbulent kinetic energy.
203+ If (compute_quantity(chi_production_buoyant_pKE+ scoff)) Then
204+ DO_PSI
205+ qty(PSI) = ref% chi_buoyancy_coeff(ii,r)* fbuffer(PSI,chivar)* fbuffer(PSI,vr)
206+ END_DO
207+ Call Add_Quantity(qty)
208+ Endif
209+ endif
210+
142211 Enddo
143212 End Subroutine Compute_Scalars
144213
0 commit comments