Skip to content

Bug in divergence with SVLES mode #16627

Closed

Description

@ericvmueller

The divergence contribution from sensible-enthalpy advection is

$$ -\frac{\mathbf{u}\cdot\nabla(\rho h_s)} {\rho c_p T}. $$

But this term is only included if CONSTANT_SPECIFIC_HEAT_RATIO=F, which is not the case for SVLES:

fds/Source/divg.f90

Lines 585 to 590 in e14ec3f

! Compute U_DOT_DEL_RHO_H_S and add to other enthalpy equation source terms
CONST_GAMMA_IF_1: IF (.NOT.CONSTANT_SPECIFIC_HEAT_RATIO) THEN
CALL ENTHALPY_ADVECTION_NEW(U_DOT_DEL_RHO_H_S) ! Compute u dot grad rho h_s

However, I don't think it should be dropped entirely. For fixed $c_p$

$$ \rho h_s = \rho c_p T = \frac{c_p}{R}\bar{p} $$

This only varies in z so that

$$ -\frac{\mathbf{u}\cdot\nabla(\rho h_s)} {\rho c_p T} = -\frac{w(c_p/R)\rho_0 g_z}{\rho c_p T} $$

This can be combined with the explicit atmospheric stratification term in the divergence equation:

$$ \frac{w\rho_0 g_z}{\rho c_p T} $$

To give the following

$$ \frac{w\rho_0 g_z}{\rho c_p T}\left[1-\frac{c_p}{R}\right] $$

For a constant specific heat ratio $\gamma$, this is equivalent to

$$ -\frac{1}{\gamma-1}\frac{w\rho_0 g_z}{\rho c_p T} $$

This has an opposite sign and magnitude to the current version (where we have only the stratification term). The consequence in the current code is that rising warm air is artificially cooled and loses buoyancy, suppressing vertical motion even in a neutrally stratified atmosphere.

As an example, take the lee_waves.fds verification case. Running with SVLES gives rather bad results

Image

when compared to VLES

Image.

I applied a fix that includes the advection term, as I wrote above. This gets back to the VLES results while keeping the constant specific heat ratio assumption in place

Image.

My change passed firebot but just want to run it by others (and also document the issue) before I open a PR.

Activity

  1. rmcdermo commented on Oct 6, 2026

    @rmcdermo
    Contributor

    @ericvmueller In the tech guide we explain that to get \grad(rho*h_s) to be zero you need both CONSTANT_SPECIFIC_HEAT_RATIO=T and STRATIFICATION=F. However, it seems the code does not respect both of these requirements.

    Instead of adding more logic, I would propose that we add the STRATIFICATION=F component to divg.

    In general, I am in favor of getting rid of SVLES as a mode of operation. I think we need to be simplifying instead of adding more options for users. Our efforts should be focussed on speeding up the robust parts of the code via "flattening" , GPU, etc.

  2. ericvmueller commented on Oct 6, 2026

    @ericvmueller
    ContributorAuthor

    Okay. I was using SVLES mode mostly to match assumptions with another code for comparison purposes, but otherwise I don't have strong feelings about it. It is a minor tweak I made, but if we don't go that route then yeah, I'm not sure there are many cases where you would want SVLES without stratification. The users guide is also off on the CFL norm that is used in this mode, from what I can see.

  3. rmcdermo commented on Oct 7, 2026

    @rmcdermo
    Contributor

    Should be fixed with PR #16632 . lee_waves.fds case gives:

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions