amr-wind icon indicating copy to clipboard operation
amr-wind copied to clipboard

Use multiply_rho true for potential temperature evolution

Open marchdf opened this issue 1 year ago • 4 comments

Summary

Use multiply_rho true for potential temperature evolution and adapt for multiphase sims.

Pull request type

Please check the type of change introduced:

  • [ ] Bugfix
  • [x] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

Checklist

The following is included:

  • [ ] new unit-test(s)
  • [ ] new regression test(s)
  • [ ] documentation for new capability

This PR was tested by running:

  • the unit tests
    • [ ] on GPU
    • [ ] on CPU
  • the regression tests
    • [ ] on GPU
    • [ ] on CPU

Closes #1493

marchdf avatar Feb 20 '25 20:02 marchdf

The following tests FAILED:
         25 - abl_stable (Failed)                               no_ci regression -> O(1e-10) diffs
         31 - abl_multiphase_laminar (Failed)                   no_ci regression -> machine diffs
         32 - abl_waves_terrain (Failed)                        no_ci regression -> machine diffs
         33 - act_abl_joukowskydisk (Failed)                    no_ci regression -> machine diffs
         34 - act_abl_uniformctdisk (Failed)                    no_ci regression -> machine diffs
         87 - hbl_godunov (Failed)                              no_ci regression -> O(1e-6) diffs
         95 - forest_drag (Failed)                              no_ci regression -> machine diffs
        107 - abl_meso_input_dpa (Failed)                       no_ci regression  -> machine diffs
        108 - abl_meso_input_ipa (Failed)                       no_ci regression  -> machine diffs
        109 - abl_meso_tendency (Failed)                        no_ci regression -> O(1e-6) diffs
        110 - abl_kosovic_neutral (Failed)                      no_ci regression  -> machine diffs
        112 - abl_kosovic_neutral_ib (Failed)                   no_ci regression -> machine diffs
        113 - nrel_precursor (Failed)                           no_ci regression -> machine diffs
        129 - abl_multiphase_w2a (Failed)                       no_ci regression -> O(1) diffs

what do we think of these @mbkuhn ?

marchdf avatar Feb 24 '25 19:02 marchdf

fun. looks like I need to check the abl_stable, hbl_godunov, abl_meso_tendency, and abl_multiphase_w2a tests. I'm not too worried about the machine diffs. By the way, are these diffs between main and this PR, or are they diffs for this PR, before and after my commits to it?

mbkuhn avatar Feb 24 '25 20:02 mbkuhn

these are diffs between main and this PR

marchdf avatar Feb 24 '25 21:02 marchdf

For the reg tests with bigger diffs (listed below), I get the same diffs between main and your first commit e6eaab5, which just sets multiply_rho = true, as between main and the latest commit on this PR. These also match the diffs you report.

  • abl_stable
  • hbl_godunov
  • abl_meso_tendency

This means I was wrong about the implications of tweaking incflo_advance. That appears to have no effect, while multiply_rho is actually having a noticeable effect for certain cases. I'll still have to analyze, separately from this, where the large diffs in abl_multiphase_w2a are coming from.

mbkuhn avatar Feb 25 '25 04:02 mbkuhn

we can now redo the reg test on this one, comparing to the latest main

mbkuhn avatar Apr 02 '25 18:04 mbkuhn

Ok I am seeing these fail:

The following tests FAILED:
         25 - abl_stable (Failed)                               no_ci regression
         31 - abl_multiphase_laminar (Failed)                   no_ci regression
         32 - abl_waves_terrain (Failed)                        no_ci regression
         33 - act_abl_joukowskydisk (Failed)                    no_ci regression
         34 - act_abl_uniformctdisk (Failed)                    no_ci regression
         87 - hbl_godunov (Failed)                              no_ci regression
         95 - forest_drag (Failed)                              no_ci regression
        107 - abl_meso_input_dpa (Failed)                       no_ci regression
        108 - abl_meso_input_ipa (Failed)                       no_ci regression
        109 - abl_meso_tendency (Failed)                        no_ci regression
        110 - abl_kosovic_neutral (Failed)                      no_ci regression
        112 - abl_kosovic_neutral_ib (Failed)                   no_ci regression
        113 - nrel_precursor (Failed)                           no_ci regression
        129 - abl_multiphase_w2a (Failed)                       no_ci regression
        134 - abl_bndry_input_native_inout (Failed)             no_ci regression
        140 - abl_multiphase_laminar_input (Not Run)            no_ci regression
        145 - nrel_terrain (Not Run)                            no_ci regression
        146 - nrel_terrain_amr (Not Run)                        no_ci regression

But only these are more than machine:

abl_multiphase_w2a
abl_bndry_input_native_inout
abl_meso_input_ipa
abl_meso_input_dpa
abl_meso_tendency

marchdf avatar Apr 02 '25 20:04 marchdf

ok, so we fixed abl_stable and hbl_godunov, but we have some new ones to understand

mbkuhn avatar Apr 02 '25 21:04 mbkuhn

I just looked into the abl_multiphase_w2a case, and it makes sense that there are diffs. For this case, there is a temperature gradient across the interface, so the differences in how density is incorporated into the algorithm should make a difference. There are differences in time integration (multiply_rho = false means dividing RHS by rho^{n+1/2}, but multiply_rho = true means dividing RHS by rho^{n+1}), but I think the biggest reason is the advection. The advection treatment is vastly different in this PR compared to main, which should show up significantly when there is a temperature gradient at the interface in the presence of velocity. Which is what we have here.

By contrast, a nice check that we have the new phase-aware advection set up properly is that it shouldn't make a difference when the temperature is uniform near the interface in the presence of velocity. And that is confirmed by the very low diffs for the abl_multiphase_laminar case. See below the difference in the temperature profile between the two cases.

image

image

mbkuhn avatar Apr 15 '25 21:04 mbkuhn

So I think our list is reduced to

abl_bndry_input_native_inout
abl_meso_input_ipa
abl_meso_input_dpa
abl_meso_tendency

which is heavily involving the meso-micro coupling. I will look at the unrelated inout one first.

mbkuhn avatar Apr 15 '25 21:04 mbkuhn

Nice work!

marchdf avatar Apr 16 '25 14:04 marchdf

abl_bndry_input_native_inout

This one has clear diffs only for the temperature equation. The presence of diffs makes sense because this is an anelastic flow (ABL.anelastic = 1), which means the density is not constant, which means that advecting (rho*theta) or (theta) should make a difference here. Screenshots of the temperature show clearly difference signatures after 10 steps even though the magnitude is tiny (see scale).

this branch image

main branch (multiply_rho = false) image

mbkuhn avatar Apr 16 '25 15:04 mbkuhn

abl_bndry_input_native_inout density field for this case: image

mbkuhn avatar Apr 16 '25 15:04 mbkuhn

So we just have to figure out the meso reg tests

mbkuhn avatar Apr 16 '25 15:04 mbkuhn

Remaining diffs for the three cases Screenshot 2025-04-17 at 10 54 29 AM Screenshot 2025-04-17 at 10 54 07 AM Screenshot 2025-04-17 at 10 53 41 AM

mbkuhn avatar Apr 17 '25 19:04 mbkuhn

Only machine diffs now for the meso reg tests!

mbkuhn avatar Apr 21 '25 16:04 mbkuhn