Skip to content

Commit

Permalink
Merge #544
Browse files Browse the repository at this point in the history
544: Reduce allocations, use ClimaCore operators r=charleskawczynski a=charleskawczynski

This took a lot of experimentation, but I think I figured out something that is roughly equivalent.

Co-authored-by: Charles Kawczynski <[email protected]>
  • Loading branch information
bors[bot] and charleskawczynski authored Nov 9, 2021
2 parents 2acfe47 + c9fb5a5 commit ae3d87a
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 171 deletions.
21 changes: 12 additions & 9 deletions integration_tests/utils/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,18 @@ function Simulation1d(namelist)

n_updrafts = Turb.n_updrafts

cent_prog_fields = TC.FieldFromNamedTuple(TC.center_space(grid), cent_prognostic_vars(FT, n_updrafts))
face_prog_fields = TC.FieldFromNamedTuple(TC.face_space(grid), face_prognostic_vars(FT, n_updrafts))
aux_cent_fields = TC.FieldFromNamedTuple(TC.center_space(grid), cent_aux_vars(FT, n_updrafts))
aux_face_fields = TC.FieldFromNamedTuple(TC.face_space(grid), face_aux_vars(FT, n_updrafts))
diagnostic_cent_fields = TC.FieldFromNamedTuple(TC.center_space(grid), cent_diagnostic_vars(FT, n_updrafts))
diagnostic_face_fields = TC.FieldFromNamedTuple(TC.face_space(grid), face_diagnostic_vars(FT, n_updrafts))

prog = CC.Fields.FieldVector(cent = cent_prog_fields, face = face_prog_fields)
tendencies = CC.Fields.FieldVector(cent = deepcopy(cent_prog_fields), face = deepcopy(face_prog_fields))
cspace = TC.center_space(grid)
fspace = TC.face_space(grid)

cent_prog_fields() = TC.FieldFromNamedTuple(cspace, cent_prognostic_vars(FT, n_updrafts))
face_prog_fields() = TC.FieldFromNamedTuple(fspace, face_prognostic_vars(FT, n_updrafts))
aux_cent_fields = TC.FieldFromNamedTuple(cspace, cent_aux_vars(FT, n_updrafts))
aux_face_fields = TC.FieldFromNamedTuple(fspace, face_aux_vars(FT, n_updrafts))
diagnostic_cent_fields = TC.FieldFromNamedTuple(cspace, cent_diagnostic_vars(FT, n_updrafts))
diagnostic_face_fields = TC.FieldFromNamedTuple(fspace, face_diagnostic_vars(FT, n_updrafts))

prog = CC.Fields.FieldVector(cent = cent_prog_fields(), face = face_prog_fields())
tendencies = CC.Fields.FieldVector(cent = cent_prog_fields(), face = face_prog_fields())
aux = CC.Fields.FieldVector(cent = aux_cent_fields, face = aux_face_fields)
diagnostics = CC.Fields.FieldVector(cent = diagnostic_cent_fields, face = diagnostic_face_fields)

