Skip to content

Energy diffusion flux applied twice for chemistry + surface_tension without viscous #1909

Description

@sbryngelson

In s_compute_additional_physics_rhs (src/simulation/m_rhs.fpp) each of the three direction blocks has this shape:

if (surface_tension .or. viscous .or. heat_conduction) then
    do i = eqn_idx%mom%beg, eqn_idx%E          ! <-- includes E
        rhs_vf(i) = rhs_vf(i) + (flux_src(i, prev) - flux_src(i, cur))/d
    end do
end if

if (chem_params%diffusion) then
    do i = eqn_idx%species%beg, eqn_idx%species%end
        ...
    end do
    if (.not. viscous) then                     ! <-- adds E again
        rhs_vf(eqn_idx%E) = rhs_vf(eqn_idx%E) + (flux_src(E, prev) - flux_src(E, cur))/d
    end if
end if

The .not. viscous guard on the second energy contribution was correct when viscous was the only other thing that could take the first branch. It no longer is: with chemistry + surface_tension and viscous = F, the first loop already added the energy source flux over mom%beg:E, and the chem block adds it a second time. The energy diffusion flux is applied twice in every direction.

The guard should match the condition on the first block:

if (.not. (viscous .or. surface_tension .or. heat_conduction)) then

(The heat_conduction combination is rejected at input check as of #1906, so the live case today is chemistry + surface_tension without viscous. The surface_tension half predates that PR.)

Found while adding Fourier heat conduction (#1906).

Activity

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