Expand Down
226 changes: 113 additions & 113 deletions integration_tests/utils/mse_tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,149 +5,149 @@
all_best_mse = OrderedCollections.OrderedDict()
#
all_best_mse["ARM_SGP"] = OrderedCollections.OrderedDict()
all_best_mse["ARM_SGP"]["qt_mean"] = 0.2231239206695815
all_best_mse["ARM_SGP"]["updraft_area"] = 335.3941081319375
all_best_mse["ARM_SGP"]["updraft_w"] = 142.0747324678483
all_best_mse["ARM_SGP"]["updraft_qt"] = 27.509759017261327
all_best_mse["ARM_SGP"]["updraft_thetal"] = 170.98093420573736
all_best_mse["ARM_SGP"]["qt_mean"] = 0.22301635747718498
all_best_mse["ARM_SGP"]["updraft_area"] = 335.39490404155504
all_best_mse["ARM_SGP"]["updraft_w"] = 142.11821480260792
all_best_mse["ARM_SGP"]["updraft_qt"] = 27.832405548771423
all_best_mse["ARM_SGP"]["updraft_thetal"] = 170.98127878390056
all_best_mse["ARM_SGP"]["u_mean"] = 1.3375737467153984e-5
all_best_mse["ARM_SGP"]["tke_mean"] = 1318.6773630852251
all_best_mse["ARM_SGP"]["temperature_mean"] = 0.00010938255805352282
all_best_mse["ARM_SGP"]["ql_mean"] = 174.21621610965383
all_best_mse["ARM_SGP"]["tke_mean"] = 1318.6585715670938
all_best_mse["ARM_SGP"]["temperature_mean"] = 0.00010934170729766599
all_best_mse["ARM_SGP"]["ql_mean"] = 174.38025593757953
all_best_mse["ARM_SGP"]["qi_mean"] = "NA"
all_best_mse["ARM_SGP"]["thetal_mean"] = 0.00010075927855698011
all_best_mse["ARM_SGP"]["Hvar_mean"] = 10162.815418599539
all_best_mse["ARM_SGP"]["QTvar_mean"] = 6457.058385681944
all_best_mse["ARM_SGP"]["thetal_mean"] = 0.0001007227170358912
all_best_mse["ARM_SGP"]["Hvar_mean"] = 10125.026060908474
all_best_mse["ARM_SGP"]["QTvar_mean"] = 6444.902612678036
#
all_best_mse["Bomex"] = OrderedCollections.OrderedDict()
all_best_mse["Bomex"]["qt_mean"] = 0.11457163699811189
all_best_mse["Bomex"]["updraft_area"] = 129.47865682108414
all_best_mse["Bomex"]["updraft_w"] = 18.76997520037706
all_best_mse["Bomex"]["updraft_qt"] = 6.541936017248121
all_best_mse["Bomex"]["updraft_thetal"] = 69.4631431261073
all_best_mse["Bomex"]["v_mean"] = 66.90623485164379
all_best_mse["Bomex"]["u_mean"] = 0.32279643804360864
all_best_mse["Bomex"]["tke_mean"] = 74.3535686593833
all_best_mse["Bomex"]["temperature_mean"] = 4.575677922199463e-5
all_best_mse["Bomex"]["ql_mean"] = 9.355062493608365
all_best_mse["Bomex"]["qt_mean"] = 0.11228837319642417
all_best_mse["Bomex"]["updraft_area"] = 129.54066325620397
all_best_mse["Bomex"]["updraft_w"] = 18.634979286411507
all_best_mse["Bomex"]["updraft_qt"] = 6.540489311604779
all_best_mse["Bomex"]["updraft_thetal"] = 69.46346830588955
all_best_mse["Bomex"]["v_mean"] = 66.88054454340784
all_best_mse["Bomex"]["u_mean"] = 0.3227269841759421
all_best_mse["Bomex"]["tke_mean"] = 74.32272476689708
all_best_mse["Bomex"]["temperature_mean"] = 4.4728943652691465e-5
all_best_mse["Bomex"]["ql_mean"] = 9.023260618543171
all_best_mse["Bomex"]["qi_mean"] = "NA"
all_best_mse["Bomex"]["thetal_mean"] = 4.651586508669832e-5
all_best_mse["Bomex"]["Hvar_mean"] = 4013.377042751604
all_best_mse["Bomex"]["QTvar_mean"] = 1499.5718468775738
all_best_mse["Bomex"]["thetal_mean"] = 4.544752222644783e-5
all_best_mse["Bomex"]["Hvar_mean"] = 4144.717848394085
all_best_mse["Bomex"]["QTvar_mean"] = 1546.926964622953
#
all_best_mse["DryBubble"] = OrderedCollections.OrderedDict()
all_best_mse["DryBubble"]["updraft_area"] = 3.640454785814935e-23
all_best_mse["DryBubble"]["updraft_w"] = 5.866343721998678e-23
all_best_mse["DryBubble"]["updraft_thetal"] = 4.4712023035135573e-29
all_best_mse["DryBubble"]["updraft_area"] = 1.3235137934541979e-20
all_best_mse["DryBubble"]["updraft_w"] = 2.677723712408869e-21
all_best_mse["DryBubble"]["updraft_thetal"] = 1.199062330182957e-28
all_best_mse["DryBubble"]["u_mean"] = 0.0
all_best_mse["DryBubble"]["tke_mean"] = 2.2541167194943694e-22
all_best_mse["DryBubble"]["temperature_mean"] = 1.750644671232426e-29
all_best_mse["DryBubble"]["thetal_mean"] = 6.784458314510825e-30
all_best_mse["DryBubble"]["Hvar_mean"] = 6.531214512756415e-22
all_best_mse["DryBubble"]["tke_mean"] = 5.7035209947232505e-21
all_best_mse["DryBubble"]["temperature_mean"] = 1.513277849632971e-28
all_best_mse["DryBubble"]["thetal_mean"] = 1.2168949040313066e-28
all_best_mse["DryBubble"]["Hvar_mean"] = 1.728330042841723e-21
#
all_best_mse["DYCOMS_RF01"] = OrderedCollections.OrderedDict()
all_best_mse["DYCOMS_RF01"]["qt_mean"] = 0.02266768949814323
all_best_mse["DYCOMS_RF01"]["ql_mean"] = 10.27985324047777
all_best_mse["DYCOMS_RF01"]["updraft_area"] = 30.546343416129172
all_best_mse["DYCOMS_RF01"]["updraft_w"] = 4.138605069914052
all_best_mse["DYCOMS_RF01"]["updraft_qt"] = 2.1514919448029652
all_best_mse["DYCOMS_RF01"]["updraft_thetal"] = 46.18691270439999
all_best_mse["DYCOMS_RF01"]["v_mean"] = 0.0030075050416291525
all_best_mse["DYCOMS_RF01"]["u_mean"] = 0.07909085312687406
all_best_mse["DYCOMS_RF01"]["tke_mean"] = 21.338835674043157
all_best_mse["DYCOMS_RF01"]["temperature_mean"] = 8.085863436349185e-5
all_best_mse["DYCOMS_RF01"]["thetal_mean"] = 8.158937971129589e-5
all_best_mse["DYCOMS_RF01"]["Hvar_mean"] = 1243.0781411983703
all_best_mse["DYCOMS_RF01"]["QTvar_mean"] = 483.9134520325796
all_best_mse["DYCOMS_RF01"]["qt_mean"] = 0.022667689496731386
all_best_mse["DYCOMS_RF01"]["ql_mean"] = 10.279853228377057
all_best_mse["DYCOMS_RF01"]["updraft_area"] = 30.546343417941024
all_best_mse["DYCOMS_RF01"]["updraft_w"] = 4.138605070494756
all_best_mse["DYCOMS_RF01"]["updraft_qt"] = 2.1514919448233742
all_best_mse["DYCOMS_RF01"]["updraft_thetal"] = 46.18691270440009
all_best_mse["DYCOMS_RF01"]["v_mean"] = 0.003007505042078205
all_best_mse["DYCOMS_RF01"]["u_mean"] = 0.07909085312924319
all_best_mse["DYCOMS_RF01"]["tke_mean"] = 21.338835676172373
all_best_mse["DYCOMS_RF01"]["temperature_mean"] = 8.085863435451098e-5
all_best_mse["DYCOMS_RF01"]["thetal_mean"] = 8.158937970260739e-5
all_best_mse["DYCOMS_RF01"]["Hvar_mean"] = 1243.0781411966484
all_best_mse["DYCOMS_RF01"]["QTvar_mean"] = 483.91345203311954
#
all_best_mse["GABLS"] = OrderedCollections.OrderedDict()
all_best_mse["GABLS"]["updraft_thetal"] = 0.0
all_best_mse["GABLS"]["v_mean"] = 1.0592112910805158e-30
all_best_mse["GABLS"]["u_mean"] = 1.3167229376278404e-31
all_best_mse["GABLS"]["tke_mean"] = 1.9407611580760302e-35
all_best_mse["GABLS"]["v_mean"] = 0.0
all_best_mse["GABLS"]["u_mean"] = 0.0
all_best_mse["GABLS"]["tke_mean"] = 0.0
all_best_mse["GABLS"]["temperature_mean"] = 0.0
all_best_mse["GABLS"]["thetal_mean"] = 0.0
all_best_mse["GABLS"]["Hvar_mean"] = 4.537536523635608e-28
all_best_mse["GABLS"]["QTvar_mean"] = 1.4048195940923543e-30
all_best_mse["GABLS"]["qt_mean"] = 3.1623412682865033e-31
all_best_mse["GABLS"]["Hvar_mean"] = 0.0
all_best_mse["GABLS"]["QTvar_mean"] = 0.0
all_best_mse["GABLS"]["qt_mean"] = 0.0
#
all_best_mse["life_cycle_Tan2018"] = OrderedCollections.OrderedDict()
all_best_mse["life_cycle_Tan2018"]["qt_mean"] = 1.567302562386967e-5
all_best_mse["life_cycle_Tan2018"]["ql_mean"] = 0.01468522030000595
all_best_mse["life_cycle_Tan2018"]["updraft_area"] = 0.0018070755296079749
all_best_mse["life_cycle_Tan2018"]["updraft_w"] = 0.004725987553060753
all_best_mse["life_cycle_Tan2018"]["updraft_qt"] = 1.1988949052216883e-6
all_best_mse["life_cycle_Tan2018"]["updraft_thetal"] = 4.116455333973881e-10
all_best_mse["life_cycle_Tan2018"]["v_mean"] = 6.814266883835888e-5
all_best_mse["life_cycle_Tan2018"]["u_mean"] = 2.9475342846076846e-7
all_best_mse["life_cycle_Tan2018"]["tke_mean"] = 0.000250274649560967
all_best_mse["life_cycle_Tan2018"]["temperature_mean"] = 7.13760543054619e-9
all_best_mse["life_cycle_Tan2018"]["thetal_mean"] = 7.153198059666602e-9
all_best_mse["life_cycle_Tan2018"]["Hvar_mean"] = 3543.8726614695606
all_best_mse["life_cycle_Tan2018"]["QTvar_mean"] = 2921.4578007153946
all_best_mse["life_cycle_Tan2018"]["qt_mean"] = 1.5712635141566854e-5
all_best_mse["life_cycle_Tan2018"]["ql_mean"] = 0.014775967800016679
all_best_mse["life_cycle_Tan2018"]["updraft_area"] = 0.0018147020293358682
all_best_mse["life_cycle_Tan2018"]["updraft_w"] = 0.0047310324446118565
all_best_mse["life_cycle_Tan2018"]["updraft_qt"] = 1.2091185238206118e-6
all_best_mse["life_cycle_Tan2018"]["updraft_thetal"] = 4.1415193602099833e-10
all_best_mse["life_cycle_Tan2018"]["v_mean"] = 6.793003683064088e-5
all_best_mse["life_cycle_Tan2018"]["u_mean"] = 2.941160987391208e-7
all_best_mse["life_cycle_Tan2018"]["tke_mean"] = 0.00025023904274775003
all_best_mse["life_cycle_Tan2018"]["temperature_mean"] = 7.154218170469599e-9
all_best_mse["life_cycle_Tan2018"]["thetal_mean"] = 7.1726309932858955e-9
all_best_mse["life_cycle_Tan2018"]["Hvar_mean"] = 6516.053869566519
all_best_mse["life_cycle_Tan2018"]["QTvar_mean"] = 5045.86984230058
#
all_best_mse["Nieuwstadt"] = OrderedCollections.OrderedDict()
all_best_mse["Nieuwstadt"]["updraft_area"] = 98.97436274597014
all_best_mse["Nieuwstadt"]["updraft_w"] = 12.498502801594379
all_best_mse["Nieuwstadt"]["updraft_area"] = 98.97436274696511
all_best_mse["Nieuwstadt"]["updraft_w"] = 12.498502801663589
all_best_mse["Nieuwstadt"]["updraft_thetal"] = 117.3669724244686
all_best_mse["Nieuwstadt"]["u_mean"] = 14.602458009247888
all_best_mse["Nieuwstadt"]["tke_mean"] = 313.21384305283067
all_best_mse["Nieuwstadt"]["temperature_mean"] = 9.727469470625242e-6
all_best_mse["Nieuwstadt"]["thetal_mean"] = 1.0038730380729576e-5
all_best_mse["Nieuwstadt"]["Hvar_mean"] = 1277.4831631226057
all_best_mse["Nieuwstadt"]["u_mean"] = 14.602458009248117
all_best_mse["Nieuwstadt"]["tke_mean"] = 313.2138430527159
all_best_mse["Nieuwstadt"]["temperature_mean"] = 9.727469470676542e-6
all_best_mse["Nieuwstadt"]["thetal_mean"] = 1.00387303807768e-5
all_best_mse["Nieuwstadt"]["Hvar_mean"] = 1277.4831631223458
#
all_best_mse["Rico"] = OrderedCollections.OrderedDict()
all_best_mse["Rico"]["qt_mean"] = 1.2364709543187242
all_best_mse["Rico"]["updraft_area"] = 477.4816269377714
all_best_mse["Rico"]["updraft_w"] = 108.05000282460898
all_best_mse["Rico"]["updraft_qt"] = 12.171126507028397
all_best_mse["Rico"]["updraft_thetal"] = 133.3620477671728
all_best_mse["Rico"]["v_mean"] = 0.6116460587011135
all_best_mse["Rico"]["u_mean"] = 0.6942827277452738
all_best_mse["Rico"]["tke_mean"] = 82.32915463904622
all_best_mse["Rico"]["temperature_mean"] = 0.000572535450355809
all_best_mse["Rico"]["ql_mean"] = 63.68831778146793
all_best_mse["Rico"]["qt_mean"] = 1.2505080290775676
all_best_mse["Rico"]["updraft_area"] = 477.3588453116888
all_best_mse["Rico"]["updraft_w"] = 107.70645550267692
all_best_mse["Rico"]["updraft_qt"] = 12.419453769075824
all_best_mse["Rico"]["updraft_thetal"] = 133.36571019864914
all_best_mse["Rico"]["v_mean"] = 0.6141307419542259
all_best_mse["Rico"]["u_mean"] = 0.6814199284487197
all_best_mse["Rico"]["tke_mean"] = 82.28666491271453
all_best_mse["Rico"]["temperature_mean"] = 0.0005775145848475295
all_best_mse["Rico"]["ql_mean"] = 63.94244728037521
all_best_mse["Rico"]["qi_mean"] = "NA"
all_best_mse["Rico"]["qr_mean"] = 760.8337729499362
all_best_mse["Rico"]["thetal_mean"] = 0.0005649886037029106
all_best_mse["Rico"]["Hvar_mean"] = 171016.7700437758
all_best_mse["Rico"]["QTvar_mean"] = 38371.38533046169
all_best_mse["Rico"]["qr_mean"] = 760.7997404339995
all_best_mse["Rico"]["thetal_mean"] = 0.0005697636189818647
all_best_mse["Rico"]["Hvar_mean"] = 187748.51512250715
all_best_mse["Rico"]["QTvar_mean"] = 41975.43556987473
#
all_best_mse["Soares"] = OrderedCollections.OrderedDict()
all_best_mse["Soares"]["qt_mean"] = 0.1262884012960982
all_best_mse["Soares"]["updraft_area"] = 98.63117904234343
all_best_mse["Soares"]["updraft_w"] = 11.397340901259566
all_best_mse["Soares"]["updraft_qt"] = 23.08604406449742
all_best_mse["Soares"]["updraft_thetal"] = 65.25330074727796
all_best_mse["Soares"]["u_mean"] = 96.34531527429904
all_best_mse["Soares"]["tke_mean"] = 241.38597585282957
all_best_mse["Soares"]["temperature_mean"] = 1.0987318988994375e-5
all_best_mse["Soares"]["thetal_mean"] = 1.04157339588683e-5
all_best_mse["Soares"]["Hvar_mean"] = 1122.0677260228588
all_best_mse["Soares"]["qt_mean"] = 0.12688273309341344
all_best_mse["Soares"]["updraft_area"] = 96.63831512941361
all_best_mse["Soares"]["updraft_w"] = 11.399139169248969
all_best_mse["Soares"]["updraft_qt"] = 23.081153753864093
all_best_mse["Soares"]["updraft_thetal"] = 65.25330084218206
all_best_mse["Soares"]["u_mean"] = 96.3448360484283
all_best_mse["Soares"]["tke_mean"] = 241.3113914355129
all_best_mse["Soares"]["temperature_mean"] = 1.09924343124991e-5
all_best_mse["Soares"]["thetal_mean"] = 1.0421375870107419e-5
all_best_mse["Soares"]["Hvar_mean"] = 1120.4457023080581
#
all_best_mse["TRMM_LBA"] = OrderedCollections.OrderedDict()
all_best_mse["TRMM_LBA"]["qt_mean"] = 3.963977389784552
all_best_mse["TRMM_LBA"]["updraft_area"] = 7590.512428035949
all_best_mse["TRMM_LBA"]["updraft_w"] = 29117.789630257445
all_best_mse["TRMM_LBA"]["updraft_qt"] = 264.37439468420354
all_best_mse["TRMM_LBA"]["updraft_thetal"] = 1962.1733128842725
all_best_mse["TRMM_LBA"]["v_mean"] = 286.6425026732014
all_best_mse["TRMM_LBA"]["u_mean"] = 113.79784954567111
all_best_mse["TRMM_LBA"]["tke_mean"] = 25954.33270737676
all_best_mse["TRMM_LBA"]["temperature_mean"] = 0.0011257656568840811
all_best_mse["TRMM_LBA"]["ql_mean"] = 11335.715959590818
all_best_mse["TRMM_LBA"]["qt_mean"] = 3.963977389784307
all_best_mse["TRMM_LBA"]["updraft_area"] = 7590.512428035688
all_best_mse["TRMM_LBA"]["updraft_w"] = 29117.78963026018
all_best_mse["TRMM_LBA"]["updraft_qt"] = 264.3743946841989
all_best_mse["TRMM_LBA"]["updraft_thetal"] = 1962.1733128842698
all_best_mse["TRMM_LBA"]["v_mean"] = 286.6425026732026
all_best_mse["TRMM_LBA"]["u_mean"] = 113.7978495456701
all_best_mse["TRMM_LBA"]["tke_mean"] = 25954.332707324236
all_best_mse["TRMM_LBA"]["temperature_mean"] = 0.0011257656568842132
all_best_mse["TRMM_LBA"]["ql_mean"] = 11335.715959592124
all_best_mse["TRMM_LBA"]["qi_mean"] = "NA"
all_best_mse["TRMM_LBA"]["thetal_mean"] = 0.02111888257330726
all_best_mse["TRMM_LBA"]["Hvar_mean"] = 4343.288145342123
all_best_mse["TRMM_LBA"]["QTvar_mean"] = 2834.894441259293
all_best_mse["TRMM_LBA"]["thetal_mean"] = 0.02111888257330776
all_best_mse["TRMM_LBA"]["Hvar_mean"] = 4343.288145341953
all_best_mse["TRMM_LBA"]["QTvar_mean"] = 2834.8944412594046
#
all_best_mse["LES_driven_SCM"] = OrderedCollections.OrderedDict()
all_best_mse["LES_driven_SCM"]["qt_mean"] = 8.32310777527915
all_best_mse["LES_driven_SCM"]["v_mean"] = 3.2813139027215033
all_best_mse["LES_driven_SCM"]["u_mean"] = 1.142374736468777
all_best_mse["LES_driven_SCM"]["temperature_mean"] = 0.0033261474790328947
all_best_mse["LES_driven_SCM"]["ql_mean"] = 760.2955540576444
all_best_mse["LES_driven_SCM"]["thetal_mean"] = 0.003630534375006959
all_best_mse["LES_driven_SCM"]["qt_mean"] = 8.321998678039025
all_best_mse["LES_driven_SCM"]["v_mean"] = 3.2869349960752956
all_best_mse["LES_driven_SCM"]["u_mean"] = 1.1451412070856226
all_best_mse["LES_driven_SCM"]["temperature_mean"] = 0.0033257812439771717
all_best_mse["LES_driven_SCM"]["ql_mean"] = 670.5676113013532
all_best_mse["LES_driven_SCM"]["thetal_mean"] = 0.0036291983014447673
#
#################################
#################################
Expand Down
21 changes: 0 additions & 21 deletions src/Operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,6 @@ interpf2c(f::SA.SVector, grid::Grid, ::BottomBCTag, bc::SetValue) = (bc.value +
##### advection operators
#####

function upwind_advection_area(ρ0_half, a_up, w_up, grid, k)
ρ_0_cut = ccut_upwind(ρ0_half, grid, k)
a_up_cut = ccut_upwind(a_up, grid, k)
w_up_cut = daul_f2c_upwind(w_up, grid, k)
m_cut = ρ_0_cut .* a_up_cut .* w_up_cut
FT = eltype(grid)
∇m = c∇_upwind(m_cut, grid, k; bottom = SetValue(FT(0)), top = SetGradient(FT(0)))
return -∇m / ρ0_half[k]
end

function upwind_advection_velocity(ρ0, a_up, w_up, grid, k; a_up_bcs)
a_dual = daul_c2f_upwind(a_up, grid, k; a_up_bcs...)
ρ_0_dual = fcut_upwind(ρ0, grid, k)
Expand All @@ -181,17 +171,6 @@ function upwind_advection_velocity(ρ0, a_up, w_up, grid, k; a_up_bcs)
return ∇ρaw
end

function upwind_advection_scalar(ρ0_half, a_up, w_up, var, grid, k)
ρ_0_cut = ccut_upwind(ρ0_half, grid, k)
a_up_cut = ccut_upwind(a_up, grid, k)
w_up_cut = daul_f2c_upwind(w_up, grid, k)
var_cut = ccut_upwind(var, grid, k)
m_cut = ρ_0_cut .* a_up_cut .* w_up_cut .* var_cut
FT = eltype(grid)
∇m = c∇_upwind(m_cut, grid, k; bottom = SetValue(FT(0)), top = SetGradient(FT(0)))
return ∇m
end

#####
##### ∇(center data)
#####
Expand Down
Loading

0 comments on commit ae3d87a

Please sign in to comment.