diff --git a/Docs/sphinx_doc/BoundaryConditions.rst b/Docs/sphinx_doc/BoundaryConditions.rst index 5df9d59ae..b0f35a023 100644 --- a/Docs/sphinx_doc/BoundaryConditions.rst +++ b/Docs/sphinx_doc/BoundaryConditions.rst @@ -226,3 +226,125 @@ The sponge data is input as a text file with 3 columns containing :math:`z, u, v erf.sponge_strength = 1000.0 erf.use_xlo_sponge_damping = true erf.xlo_sponge_end = 4.0 + +Inflow turbulence generation +--------------------------- + +ERF provides the capability to apply a perturbation zone at the inflow domain boundary to mechanically trip turbulence into the domain. + +.. |PBinflw| image:: figures/PBIllustration.png + :width: 600 + +.. _fig:pb_fig: + +.. table:: Box perturbation method + + +-----------------------------------------------------+ + | |PBinflw| | + +-----------------------------------------------------+ + | Image taken from `DeLeon et al. (2018)` | + +-----------------------------------------------------+ + +Two different types of perturbation are currently available, ``source``, adopted from `DeLeon et al. (2018)`_ + +.. + _`DeLeon et al. (2018)`: https://doi.org/10.2514/1.J057245 + +and ``direct``, adopted from `Munoz-Esparza et al. (2015)`_. The ``source`` option applies the perturbation amplitude range, `\pm \Phi_{PB}`, to each cell within the perturbation box as a source term. It's important to note that while this perturbation starts as white noise, it becomes colored noise due to the eddy viscosity turbulence closure. Conversely, the ``direct`` option applies the calculated temperature difference directly onto the `\rho \theta field`. + +The current implementation only supports West and South face perturbations, specified by ``erf.perturbation_direction``, where the 3 integer inputs represent the `x`, `y`, and `z` directions, respectively. The flow perturbation method requires the dimensions of an individual box input through ``erf.perturbation_box_dim``, with 3 integer inputs representing `nx_{pb}`, `ny_{pb}`, and `nz_{pb}`, respectively. Following the guidance of `Ma and Senocak (2023)`_, + +.. _`Ma and Senocak (2023)`: https://link.springer.com/article/10.1007/s10546-023-00786-1 + +the general rule of thumb is to use `H_{PB} = 1/8 \delta` as the height of the perturbation box, where `\delta` is the boundary layer height. The length of the box in the x-direction should be `L_{PB} = 2H_{PB}`. Depending on the direction of the bulk flow, the width of the box in the y-direction should be defined as `W_{PB} = L_{PB} \tan{\theta_{inflow}}`. Note that the current implementation only accepts ``int`` entries. Therefore, considering the domain size and mesh resolution, the dimensions of a singular box can be determined. + +The specification of the number of layers and the offset into the domain of the perturbation boxes can be made through ``erf.perturbation_layers`` and ``erf.perturbation_offset``, respectively. + +:: + + erf.inlet_perturbation_type = "source" + + erf.perturbation_direction = 1 0 0 + erf.perturbation_box_dims = 8 8 4 + erf.perturbation_layers = 3 + erf.perturbation_offset = 1 + + erf.perturbation_nondimensional = 0.042 + erf.perturbation_T_infinity = 300.0 + erf.perturbation_T_intensity = 0.1 + +Before delving into the details, it's important to note that the two methods are interchangeable. While we adhere to the guidelines from the referenced publications, the use of ``direct`` type forcing is not restricted to having unity cell height, nor is ``source`` type forcing limited to boxes. We have generalized the perturbation methods to allow for flexibility in mixing and matching different types of turbulence generation. + +Source type forcing +------------------- + +The perturbation update interval is determined by the equation, + +.. math:: + + \frac{t_p \langle U(z) \rangle_{PB}}{D_{PB}} = 1, + +The change in the perturbation is defined as, + +.. math:: + + {Ri}_{PB} = \frac{g \beta \Delta \overline{\phi} H_{PB}}{{\langle U(z) \rangle}^2_{PB}}. + +The magnitude of the perturbation, ignoring the advection and diffusion effects in the transport equation can be made through a proportionality ratio between the update time and change in the box temperature, + +.. math:: + + \Phi_{PB} \propto \frac{\Delta \overliner{\phi}}{t_p} + +and the perturbation amplitude is determined by the equation, + +.. math:: + + \Phi_{PB} = \frac{Ri_{PB} {\langle U(z) \rangle}^3_{PB}}{g \beta D_{PB} H_{PB}}. + +The ``source`` type forcing can adopt the box perturbation method by having the following inputs list. + +:: + + erf.inlet_perturbation_type = "source" + + erf.perturbation_direction = 1 0 0 + erf.perturbation_box_dims = 8 8 4 + erf.perturbation_layers = 3 + erf.perturbation_offset = 1 + + erf.perturbation_nondimensional = 0.042 # Ri + erf.perturbation_T_infinity = 300.0 + erf.perturbation_T_intensity = 0.1 + +Direct type forcing +------------------- + +The perturbation update interval is determined by the equation, +.. math:: + + \frac{t_p U_{1}}{d_{c}} + +and the perturbation amplitude is determined by the equation, +.. math:: + + Ec = \frac{{U_g}^2}{\rho c_p \theta_{pm}}. + +The ``direct`` type forcing can adopt the cell perturbation method by having the following inputs list. +:: + + erf.inlet_perturbation_type = "direct" + + erf.perturbation_direction = 1 0 0 + erf.perturbation_box_dims = 8 8 1 + erf.perturbation_layers = 3 + erf.perturbation_offset = 1 + + erf.perturbation_nondimensional = 0.16 #Ec + erf.perturbation_rho_0 = 1.0 + erf.perturbation_cp = 1250 + +From `Munoz-Esparza et al. (2015)`_ the choice of the Eckert number is 0.16. + +.. + _`Munoz-Esparza et al. (2015)`: https://doi.org/10.1063/1.4913572 diff --git a/Docs/sphinx_doc/figures/PBIllustration.png b/Docs/sphinx_doc/figures/PBIllustration.png new file mode 100644 index 000000000..0fc4785b2 Binary files /dev/null and b/Docs/sphinx_doc/figures/PBIllustration.png differ diff --git a/Exec/DevTests/ABL_perturbation_inflow/CMakeLists.txt b/Exec/DevTests/ABL_perturbation_inflow/CMakeLists.txt new file mode 100644 index 000000000..b3e8f8137 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/CMakeLists.txt @@ -0,0 +1,12 @@ +set(erf_exe_name erf_abl_perturbation_inflow) + +add_executable(${erf_exe_name} "") +target_sources(${erf_exe_name} + PRIVATE + prob.cpp +) + +target_include_directories(${erf_exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + +include(${CMAKE_SOURCE_DIR}/CMake/BuildERFExe.cmake) +build_erf_exe(${erf_exe_name}) diff --git a/Exec/DevTests/ABL_perturbation_inflow/GNUmakefile b/Exec/DevTests/ABL_perturbation_inflow/GNUmakefile new file mode 100644 index 000000000..b7ba1b593 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/GNUmakefile @@ -0,0 +1,34 @@ +# AMReX +COMP = gnu +PRECISION = DOUBLE + +# Profiling +PROFILE = FALSE +TINY_PROFILE = TRUE +COMM_PROFILE = FALSE +TRACE_PROFILE = FALSE +MEM_PROFILE = FALSE +USE_GPROF = FALSE + +# Performance +USE_MPI = TRUE +USE_OMP = FALSE + +USE_CUDA = FALSE +USE_HIP = FALSE +USE_SYCL = FALSE + +# Debugging +DEBUG = TRUE + +TEST = TRUE +USE_ASSERTION = TRUE + +#USE_POISSON_SOLVE = TRUE + +# GNU Make +Bpack := ./Make.package +Blocs := . +ERF_HOME := ../../.. +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DevTests/ABL_perturbation_inflow +include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/DevTests/ABL_perturbation_inflow/Make.package b/Exec/DevTests/ABL_perturbation_inflow/Make.package new file mode 100644 index 000000000..aeacb72f0 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/Make.package @@ -0,0 +1,2 @@ +CEXE_headers += prob.H +CEXE_sources += prob.cpp diff --git a/Exec/DevTests/ABL_perturbation_inflow/README b/Exec/DevTests/ABL_perturbation_inflow/README new file mode 100644 index 000000000..e21611c62 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/README @@ -0,0 +1,7 @@ +This problem setup is for simulation of the Atmospheric Boundary Layer (ABL) +using one of two turbulence schemes (Smagorinsky or Deardorff) and the bottom +boundary condition possibly specified by Monin Obukhov Similarity Theory (MOST). + +This version of the ABL problem initializes the data from an input sounding file, +and initializes turbulence at the inflow. The target is to transition turbulence +from coarse to fine grid interface. diff --git a/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000Ana_sounding.txt b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000Ana_sounding.txt new file mode 100644 index 000000000..00b7274fc --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000Ana_sounding.txt @@ -0,0 +1,34 @@ +0.0 300.0 0.0 +1.00000000e-02 3.00000000e+02 0.00000000e+00 1.25066641e+01 0.00000000e+00 +3.22187500e-01 3.00000000e+02 0.00000000e+00 2.09762948e+01 0.00000000e+00 +6.34375000e-01 3.00000000e+02 0.00000000e+00 2.26287499e+01 0.00000000e+00 +9.46562500e-01 3.00000000e+02 0.00000000e+00 2.36048395e+01 0.00000000e+00 +1.25875000e+00 3.00000000e+02 0.00000000e+00 2.43000527e+01 0.00000000e+00 +1.57093750e+00 3.00000000e+02 0.00000000e+00 2.48404269e+01 0.00000000e+00 +1.88312500e+00 3.00000000e+02 0.00000000e+00 2.52825246e+01 0.00000000e+00 +2.19531250e+00 3.00000000e+02 0.00000000e+00 2.56566509e+01 0.00000000e+00 +2.50750000e+00 3.00000000e+02 0.00000000e+00 2.59809480e+01 0.00000000e+00 +2.81968750e+00 3.00000000e+02 0.00000000e+00 2.62671427e+01 0.00000000e+00 +3.13187500e+00 3.00000000e+02 0.00000000e+00 2.65232545e+01 0.00000000e+00 +3.44406250e+00 3.00000000e+02 0.00000000e+00 2.67550102e+01 0.00000000e+00 +3.75625000e+00 3.00000000e+02 0.00000000e+00 2.69666429e+01 0.00000000e+00 +4.06843750e+00 3.00000000e+02 0.00000000e+00 2.71613695e+01 0.00000000e+00 +4.38062500e+00 3.00000000e+02 0.00000000e+00 2.73416924e+01 0.00000000e+00 +4.69281250e+00 3.00000000e+02 0.00000000e+00 2.75095964e+01 0.00000000e+00 +5.00500000e+00 3.00000000e+02 0.00000000e+00 2.76666826e+01 0.00000000e+00 +5.31718750e+00 3.00000000e+02 0.00000000e+00 2.78142609e+01 0.00000000e+00 +5.62937500e+00 3.00000000e+02 0.00000000e+00 2.79534168e+01 0.00000000e+00 +5.94156250e+00 3.00000000e+02 0.00000000e+00 2.80850600e+01 0.00000000e+00 +6.25375000e+00 3.00000000e+02 0.00000000e+00 2.82099603e+01 0.00000000e+00 +6.56593750e+00 3.00000000e+02 0.00000000e+00 2.83287750e+01 0.00000000e+00 +6.87812500e+00 3.00000000e+02 0.00000000e+00 2.84420696e+01 0.00000000e+00 +7.19031250e+00 3.00000000e+02 0.00000000e+00 2.85503344e+01 0.00000000e+00 +7.50250000e+00 3.00000000e+02 0.00000000e+00 2.86539970e+01 0.00000000e+00 +7.81468750e+00 3.00000000e+02 0.00000000e+00 2.87534328e+01 0.00000000e+00 +8.12687500e+00 3.00000000e+02 0.00000000e+00 2.88489730e+01 0.00000000e+00 +8.43906250e+00 3.00000000e+02 0.00000000e+00 2.89409114e+01 0.00000000e+00 +8.75125000e+00 3.00000000e+02 0.00000000e+00 2.90295098e+01 0.00000000e+00 +9.06343750e+00 3.00000000e+02 0.00000000e+00 2.91150023e+01 0.00000000e+00 +9.37562500e+00 3.00000000e+02 0.00000000e+00 2.91975993e+01 0.00000000e+00 +9.68781250e+00 3.00000000e+02 0.00000000e+00 2.92774905e+01 0.00000000e+00 +1.00000000e+01 3.00000000e+02 0.00000000e+00 2.93548477e+01 0.00000000e+00 diff --git a/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000Ana_sponge.txt b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000Ana_sponge.txt new file mode 100644 index 000000000..f6c50f044 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000Ana_sponge.txt @@ -0,0 +1,33 @@ +1.00000000e-02 1.25066641e+01 0.00000000e+00 +3.22187500e-01 2.09762948e+01 0.00000000e+00 +6.34375000e-01 2.26287499e+01 0.00000000e+00 +9.46562500e-01 2.36048395e+01 0.00000000e+00 +1.25875000e+00 2.43000527e+01 0.00000000e+00 +1.57093750e+00 2.48404269e+01 0.00000000e+00 +1.88312500e+00 2.52825246e+01 0.00000000e+00 +2.19531250e+00 2.56566509e+01 0.00000000e+00 +2.50750000e+00 2.59809480e+01 0.00000000e+00 +2.81968750e+00 2.62671427e+01 0.00000000e+00 +3.13187500e+00 2.65232545e+01 0.00000000e+00 +3.44406250e+00 2.67550102e+01 0.00000000e+00 +3.75625000e+00 2.69666429e+01 0.00000000e+00 +4.06843750e+00 2.71613695e+01 0.00000000e+00 +4.38062500e+00 2.73416924e+01 0.00000000e+00 +4.69281250e+00 2.75095964e+01 0.00000000e+00 +5.00500000e+00 2.76666826e+01 0.00000000e+00 +5.31718750e+00 2.78142609e+01 0.00000000e+00 +5.62937500e+00 2.79534168e+01 0.00000000e+00 +5.94156250e+00 2.80850600e+01 0.00000000e+00 +6.25375000e+00 2.82099603e+01 0.00000000e+00 +6.56593750e+00 2.83287750e+01 0.00000000e+00 +6.87812500e+00 2.84420696e+01 0.00000000e+00 +7.19031250e+00 2.85503344e+01 0.00000000e+00 +7.50250000e+00 2.86539970e+01 0.00000000e+00 +7.81468750e+00 2.87534328e+01 0.00000000e+00 +8.12687500e+00 2.88489730e+01 0.00000000e+00 +8.43906250e+00 2.89409114e+01 0.00000000e+00 +8.75125000e+00 2.90295098e+01 0.00000000e+00 +9.06343750e+00 2.91150023e+01 0.00000000e+00 +9.37562500e+00 2.91975993e+01 0.00000000e+00 +9.68781250e+00 2.92774905e+01 0.00000000e+00 +1.00000000e+01 2.93548477e+01 0.00000000e+00 diff --git a/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000DNS_sounding.txt b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000DNS_sounding.txt new file mode 100644 index 000000000..ea1cf6cc4 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000DNS_sounding.txt @@ -0,0 +1,386 @@ +0.0 300.0 0.0 0.0 0.0 +0.0 300.0 0.0 0.0 0.0 +1.217311652923492e-06 300.0 0.0 0.00011140613491415374 0.0 +6.086537518545931e-06 300.0 0.0 0.0005570274195276387 0.0 +1.704221791976046e-05 300.0 0.0 0.001559660241516003 0.0 +3.651878945154508e-05 300.0 0.0 0.0033420734502807845 0.0 +6.69505434929274e-05 300.0 0.0 0.0061269859333703105 0.0 +0.0001107715847206148 300.0 0.0 0.010137027830325164 0.0 +0.0001704157896263991 300.0 0.0 0.015594654328461917 0.0 +0.0002470994533848581 300.0 0.0 0.022610560551618166 0.0 +0.0003408212691252688 300.0 0.0 0.03118329599615294 0.0 +0.0004515796396062921 300.0 0.0 0.041309855577899 0.0 +0.000579372677243728 300.0 0.0 0.05298424056514345 0.0 +0.0007241982041420458 300.0 0.0 0.0661951414700109 0.0 +0.0008860537521320211 300.0 0.0 0.08092253985409509 0.0 +0.001064936562812813 300.0 0.0 0.0971331738653471 0.0 +0.001260843587598481 300.0 0.0 0.11477508395784822 0.0 +0.001473771487770281 300.0 0.0 0.1337718182129991 0.0 +0.001703716634533836 300.0 0.0 0.15401723219797894 0.0 +0.001950675109080202 300.0 0.0 0.17537202560217383 0.0 +0.002214642702653591 300.0 0.0 0.19766309500502766 0.0 +0.002495614916622313 300.0 0.0 0.22068641020278618 0.0 +0.002793586962555827 300.0 0.0 0.24421351408048736 0.0 +0.003108553762306454 300.0 0.0 0.26800106528869905 0.0 +0.003440509948095416 300.0 0.0 0.2918022762175396 0.0 +0.003789449862605099 300.0 0.0 0.3153787887917496 0.0 +0.00415536755907453 300.0 0.0 0.33851153352152946 0.0 +0.00453825680140163 300.0 0.0 0.3610093985843633 0.0 +0.004938111064248796 300.0 0.0 0.38271499588213365 0.0 +0.005354923533154365 300.0 0.0 0.40350732369344205 0.0 +0.005788687104649082 300.0 0.0 0.42330157619153297 0.0 +0.006239394386376662 300.0 0.0 0.44204666394902753 0.0 +0.006707037697219698 300.0 0.0 0.45972116053418083 0.0 +0.007191609067431326 300.0 0.0 0.4763283937977089 0.0 +0.007693100238770012 300.0 0.0 0.4918913001425068 0.0 +0.008211502664641435 300.0 0.0 0.5064475077163358 0.0 +0.008746807510242927 300.0 0.0 0.5200449482275936 0.0 +0.00929900565271502 300.0 0.0 0.532738144371353 0.0 +0.009868087681296545 300.0 0.0 0.5445852012395845 0.0 +0.01045404389748472 300.0 0.0 0.5556454604448817 0.0 +0.01105686431520103 300.0 0.0 0.5659777499855595 0.0 +0.01167653866096097 300.0 0.0 0.5756391497457344 0.0 +0.01231305637404945 300.0 0.0 0.5846841826152349 0.0 +0.01296640660670023 300.0 0.0 0.5931643403160594 0.0 +0.01363657822428155 300.0 0.0 0.601127860670266 0.0 +0.01432355980548528 300.0 0.0 0.608619682139255 0.0 +0.01502733964252179 300.0 0.0 0.6156815050972786 0.0 +0.01574790574131968 300.0 0.0 0.6223518994969911 0.0 +0.01648524582172972 300.0 0.0 0.6286664134066627 0.0 +0.01723934731773447 300.0 0.0 0.6346576755798535 0.0 +0.01801019737766241 300.0 0.0 0.6403555190005279 0.0 +0.01879778286440703 300.0 0.0 0.6457871582543366 0.0 +0.0196020903556503 300.0 0.0 0.6509774062824263 0.0 +0.02042310614409193 300.0 0.0 0.6559488584319104 0.0 +0.02126081623768261 300.0 0.0 0.6607220139669816 0.0 +0.02211520635986297 300.0 0.0 0.6653154146337487 0.0 +0.02298626194980602 300.0 0.0 0.6697458361665584 0.0 +0.02387396816266618 300.0 0.0 0.6740284263030051 0.0 +0.02477830986983187 300.0 0.0 0.6781767885643138 0.0 +0.02569927165918329 300.0 0.0 0.6822031020398561 0.0 +0.02663683783535509 300.0 0.0 0.6861182708699223 0.0 +0.02759099242000418 300.0 0.0 0.6899320475117866 0.0 +0.0285617191520815 300.0 0.0 0.6936531306253383 0.0 +0.02954900148810957 300.0 0.0 0.697289274391367 0.0 +0.03055282260246439 300.0 0.0 0.700847418877707 0.0 +0.03157316538766197 300.0 0.0 0.7043338036947433 0.0 +0.03261001245465012 300.0 0.0 0.7077540244565094 0.0 +0.0336633461331044 300.0 0.0 0.7111130669920873 0.0 +0.03473314847172981 300.0 0.0 0.7144153223784735 0.0 +0.03581940123856664 300.0 0.0 0.7176645942914638 0.0 +0.03692208592130042 300.0 0.0 0.7208641757417564 0.0 +0.03804118372757859 300.0 0.0 0.7240170305590236 0.0 +0.03917667558532989 300.0 0.0 0.7271259207331257 0.0 +0.04032854214308979 300.0 0.0 0.7301934033701646 0.0 +0.04149676377033007 300.0 0.0 0.7332217993282111 0.0 +0.0426813205577935 300.0 0.0 0.7362131455439986 0.0 +0.04388219231783319 300.0 0.0 0.7391692003300155 0.0 +0.04509935858475644 300.0 0.0 0.7420914852425665 0.0 +0.04633279861517381 300.0 0.0 0.744981308448903 0.0 +0.04758249138835247 300.0 0.0 0.74783985979067 0.0 +0.04884841560657416 300.0 0.0 0.7506683169127073 0.0 +0.05013054969549879 300.0 0.0 0.7534677877241249 0.0 +0.05142887180453171 300.0 0.0 0.7562393057597661 0.0 +0.0527433598071958 300.0 0.0 0.7589839217504151 0.0 +0.05407399130150936 300.0 0.0 0.7617025776963112 0.0 +0.0554207436103672 300.0 0.0 0.7643960083517222 0.0 +0.05678359378192743 300.0 0.0 0.767064808851985 0.0 +0.05816251859000254 300.0 0.0 0.7697095126185458 0.0 +0.05955749453445514 300.0 0.0 0.7723306799775616 0.0 +0.06096849784159863 300.0 0.0 0.7749288729908923 0.0 +0.0623955044646024 300.0 0.0 0.7775045817819957 0.0 +0.06383849008390119 300.0 0.0 0.7800581798693501 0.0 +0.06529743010761013 300.0 0.0 0.7825899146693549 0.0 +0.06677229967194354 300.0 0.0 0.7851000034346878 0.0 +0.06826307364163875 300.0 0.0 0.7875887752508794 0.0 +0.06976972661038428 300.0 0.0 0.790056636442802 0.0 +0.0712922329012533 300.0 0.0 0.7925039470154007 0.0 +0.0728305665671406 300.0 0.0 0.7949310784150017 0.0 +0.07438470139120534 300.0 0.0 0.7973383740665354 0.0 +0.07595461088731725 300.0 0.0 0.7997261358672254 0.0 +0.07754026830050886 300.0 0.0 0.8020946171335985 0.0 +0.0791416466074305 300.0 0.0 0.8044440152994246 0.0 +0.0807587185168116 300.0 0.0 0.8067745510976451 0.0 +0.08239145646992563 300.0 0.0 0.8090864392710908 0.0 +0.08403983264105919 300.0 0.0 0.8113798275537744 0.0 +0.08570381893798718 300.0 0.0 0.813654862706185 0.0 +0.08738338700245085 300.0 0.0 0.8159117995712017 0.0 +0.08907850821064123 300.0 0.0 0.8181509403346153 0.0 +0.09078915367368723 300.0 0.0 0.8203726239021643 0.0 +0.09251529423814753 300.0 0.0 0.8225771840577804 0.0 +0.09425690048650792 300.0 0.0 0.8247648350590637 0.0 +0.09601394273768227 300.0 0.0 0.8269356358581906 0.0 +0.0977863910475184 300.0 0.0 0.8290896245193335 0.0 +0.09957421520930865 300.0 0.0 0.8312269522374758 0.0 +0.1013773847543044 300.0 0.0 0.8333478232877262 0.0 +0.1031958689522353 300.0 0.0 0.8354524834137913 0.0 +0.1050296368118336 300.0 0.0 0.8375412599030938 0.0 +0.1068786570813612 300.0 0.0 0.83961441959534 0.0 +0.1087428982491435 300.0 0.0 0.8416721966590038 0.0 +0.1106223285441054 300.0 0.0 0.8437149645893851 0.0 +0.1125169159363132 300.0 0.0 0.8457432801955882 0.0 +0.1144266281375207 300.0 0.0 0.8477577405258729 0.0 +0.1163514326017191 300.0 0.0 0.8497587019453117 0.0 +0.1182912965256916 300.0 0.0 0.8517462535964925 0.0 +0.1202461868495729 300.0 0.0 0.8537202567648244 0.0 +0.1222160702574122 300.0 0.0 0.8556805376195089 0.0 +0.1242009131777411 300.0 0.0 0.8576270567655011 0.0 +0.1262006817841457 300.0 0.0 0.859559855276432 0.0 +0.1282153419958432 300.0 0.0 0.8614790240461743 0.0 +0.1302448594782628 300.0 0.0 0.8633846225241005 0.0 +0.1322891996436305 300.0 0.0 0.8652767796685787 0.0 +0.1343483276515588 300.0 0.0 0.8671557758829654 0.0 +0.1364222084096405 300.0 0.0 0.8690219114218987 0.0 +0.1385108065740466 300.0 0.0 0.8708755751778129 0.0 +0.1406140865501285 300.0 0.0 0.8727171398583112 0.0 +0.1427320124930254 300.0 0.0 0.8745467195850641 0.0 +0.1448645483082741 300.0 0.0 0.8763643014488819 0.0 +0.1470116576524249 300.0 0.0 0.8781699758162448 0.0 +0.1491733039336606 300.0 0.0 0.8799639277618019 0.0 +0.1513494503124202 300.0 0.0 0.8817463985307787 0.0 +0.153540059702027 300.0 0.0 0.8835175714281407 0.0 +0.1557450947693203 300.0 0.0 0.8852774162205512 0.0 +0.1579645179352918 300.0 0.0 0.8870258409101626 0.0 +0.1601982913757256 300.0 0.0 0.8887628179088204 0.0 +0.1624463770218439 300.0 0.0 0.8904884475714206 0.0 +0.1647087365609547 300.0 0.0 0.8922029687521473 0.0 +0.1669853314371051 300.0 0.0 0.8939065997698805 0.0 +0.1692761228517385 300.0 0.0 0.8955993471359808 0.0 +0.1715810717643558 300.0 0.0 0.8972811995622746 0.0 +0.1739001388931806 300.0 0.0 0.8989524583382827 0.0 +0.1762332847158286 300.0 0.0 0.9006136088702439 0.0 +0.1785804694699815 300.0 0.0 0.9022650177404423 0.0 +0.1809416531540645 300.0 0.0 0.9039068724805179 0.0 +0.1833167955279277 300.0 0.0 0.9055391459871299 0.0 +0.1857058561135323 300.0 0.0 0.9071619216229164 0.0 +0.1881087941956401 300.0 0.0 0.9087754003620085 0.0 +0.1905255688225079 300.0 0.0 0.9103796430584327 0.0 +0.1929561388065848 300.0 0.0 0.911974726776834 0.0 +0.1954004627252144 300.0 0.0 0.9135606970140512 0.0 +0.197858498921341 300.0 0.0 0.9151376855427551 0.0 +0.200330205504219 300.0 0.0 0.9167059711207346 0.0 +0.2028155403501273 300.0 0.0 0.9182657846303789 0.0 +0.2053144611030869 300.0 0.0 0.9198173470853775 0.0 +0.207826925175583 300.0 0.0 0.9213609272334615 0.0 +0.2103528897492902 300.0 0.0 0.9228967515020714 0.0 +0.2128923117758034 300.0 0.0 0.9244247852399078 0.0 +0.2154451479773698 300.0 0.0 0.9259447467445927 0.0 +0.2180113548476281 300.0 0.0 0.9274563490254334 0.0 +0.2205908886523488 300.0 0.0 0.9289594592760015 0.0 +0.2231837054301802 300.0 0.0 0.9304542478509127 0.0 +0.225789760993397 300.0 0.0 0.9319412509979282 0.0 +0.2284090109286542 300.0 0.0 0.9334209418746512 0.0 +0.231041410597743 300.0 0.0 0.9348934405590973 0.0 +0.2336869151383524 300.0 0.0 0.9363587405745076 0.0 +0.2363454794648333 300.0 0.0 0.9378168765599467 0.0 +0.2390170582689671 300.0 0.0 0.9392678950487781 0.0 +0.2417016060207376 300.0 0.0 0.940711651065673 0.0 +0.2443990769691072 300.0 0.0 0.9421480922469726 0.0 +0.2471094251427964 300.0 0.0 0.9435771784982919 0.0 +0.2498326043510675 300.0 0.0 0.9449989788097755 0.0 +0.2525685681845112 300.0 0.0 0.9464136839308143 0.0 +0.2553172700158386 300.0 0.0 0.9478212946302264 0.0 +0.2580786630006749 300.0 0.0 0.9492217782573125 0.0 +0.260852700078358 300.0 0.0 0.9506151056434238 0.0 +0.2636393339727408 300.0 0.0 0.9520012477347317 0.0 +0.2664385171929963 300.0 0.0 0.9533803786785173 0.0 +0.2692502020344277 300.0 0.0 0.9547527257046486 0.0 +0.2720743405792809 300.0 0.0 0.9561184544824323 0.0 +0.2749108846975613 300.0 0.0 0.9574778239110496 0.0 +0.2777597860478538 300.0 0.0 0.9588310450011877 0.0 +0.2806209960781473 300.0 0.0 0.9601782292274886 0.0 +0.2834944660266612 300.0 0.0 0.9615193317258413 0.0 +0.2863801469226772 300.0 0.0 0.9628543117952431 0.0 +0.2892779895873737 300.0 0.0 0.9641832258074391 0.0 +0.2921879446346636 300.0 0.0 0.9655061102311662 0.0 +0.2951099624720362 300.0 0.0 0.9668230776449845 0.0 +0.2980439933014026 300.0 0.0 0.9681343864045031 0.0 +0.3009899871199438 300.0 0.0 0.9694402639247923 0.0 +0.3039478937209633 300.0 0.0 0.9707406583504683 0.0 +0.3069176626947427 300.0 0.0 0.9720353354914428 0.0 +0.3098992434294008 300.0 0.0 0.9733242700142486 0.0 +0.3128925851117559 300.0 0.0 0.9746078536245253 0.0 +0.315897636728192 300.0 0.0 0.9758863402151784 0.0 +0.3189143470655283 300.0 0.0 0.9771595088146999 0.0 +0.3219426647118918 300.0 0.0 0.9784272185083719 0.0 +0.3249825380575933 300.0 0.0 0.9796896634251465 0.0 +0.3280339152960073 300.0 0.0 0.9809470023963451 0.0 +0.331096744424455 300.0 0.0 0.9821991054488802 0.0 +0.3341709732450902 300.0 0.0 0.9834459085225121 0.0 +0.3372565493657887 300.0 0.0 0.9846875264424727 0.0 +0.340353420201042 300.0 0.0 0.9859240938340674 0.0 +0.3434615329728526 300.0 0.0 0.9871555114571253 0.0 +0.346580834711634 300.0 0.0 0.9883813577755736 0.0 +0.3497112722571132 300.0 0.0 0.9896015762012266 0.0 +0.3528527922592367 300.0 0.0 0.99081652702429 0.0 +0.35600534117908 300.0 0.0 0.9920262495184689 0.0 +0.3591688652897594 300.0 0.0 0.993230638256614 0.0 +0.3623433106773484 300.0 0.0 0.9944297593668414 0.0 +0.3655286232417957 300.0 0.0 0.9956237661357139 0.0 +0.368724748697848 300.0 0.0 0.9968125901403091 0.0 +0.3719316325759746 300.0 0.0 0.9979960986578006 0.0 +0.3751492202232959 300.0 0.0 0.9991743889398924 0.0 +0.3783774568045147 300.0 0.0 1.000347647126256 0.0 +0.3816162873028511 300.0 0.0 1.0015161551437557 0.0 +0.3848656565209795 300.0 0.0 1.0026802169912563 0.0 +0.3881255090819695 300.0 0.0 1.0038399040764108 0.0 +0.3913957894302302 300.0 0.0 1.0049953033517267 0.0 +0.3946764418324564 300.0 0.0 1.0061465436252042 0.0 +0.3979674103785783 300.0 0.0 1.0072934019273698 0.0 +0.4012686389827149 300.0 0.0 1.0084356583504384 0.0 +0.4045800713841297 300.0 0.0 1.0095733545366574 0.0 +0.407901651148189 300.0 0.0 1.0107065890036997 0.0 +0.4112333216673243 300.0 0.0 1.0118354965139098 0.0 +0.4145750261619968 300.0 0.0 1.0129604734335742 0.0 +0.417926707681665 300.0 0.0 1.01408193425014 0.0 +0.4212883091057552 300.0 0.0 1.0152001565281163 0.0 +0.4246597731446353 300.0 0.0 1.0163153568916408 0.0 +0.4280410423405908 300.0 0.0 1.0174277213201164 0.0 +0.4314320590688043 300.0 0.0 1.0185370504195503 0.0 +0.4348327655383372 300.0 0.0 1.019642798230917 0.0 +0.4382431037931148 300.0 0.0 1.0207446730023402 0.0 +0.4416630157129143 300.0 0.0 1.021842575607473 0.0 +0.4450924430143548 300.0 0.0 1.0229366924786005 0.0 +0.4485313272518908 300.0 0.0 1.0240272160718744 0.0 +0.4519796098188085 300.0 0.0 1.025114058909379 0.0 +0.4554372319482241 300.0 0.0 1.0261971221111332 0.0 +0.4589041347140854 300.0 0.0 1.0272764190152335 0.0 +0.4623802590321769 300.0 0.0 1.0283518990674234 0.0 +0.4658655456611256 300.0 0.0 1.0294234657645767 0.0 +0.4693599352034108 300.0 0.0 1.0304910509800187 0.0 +0.4728633681063773 300.0 0.0 1.0315544822130562 0.0 +0.4763757846632491 300.0 0.0 1.0326136853060508 0.0 +0.4798971250141478 300.0 0.0 1.0336686031996722 0.0 +0.4834273291471126 300.0 0.0 1.034719017484392 0.0 +0.4869663368991224 300.0 0.0 1.035764937541362 0.0 +0.4905140879571221 300.0 0.0 1.0368066522595223 0.0 +0.4940705218590499 300.0 0.0 1.0378444141311418 0.0 +0.4976355779948676 300.0 0.0 1.0388782948008106 0.0 +0.5012091956075939 300.0 0.0 1.0399083596192416 0.0 +0.5047913137943398 300.0 0.0 1.040934710480001 0.0 +0.5083818715073465 300.0 0.0 1.041957200670301 0.0 +0.5119808075550254 300.0 0.0 1.0429757432947437 0.0 +0.5155880606030014 300.0 0.0 1.0439903805785498 0.0 +0.5192035691751582 300.0 0.0 1.0450011270368005 0.0 +0.5228272716546859 300.0 0.0 1.0460078719393338 0.0 +0.5264591062851307 300.0 0.0 1.0470107647095013 0.0 +0.5300990111714481 300.0 0.0 1.0480101158827408 0.0 +0.5337469242810573 300.0 0.0 1.0490061315131571 0.0 +0.5374027834448982 300.0 0.0 1.049998911149802 0.0 +0.5410665263584914 300.0 0.0 1.050988243436124 0.0 +0.5447380905829997 300.0 0.0 1.0519738732048172 0.0 +0.5484174135462924 300.0 0.0 1.0529556094998889 0.0 +0.5521044325440113 300.0 0.0 1.0539333034248877 0.0 +0.5557990847406399 300.0 0.0 1.054906913979975 0.0 +0.5595013071705737 300.0 0.0 1.0558764699979581 0.0 +0.5632110367391936 300.0 0.0 1.056841953521945 0.0 +0.566928210223941 300.0 0.0 1.057803534098425 0.0 +0.5706527642753958 300.0 0.0 1.0587614606663196 0.0 +0.5743846354183553 300.0 0.0 1.059715828358481 0.0 +0.5781237600529161 300.0 0.0 1.0606665001402922 0.0 +0.5818700744555583 300.0 0.0 1.0616132130578062 0.0 +0.5856235147802317 300.0 0.0 1.0625558983662156 0.0 +0.5893840170594431 300.0 0.0 1.063494846560091 0.0 +0.593151517205347 300.0 0.0 1.0644299677355376 0.0 +0.5969259510108379 300.0 0.0 1.0653606677605645 0.0 +0.6007072541506442 300.0 0.0 1.0662864526398241 0.0 +0.6044953621824245 300.0 0.0 1.0672069239093953 0.0 +0.6082902105478664 300.0 0.0 1.068121706922733 0.0 +0.6120917345737857 300.0 0.0 1.069030475813776 0.0 +0.6158998694732298 300.0 0.0 1.0699332520359268 0.0 +0.6197145503465804 300.0 0.0 1.0708301957020576 0.0 +0.6235357121826612 300.0 0.0 1.0717213344748797 0.0 +0.6273632898598445 300.0 0.0 1.072606627668974 0.0 +0.6311972181471613 300.0 0.0 1.0734860402254864 0.0 +0.6350374317054138 300.0 0.0 1.0743596894671337 0.0 +0.6388838650882879 300.0 0.0 1.0752276615613787 0.0 +0.6427364527434689 300.0 0.0 1.0760898693822198 0.0 +0.6465951290137593 300.0 0.0 1.0769462024979783 0.0 +0.6504598281381966 300.0 0.0 1.0777966835969708 0.0 +0.6543304842531749 300.0 0.0 1.0786414776539237 0.0 +0.6582070313935672 300.0 0.0 1.0794807554297583 0.0 +0.6620894034938494 300.0 0.0 1.0803144862152758 0.0 +0.6659775343892262 300.0 0.0 1.081142405143407 0.0 +0.6698713578167591 300.0 0.0 1.0819642509990406 0.0 +0.6737708074164952 300.0 0.0 1.0827800011152235 0.0 +0.6776758167325982 300.0 0.0 1.0835897104066905 0.0 +0.6815863192144815 300.0 0.0 1.0843930466102056 0.0 +0.6855022482179417 300.0 0.0 1.0851894824968071 0.0 +0.6894235370062947 300.0 0.0 1.0859787166491295 0.0 +0.6933501187515128 300.0 0.0 1.0867605762402337 0.0 +0.6972819265353641 300.0 0.0 1.0875350056888133 0.0 +0.7012188933505527 300.0 0.0 1.0883021422398613 0.0 +0.7051609521018602 300.0 0.0 1.0890621688129631 0.0 +0.7091080356072901 300.0 0.0 1.0898151747391618 0.0 +0.7130600765992119 300.0 0.0 1.0905611944494604 0.0 +0.7170170077255077 300.0 0.0 1.091300148925149 0.0 +0.7209787615507204 300.0 0.0 1.0920320104138537 0.0 +0.7249452705572028 300.0 0.0 1.0927568538290762 0.0 +0.7289164671462678 300.0 0.0 1.093474536386571 0.0 +0.732892283639341 300.0 0.0 1.0941846803820647 0.0 +0.7368726522791142 300.0 0.0 1.0948868827183935 0.0 +0.7408575052306994 300.0 0.0 1.095580974770836 0.0 +0.7448467745827856 300.0 0.0 1.0962669184077736 0.0 +0.7488403923487958 300.0 0.0 1.0969446208084177 0.0 +0.752838290468046 300.0 0.0 1.0976139980965551 0.0 +0.7568404008069043 300.0 0.0 1.098275128126286 0.0 +0.7608466551599531 300.0 0.0 1.0989282183752769 0.0 +0.7648569852511511 300.0 0.0 1.099573232042445 0.0 +0.7688713227349963 300.0 0.0 1.1002099041468754 0.0 +0.7728895991976916 300.0 0.0 1.100837950306941 0.0 +0.7769117461583105 300.0 0.0 1.1014572806798282 0.0 +0.7809376950699636 300.0 0.0 1.102067985604749 0.0 +0.7849673773209678 300.0 0.0 1.1026700407295404 0.0 +0.7890007242360147 300.0 0.0 1.1032633577234505 0.0 +0.7930376670773416 300.0 0.0 1.1038476708187197 0.0 +0.7970781370459026 300.0 0.0 1.104422738022161 0.0 +0.8011220652825412 300.0 0.0 1.1049885353023232 0.0 +0.8051693828691638 300.0 0.0 1.1055448470037688 0.0 +0.8092200208299145 300.0 0.0 1.1060914642390087 0.0 +0.8132739101323502 300.0 0.0 1.106628350311339 0.0 +0.8173309816886172 300.0 0.0 1.107155376545416 0.0 +0.8213911663566287 300.0 0.0 1.1076723185689001 0.0 +0.8254543949412434 300.0 0.0 1.1081788222016578 0.0 +0.829520598195444 300.0 0.0 1.1086746368493074 0.0 +0.8335897068215181 300.0 0.0 1.109159813164577 0.0 +0.8376616514722389 300.0 0.0 1.10963459018341 0.0 +0.841736362752047 300.0 0.0 1.1100991076017594 0.0 +0.845813771218233 300.0 0.0 1.1105533754453123 0.0 +0.8498938073821211 300.0 0.0 1.1109972049947676 0.0 +0.8539764017102535 300.0 0.0 1.1114303392667393 0.0 +0.858061484625575 300.0 0.0 1.1118526704412035 0.0 +0.8621489865086192 300.0 0.0 1.1122641279560428 0.0 +0.8662388376986945 300.0 0.0 1.1126647084118235 0.0 +0.8703309684950719 300.0 0.0 1.1130543228625418 0.0 +0.8744253091581722 300.0 0.0 1.1134329177305022 0.0 +0.8785217899107551 300.0 0.0 1.1138005472542447 0.0 +0.8826203409391081 300.0 0.0 1.1141571709007685 0.0 +0.8867208923942361 300.0 0.0 1.1145026282029389 0.0 +0.8908233743930521 300.0 0.0 1.1148367835748216 0.0 +0.8949277170195682 300.0 0.0 1.1151596154780363 0.0 +0.8990338503260868 300.0 0.0 1.1154711733828995 0.0 +0.9031417043343931 300.0 0.0 1.1157713200263766 0.0 +0.9072512090369473 300.0 0.0 1.11605972508053 0.0 +0.9113622943980779 300.0 0.0 1.116336144189679 0.0 +0.9154748903551754 300.0 0.0 1.1166005500083394 0.0 +0.9195889268198859 300.0 0.0 1.1168529115709196 0.0 +0.923704333679306 300.0 0.0 1.1170930843004574 0.0 +0.9278210407971776 300.0 0.0 1.1173210208729007 0.0 +0.9319389780150831 300.0 0.0 1.117536637160364 0.0 +0.9360580751536409 300.0 0.0 1.1177398284033127 0.0 +0.9401782620137019 300.0 0.0 1.1179305881024477 0.0 +0.9442994683775454 300.0 0.0 1.1181089069629575 0.0 +0.9484216240100758 300.0 0.0 1.1182746876473275 0.0 +0.9525446586600201 300.0 0.0 1.1184277273200767 0.0 +0.9566685020611244 300.0 0.0 1.1185678673511346 0.0 +0.9607930839333522 300.0 0.0 1.1186951599682844 0.0 +0.964918333984081 300.0 0.0 1.1188096901542868 0.0 +0.9690441819093016 300.0 0.0 1.118911351122682 0.0 +0.9731705573948156 300.0 0.0 1.1190000308462351 0.0 +0.9772973901174332 300.0 0.0 1.119075791838296 0.0 +0.9814246097461727 300.0 0.0 1.1191387316178165 0.0 +0.9855521459434584 300.0 0.0 1.1191889672245374 0.0 +0.9896799283663196 300.0 0.0 1.1192266886822442 0.0 +0.9938078866675891 300.0 0.0 1.119251954837764 0.0 +0.9979359504971027 300.0 0.0 1.1192646414784726 0.0 +1.0 300.0 0.0 1.1192646414784726 0.0 diff --git a/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000DNS_sponge.txt b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000DNS_sponge.txt new file mode 100644 index 000000000..737895f86 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/input_ReTau2000DNS_sponge.txt @@ -0,0 +1,384 @@ +0.0 0.0 0.0 +1.217311652923492e-06 0.00011140613491415374 0.0 +6.086537518545931e-06 0.0005570274195276387 0.0 +1.704221791976046e-05 0.001559660241516003 0.0 +3.651878945154508e-05 0.0033420734502807845 0.0 +6.69505434929274e-05 0.0061269859333703105 0.0 +0.0001107715847206148 0.010137027830325164 0.0 +0.0001704157896263991 0.015594654328461917 0.0 +0.0002470994533848581 0.022610560551618166 0.0 +0.0003408212691252688 0.03118329599615294 0.0 +0.0004515796396062921 0.041309855577899 0.0 +0.000579372677243728 0.05298424056514345 0.0 +0.0007241982041420458 0.0661951414700109 0.0 +0.0008860537521320211 0.08092253985409509 0.0 +0.001064936562812813 0.0971331738653471 0.0 +0.001260843587598481 0.11477508395784822 0.0 +0.001473771487770281 0.1337718182129991 0.0 +0.001703716634533836 0.15401723219797894 0.0 +0.001950675109080202 0.17537202560217383 0.0 +0.002214642702653591 0.19766309500502766 0.0 +0.002495614916622313 0.22068641020278618 0.0 +0.002793586962555827 0.24421351408048736 0.0 +0.003108553762306454 0.26800106528869905 0.0 +0.003440509948095416 0.2918022762175396 0.0 +0.003789449862605099 0.3153787887917496 0.0 +0.00415536755907453 0.33851153352152946 0.0 +0.00453825680140163 0.3610093985843633 0.0 +0.004938111064248796 0.38271499588213365 0.0 +0.005354923533154365 0.40350732369344205 0.0 +0.005788687104649082 0.42330157619153297 0.0 +0.006239394386376662 0.44204666394902753 0.0 +0.006707037697219698 0.45972116053418083 0.0 +0.007191609067431326 0.4763283937977089 0.0 +0.007693100238770012 0.4918913001425068 0.0 +0.008211502664641435 0.5064475077163358 0.0 +0.008746807510242927 0.5200449482275936 0.0 +0.00929900565271502 0.532738144371353 0.0 +0.009868087681296545 0.5445852012395845 0.0 +0.01045404389748472 0.5556454604448817 0.0 +0.01105686431520103 0.5659777499855595 0.0 +0.01167653866096097 0.5756391497457344 0.0 +0.01231305637404945 0.5846841826152349 0.0 +0.01296640660670023 0.5931643403160594 0.0 +0.01363657822428155 0.601127860670266 0.0 +0.01432355980548528 0.608619682139255 0.0 +0.01502733964252179 0.6156815050972786 0.0 +0.01574790574131968 0.6223518994969911 0.0 +0.01648524582172972 0.6286664134066627 0.0 +0.01723934731773447 0.6346576755798535 0.0 +0.01801019737766241 0.6403555190005279 0.0 +0.01879778286440703 0.6457871582543366 0.0 +0.0196020903556503 0.6509774062824263 0.0 +0.02042310614409193 0.6559488584319104 0.0 +0.02126081623768261 0.6607220139669816 0.0 +0.02211520635986297 0.6653154146337487 0.0 +0.02298626194980602 0.6697458361665584 0.0 +0.02387396816266618 0.6740284263030051 0.0 +0.02477830986983187 0.6781767885643138 0.0 +0.02569927165918329 0.6822031020398561 0.0 +0.02663683783535509 0.6861182708699223 0.0 +0.02759099242000418 0.6899320475117866 0.0 +0.0285617191520815 0.6936531306253383 0.0 +0.02954900148810957 0.697289274391367 0.0 +0.03055282260246439 0.700847418877707 0.0 +0.03157316538766197 0.7043338036947433 0.0 +0.03261001245465012 0.7077540244565094 0.0 +0.0336633461331044 0.7111130669920873 0.0 +0.03473314847172981 0.7144153223784735 0.0 +0.03581940123856664 0.7176645942914638 0.0 +0.03692208592130042 0.7208641757417564 0.0 +0.03804118372757859 0.7240170305590236 0.0 +0.03917667558532989 0.7271259207331257 0.0 +0.04032854214308979 0.7301934033701646 0.0 +0.04149676377033007 0.7332217993282111 0.0 +0.0426813205577935 0.7362131455439986 0.0 +0.04388219231783319 0.7391692003300155 0.0 +0.04509935858475644 0.7420914852425665 0.0 +0.04633279861517381 0.744981308448903 0.0 +0.04758249138835247 0.74783985979067 0.0 +0.04884841560657416 0.7506683169127073 0.0 +0.05013054969549879 0.7534677877241249 0.0 +0.05142887180453171 0.7562393057597661 0.0 +0.0527433598071958 0.7589839217504151 0.0 +0.05407399130150936 0.7617025776963112 0.0 +0.0554207436103672 0.7643960083517222 0.0 +0.05678359378192743 0.767064808851985 0.0 +0.05816251859000254 0.7697095126185458 0.0 +0.05955749453445514 0.7723306799775616 0.0 +0.06096849784159863 0.7749288729908923 0.0 +0.0623955044646024 0.7775045817819957 0.0 +0.06383849008390119 0.7800581798693501 0.0 +0.06529743010761013 0.7825899146693549 0.0 +0.06677229967194354 0.7851000034346878 0.0 +0.06826307364163875 0.7875887752508794 0.0 +0.06976972661038428 0.790056636442802 0.0 +0.0712922329012533 0.7925039470154007 0.0 +0.0728305665671406 0.7949310784150017 0.0 +0.07438470139120534 0.7973383740665354 0.0 +0.07595461088731725 0.7997261358672254 0.0 +0.07754026830050886 0.8020946171335985 0.0 +0.0791416466074305 0.8044440152994246 0.0 +0.0807587185168116 0.8067745510976451 0.0 +0.08239145646992563 0.8090864392710908 0.0 +0.08403983264105919 0.8113798275537744 0.0 +0.08570381893798718 0.813654862706185 0.0 +0.08738338700245085 0.8159117995712017 0.0 +0.08907850821064123 0.8181509403346153 0.0 +0.09078915367368723 0.8203726239021643 0.0 +0.09251529423814753 0.8225771840577804 0.0 +0.09425690048650792 0.8247648350590637 0.0 +0.09601394273768227 0.8269356358581906 0.0 +0.0977863910475184 0.8290896245193335 0.0 +0.09957421520930865 0.8312269522374758 0.0 +0.1013773847543044 0.8333478232877262 0.0 +0.1031958689522353 0.8354524834137913 0.0 +0.1050296368118336 0.8375412599030938 0.0 +0.1068786570813612 0.83961441959534 0.0 +0.1087428982491435 0.8416721966590038 0.0 +0.1106223285441054 0.8437149645893851 0.0 +0.1125169159363132 0.8457432801955882 0.0 +0.1144266281375207 0.8477577405258729 0.0 +0.1163514326017191 0.8497587019453117 0.0 +0.1182912965256916 0.8517462535964925 0.0 +0.1202461868495729 0.8537202567648244 0.0 +0.1222160702574122 0.8556805376195089 0.0 +0.1242009131777411 0.8576270567655011 0.0 +0.1262006817841457 0.859559855276432 0.0 +0.1282153419958432 0.8614790240461743 0.0 +0.1302448594782628 0.8633846225241005 0.0 +0.1322891996436305 0.8652767796685787 0.0 +0.1343483276515588 0.8671557758829654 0.0 +0.1364222084096405 0.8690219114218987 0.0 +0.1385108065740466 0.8708755751778129 0.0 +0.1406140865501285 0.8727171398583112 0.0 +0.1427320124930254 0.8745467195850641 0.0 +0.1448645483082741 0.8763643014488819 0.0 +0.1470116576524249 0.8781699758162448 0.0 +0.1491733039336606 0.8799639277618019 0.0 +0.1513494503124202 0.8817463985307787 0.0 +0.153540059702027 0.8835175714281407 0.0 +0.1557450947693203 0.8852774162205512 0.0 +0.1579645179352918 0.8870258409101626 0.0 +0.1601982913757256 0.8887628179088204 0.0 +0.1624463770218439 0.8904884475714206 0.0 +0.1647087365609547 0.8922029687521473 0.0 +0.1669853314371051 0.8939065997698805 0.0 +0.1692761228517385 0.8955993471359808 0.0 +0.1715810717643558 0.8972811995622746 0.0 +0.1739001388931806 0.8989524583382827 0.0 +0.1762332847158286 0.9006136088702439 0.0 +0.1785804694699815 0.9022650177404423 0.0 +0.1809416531540645 0.9039068724805179 0.0 +0.1833167955279277 0.9055391459871299 0.0 +0.1857058561135323 0.9071619216229164 0.0 +0.1881087941956401 0.9087754003620085 0.0 +0.1905255688225079 0.9103796430584327 0.0 +0.1929561388065848 0.911974726776834 0.0 +0.1954004627252144 0.9135606970140512 0.0 +0.197858498921341 0.9151376855427551 0.0 +0.200330205504219 0.9167059711207346 0.0 +0.2028155403501273 0.9182657846303789 0.0 +0.2053144611030869 0.9198173470853775 0.0 +0.207826925175583 0.9213609272334615 0.0 +0.2103528897492902 0.9228967515020714 0.0 +0.2128923117758034 0.9244247852399078 0.0 +0.2154451479773698 0.9259447467445927 0.0 +0.2180113548476281 0.9274563490254334 0.0 +0.2205908886523488 0.9289594592760015 0.0 +0.2231837054301802 0.9304542478509127 0.0 +0.225789760993397 0.9319412509979282 0.0 +0.2284090109286542 0.9334209418746512 0.0 +0.231041410597743 0.9348934405590973 0.0 +0.2336869151383524 0.9363587405745076 0.0 +0.2363454794648333 0.9378168765599467 0.0 +0.2390170582689671 0.9392678950487781 0.0 +0.2417016060207376 0.940711651065673 0.0 +0.2443990769691072 0.9421480922469726 0.0 +0.2471094251427964 0.9435771784982919 0.0 +0.2498326043510675 0.9449989788097755 0.0 +0.2525685681845112 0.9464136839308143 0.0 +0.2553172700158386 0.9478212946302264 0.0 +0.2580786630006749 0.9492217782573125 0.0 +0.260852700078358 0.9506151056434238 0.0 +0.2636393339727408 0.9520012477347317 0.0 +0.2664385171929963 0.9533803786785173 0.0 +0.2692502020344277 0.9547527257046486 0.0 +0.2720743405792809 0.9561184544824323 0.0 +0.2749108846975613 0.9574778239110496 0.0 +0.2777597860478538 0.9588310450011877 0.0 +0.2806209960781473 0.9601782292274886 0.0 +0.2834944660266612 0.9615193317258413 0.0 +0.2863801469226772 0.9628543117952431 0.0 +0.2892779895873737 0.9641832258074391 0.0 +0.2921879446346636 0.9655061102311662 0.0 +0.2951099624720362 0.9668230776449845 0.0 +0.2980439933014026 0.9681343864045031 0.0 +0.3009899871199438 0.9694402639247923 0.0 +0.3039478937209633 0.9707406583504683 0.0 +0.3069176626947427 0.9720353354914428 0.0 +0.3098992434294008 0.9733242700142486 0.0 +0.3128925851117559 0.9746078536245253 0.0 +0.315897636728192 0.9758863402151784 0.0 +0.3189143470655283 0.9771595088146999 0.0 +0.3219426647118918 0.9784272185083719 0.0 +0.3249825380575933 0.9796896634251465 0.0 +0.3280339152960073 0.9809470023963451 0.0 +0.331096744424455 0.9821991054488802 0.0 +0.3341709732450902 0.9834459085225121 0.0 +0.3372565493657887 0.9846875264424727 0.0 +0.340353420201042 0.9859240938340674 0.0 +0.3434615329728526 0.9871555114571253 0.0 +0.346580834711634 0.9883813577755736 0.0 +0.3497112722571132 0.9896015762012266 0.0 +0.3528527922592367 0.99081652702429 0.0 +0.35600534117908 0.9920262495184689 0.0 +0.3591688652897594 0.993230638256614 0.0 +0.3623433106773484 0.9944297593668414 0.0 +0.3655286232417957 0.9956237661357139 0.0 +0.368724748697848 0.9968125901403091 0.0 +0.3719316325759746 0.9979960986578006 0.0 +0.3751492202232959 0.9991743889398924 0.0 +0.3783774568045147 1.000347647126256 0.0 +0.3816162873028511 1.0015161551437557 0.0 +0.3848656565209795 1.0026802169912563 0.0 +0.3881255090819695 1.0038399040764108 0.0 +0.3913957894302302 1.0049953033517267 0.0 +0.3946764418324564 1.0061465436252042 0.0 +0.3979674103785783 1.0072934019273698 0.0 +0.4012686389827149 1.0084356583504384 0.0 +0.4045800713841297 1.0095733545366574 0.0 +0.407901651148189 1.0107065890036997 0.0 +0.4112333216673243 1.0118354965139098 0.0 +0.4145750261619968 1.0129604734335742 0.0 +0.417926707681665 1.01408193425014 0.0 +0.4212883091057552 1.0152001565281163 0.0 +0.4246597731446353 1.0163153568916408 0.0 +0.4280410423405908 1.0174277213201164 0.0 +0.4314320590688043 1.0185370504195503 0.0 +0.4348327655383372 1.019642798230917 0.0 +0.4382431037931148 1.0207446730023402 0.0 +0.4416630157129143 1.021842575607473 0.0 +0.4450924430143548 1.0229366924786005 0.0 +0.4485313272518908 1.0240272160718744 0.0 +0.4519796098188085 1.025114058909379 0.0 +0.4554372319482241 1.0261971221111332 0.0 +0.4589041347140854 1.0272764190152335 0.0 +0.4623802590321769 1.0283518990674234 0.0 +0.4658655456611256 1.0294234657645767 0.0 +0.4693599352034108 1.0304910509800187 0.0 +0.4728633681063773 1.0315544822130562 0.0 +0.4763757846632491 1.0326136853060508 0.0 +0.4798971250141478 1.0336686031996722 0.0 +0.4834273291471126 1.034719017484392 0.0 +0.4869663368991224 1.035764937541362 0.0 +0.4905140879571221 1.0368066522595223 0.0 +0.4940705218590499 1.0378444141311418 0.0 +0.4976355779948676 1.0388782948008106 0.0 +0.5012091956075939 1.0399083596192416 0.0 +0.5047913137943398 1.040934710480001 0.0 +0.5083818715073465 1.041957200670301 0.0 +0.5119808075550254 1.0429757432947437 0.0 +0.5155880606030014 1.0439903805785498 0.0 +0.5192035691751582 1.0450011270368005 0.0 +0.5228272716546859 1.0460078719393338 0.0 +0.5264591062851307 1.0470107647095013 0.0 +0.5300990111714481 1.0480101158827408 0.0 +0.5337469242810573 1.0490061315131571 0.0 +0.5374027834448982 1.049998911149802 0.0 +0.5410665263584914 1.050988243436124 0.0 +0.5447380905829997 1.0519738732048172 0.0 +0.5484174135462924 1.0529556094998889 0.0 +0.5521044325440113 1.0539333034248877 0.0 +0.5557990847406399 1.054906913979975 0.0 +0.5595013071705737 1.0558764699979581 0.0 +0.5632110367391936 1.056841953521945 0.0 +0.566928210223941 1.057803534098425 0.0 +0.5706527642753958 1.0587614606663196 0.0 +0.5743846354183553 1.059715828358481 0.0 +0.5781237600529161 1.0606665001402922 0.0 +0.5818700744555583 1.0616132130578062 0.0 +0.5856235147802317 1.0625558983662156 0.0 +0.5893840170594431 1.063494846560091 0.0 +0.593151517205347 1.0644299677355376 0.0 +0.5969259510108379 1.0653606677605645 0.0 +0.6007072541506442 1.0662864526398241 0.0 +0.6044953621824245 1.0672069239093953 0.0 +0.6082902105478664 1.068121706922733 0.0 +0.6120917345737857 1.069030475813776 0.0 +0.6158998694732298 1.0699332520359268 0.0 +0.6197145503465804 1.0708301957020576 0.0 +0.6235357121826612 1.0717213344748797 0.0 +0.6273632898598445 1.072606627668974 0.0 +0.6311972181471613 1.0734860402254864 0.0 +0.6350374317054138 1.0743596894671337 0.0 +0.6388838650882879 1.0752276615613787 0.0 +0.6427364527434689 1.0760898693822198 0.0 +0.6465951290137593 1.0769462024979783 0.0 +0.6504598281381966 1.0777966835969708 0.0 +0.6543304842531749 1.0786414776539237 0.0 +0.6582070313935672 1.0794807554297583 0.0 +0.6620894034938494 1.0803144862152758 0.0 +0.6659775343892262 1.081142405143407 0.0 +0.6698713578167591 1.0819642509990406 0.0 +0.6737708074164952 1.0827800011152235 0.0 +0.6776758167325982 1.0835897104066905 0.0 +0.6815863192144815 1.0843930466102056 0.0 +0.6855022482179417 1.0851894824968071 0.0 +0.6894235370062947 1.0859787166491295 0.0 +0.6933501187515128 1.0867605762402337 0.0 +0.6972819265353641 1.0875350056888133 0.0 +0.7012188933505527 1.0883021422398613 0.0 +0.7051609521018602 1.0890621688129631 0.0 +0.7091080356072901 1.0898151747391618 0.0 +0.7130600765992119 1.0905611944494604 0.0 +0.7170170077255077 1.091300148925149 0.0 +0.7209787615507204 1.0920320104138537 0.0 +0.7249452705572028 1.0927568538290762 0.0 +0.7289164671462678 1.093474536386571 0.0 +0.732892283639341 1.0941846803820647 0.0 +0.7368726522791142 1.0948868827183935 0.0 +0.7408575052306994 1.095580974770836 0.0 +0.7448467745827856 1.0962669184077736 0.0 +0.7488403923487958 1.0969446208084177 0.0 +0.752838290468046 1.0976139980965551 0.0 +0.7568404008069043 1.098275128126286 0.0 +0.7608466551599531 1.0989282183752769 0.0 +0.7648569852511511 1.099573232042445 0.0 +0.7688713227349963 1.1002099041468754 0.0 +0.7728895991976916 1.100837950306941 0.0 +0.7769117461583105 1.1014572806798282 0.0 +0.7809376950699636 1.102067985604749 0.0 +0.7849673773209678 1.1026700407295404 0.0 +0.7890007242360147 1.1032633577234505 0.0 +0.7930376670773416 1.1038476708187197 0.0 +0.7970781370459026 1.104422738022161 0.0 +0.8011220652825412 1.1049885353023232 0.0 +0.8051693828691638 1.1055448470037688 0.0 +0.8092200208299145 1.1060914642390087 0.0 +0.8132739101323502 1.106628350311339 0.0 +0.8173309816886172 1.107155376545416 0.0 +0.8213911663566287 1.1076723185689001 0.0 +0.8254543949412434 1.1081788222016578 0.0 +0.829520598195444 1.1086746368493074 0.0 +0.8335897068215181 1.109159813164577 0.0 +0.8376616514722389 1.10963459018341 0.0 +0.841736362752047 1.1100991076017594 0.0 +0.845813771218233 1.1105533754453123 0.0 +0.8498938073821211 1.1109972049947676 0.0 +0.8539764017102535 1.1114303392667393 0.0 +0.858061484625575 1.1118526704412035 0.0 +0.8621489865086192 1.1122641279560428 0.0 +0.8662388376986945 1.1126647084118235 0.0 +0.8703309684950719 1.1130543228625418 0.0 +0.8744253091581722 1.1134329177305022 0.0 +0.8785217899107551 1.1138005472542447 0.0 +0.8826203409391081 1.1141571709007685 0.0 +0.8867208923942361 1.1145026282029389 0.0 +0.8908233743930521 1.1148367835748216 0.0 +0.8949277170195682 1.1151596154780363 0.0 +0.8990338503260868 1.1154711733828995 0.0 +0.9031417043343931 1.1157713200263766 0.0 +0.9072512090369473 1.11605972508053 0.0 +0.9113622943980779 1.116336144189679 0.0 +0.9154748903551754 1.1166005500083394 0.0 +0.9195889268198859 1.1168529115709196 0.0 +0.923704333679306 1.1170930843004574 0.0 +0.9278210407971776 1.1173210208729007 0.0 +0.9319389780150831 1.117536637160364 0.0 +0.9360580751536409 1.1177398284033127 0.0 +0.9401782620137019 1.1179305881024477 0.0 +0.9442994683775454 1.1181089069629575 0.0 +0.9484216240100758 1.1182746876473275 0.0 +0.9525446586600201 1.1184277273200767 0.0 +0.9566685020611244 1.1185678673511346 0.0 +0.9607930839333522 1.1186951599682844 0.0 +0.964918333984081 1.1188096901542868 0.0 +0.9690441819093016 1.118911351122682 0.0 +0.9731705573948156 1.1190000308462351 0.0 +0.9772973901174332 1.119075791838296 0.0 +0.9814246097461727 1.1191387316178165 0.0 +0.9855521459434584 1.1191889672245374 0.0 +0.9896799283663196 1.1192266886822442 0.0 +0.9938078866675891 1.119251954837764 0.0 +0.9979359504971027 1.1192646414784726 0.0 diff --git a/Exec/DevTests/ABL_perturbation_inflow/prob.H b/Exec/DevTests/ABL_perturbation_inflow/prob.H new file mode 100644 index 000000000..ed45c8e3a --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/prob.H @@ -0,0 +1,84 @@ +#ifndef _PROB_H_ +#define _PROB_H_ + +#include + +#include "AMReX_REAL.H" + +#include "prob_common.H" + +struct ProbParm : ProbParmDefaults { + amrex::Real rho_0 = 0.0; + amrex::Real T_0 = 0.0; + amrex::Real A_0 = 1.0; + amrex::Real KE_0 = 0.1; + amrex::Real QKE_0 = 0.1; + + amrex::Real KE_decay_height = -1; + amrex::Real KE_decay_order = 1; + + amrex::Real U_0 = 0.0; + amrex::Real V_0 = 0.0; + amrex::Real W_0 = 0.0; + + // random initial perturbations (legacy code) + amrex::Real U_0_Pert_Mag = 0.0; + amrex::Real V_0_Pert_Mag = 0.0; + amrex::Real W_0_Pert_Mag = 0.0; + amrex::Real T_0_Pert_Mag = 0.0; // perturbation to rho*Theta + bool pert_rhotheta = true; + + // divergence-free initial perturbations + amrex::Real pert_deltaU = 0.0; + amrex::Real pert_deltaV = 0.0; + amrex::Real pert_periods_U = 5.0; + amrex::Real pert_periods_V = 5.0; + amrex::Real pert_ref_height = 100.0; + + // rayleigh damping + amrex::Real dampcoef = 0.2; // inverse time scale [1/s] + amrex::Real zdamp = 500.0; // damping depth [m] from model top + + // helper vars + amrex::Real aval; + amrex::Real bval; + amrex::Real ufac; + amrex::Real vfac; +}; // namespace ProbParm + +class Problem : public ProblemBase +{ +public: + Problem(const amrex::Real* problo, const amrex::Real* probhi); + +#include "Prob/init_constant_density_hse.H" +#include "Prob/init_rayleigh_damping.H" + + void init_custom_pert ( + const amrex::Box& bx, + const amrex::Box& xbx, + const amrex::Box& ybx, + const amrex::Box& zbx, + amrex::Array4 const& state, + amrex::Array4 const& state_pert, + amrex::Array4 const& x_vel_pert, + amrex::Array4 const& y_vel_pert, + amrex::Array4 const& z_vel_pert, + amrex::Array4 const& r_hse, + amrex::Array4 const& p_hse, + amrex::Array4 const& z_nd, + amrex::Array4 const& z_cc, + amrex::GeometryData const& geomdata, + amrex::Array4 const& mf_m, + amrex::Array4 const& mf_u, + amrex::Array4 const& mf_v, + const SolverChoice& sc) override; + +protected: + std::string name() override { return "ABL"; } + +private: + ProbParm parms; +}; + +#endif diff --git a/Exec/DevTests/ABL_perturbation_inflow/prob.cpp b/Exec/DevTests/ABL_perturbation_inflow/prob.cpp new file mode 100644 index 000000000..3e75681c2 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/prob.cpp @@ -0,0 +1,199 @@ +#include "prob.H" +#include "AMReX_Random.H" + +using namespace amrex; + +std::unique_ptr +amrex_probinit(const amrex_real* problo, const amrex_real* probhi) +{ + return std::make_unique(problo, probhi); +} + +Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) +{ + // Parse params + ParmParse pp("prob"); + pp.query("rho_0", parms.rho_0); + pp.query("T_0", parms.T_0); + pp.query("A_0", parms.A_0); + pp.query("KE_0", parms.KE_0); + pp.query("QKE_0", parms.QKE_0); + pp.query("KE_decay_height", parms.KE_decay_height); + pp.query("KE_decay_order", parms.KE_decay_order); + + pp.query("U_0", parms.U_0); + pp.query("V_0", parms.V_0); + pp.query("W_0", parms.W_0); + pp.query("U_0_Pert_Mag", parms.U_0_Pert_Mag); + pp.query("V_0_Pert_Mag", parms.V_0_Pert_Mag); + pp.query("W_0_Pert_Mag", parms.W_0_Pert_Mag); + pp.query("T_0_Pert_Mag", parms.T_0_Pert_Mag); + pp.query("pert_rhotheta", parms.pert_rhotheta); + + pp.query("pert_deltaU", parms.pert_deltaU); + pp.query("pert_deltaV", parms.pert_deltaV); + pp.query("pert_periods_U", parms.pert_periods_U); + pp.query("pert_periods_V", parms.pert_periods_V); + pp.query("pert_ref_height", parms.pert_ref_height); + parms.aval = parms.pert_periods_U * 2.0 * PI / (probhi[1] - problo[1]); + parms.bval = parms.pert_periods_V * 2.0 * PI / (probhi[0] - problo[0]); + parms.ufac = parms.pert_deltaU * std::exp(0.5) / parms.pert_ref_height; + parms.vfac = parms.pert_deltaV * std::exp(0.5) / parms.pert_ref_height; + + pp.query("dampcoef", parms.dampcoef); + pp.query("zdamp", parms.zdamp); + + init_base_parms(parms.rho_0, parms.T_0); +} + +void +Problem::init_custom_pert( + const amrex::Box& bx, + const amrex::Box& xbx, + const amrex::Box& ybx, + const amrex::Box& zbx, + amrex::Array4 const& /*state*/, + amrex::Array4 const& state_pert, + amrex::Array4 const& x_vel_pert, + amrex::Array4 const& y_vel_pert, + amrex::Array4 const& z_vel_pert, + amrex::Array4 const& r_hse, + amrex::Array4 const& /*p_hse*/, + amrex::Array4 const& z_nd, + amrex::Array4 const& z_cc, + amrex::GeometryData const& geomdata, + amrex::Array4 const& /*mf_m*/, + amrex::Array4 const& /*mf_u*/, + amrex::Array4 const& /*mf_v*/, + const SolverChoice& sc) +{ + const bool use_moisture = (sc.moisture_type != MoistureType::None); + + const bool use_terrain = sc.use_terrain; + + if (parms.KE_decay_height > 0) { + amrex::Print() << "Initial KE profile (order " << parms.KE_decay_order + << ") will extend up to " << parms.KE_decay_height + << std::endl; + } + + if (parms.pert_ref_height > 0) { + if ((parms.pert_deltaU != 0.0) || (parms.pert_deltaV != 0.0)) { + amrex::Print() << "Adding divergence-free perturbations " + << parms.pert_deltaU << " " << parms.pert_deltaV + << std::endl; + } + if (parms.U_0_Pert_Mag != 0.0) { + amrex::Print() << "Adding random x-velocity perturbations" << std::endl; + } + if (parms.V_0_Pert_Mag != 0.0) { + amrex::Print() << "Adding random y-velocity perturbations" << std::endl; + } + if (parms.T_0_Pert_Mag != 0.0) { + if (parms.pert_rhotheta) { + amrex::Print() << "Adding random rho*theta perturbations" << std::endl; + } else { + amrex::Print() << "Adding random theta perturbations" << std::endl; + } + } + } + + ParallelForRNG(bx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + // Geometry + const Real* prob_lo = geomdata.ProbLo(); + const Real* prob_hi = geomdata.ProbHi(); + const Real* dx = geomdata.CellSize(); + const Real x = prob_lo[0] + (i + 0.5) * dx[0]; + const Real y = prob_lo[1] + (j + 0.5) * dx[1]; + const Real z = use_terrain ? z_cc(i,j,k) : prob_lo[2] + (k + 0.5) * dx[2]; + + // Define a point (xc,yc,zc) at the center of the domain + const Real xc = 0.5 * (prob_lo[0] + prob_hi[0]); + const Real yc = 0.5 * (prob_lo[1] + prob_hi[1]); + const Real zc = 0.5 * (prob_lo[2] + prob_hi[2]); + + const Real r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc) + (z-zc)*(z-zc)); + + // Add temperature perturbations + if ((z <= parms.pert_ref_height) && (parms.T_0_Pert_Mag != 0.0)) { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + state_pert(i, j, k, RhoTheta_comp) = (rand_double*2.0 - 1.0)*parms.T_0_Pert_Mag; + if (!parms.pert_rhotheta) { + // we're perturbing theta, not rho*theta + state_pert(i, j, k, RhoTheta_comp) *= r_hse(i,j,k); + } + } + }); + + // Set the x-velocity + ParallelForRNG(xbx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + const Real* prob_lo = geomdata.ProbLo(); + const Real* dx = geomdata.CellSize(); + const Real y = prob_lo[1] + (j + 0.5) * dx[1]; + const Real z = use_terrain ? 0.25*( z_nd(i,j ,k) + z_nd(i,j ,k+1) + + z_nd(i,j+1,k) + z_nd(i,j+1,k+1) ) + : prob_lo[2] + (k + 0.5) * dx[2]; + + // Set the x-velocity + x_vel_pert(i, j, k) = parms.U_0; + /*if ((z <= parms.pert_ref_height) && (parms.U_0_Pert_Mag != 0.0)) + { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + Real x_vel_prime = (rand_double*2.0 - 1.0)*parms.U_0_Pert_Mag; + x_vel_pert(i, j, k) += x_vel_prime; + } + if (parms.pert_deltaU != 0.0) + { + const amrex::Real yl = y - prob_lo[1]; + const amrex::Real zl = z / parms.pert_ref_height; + const amrex::Real damp = std::exp(-0.5 * zl * zl); + x_vel_pert(i, j, k) += parms.ufac * damp * z * std::cos(parms.aval * yl); + }*/ + }); + + // Set the y-velocity + ParallelForRNG(ybx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + const Real* prob_lo = geomdata.ProbLo(); + const Real* dx = geomdata.CellSize(); + const Real x = prob_lo[0] + (i + 0.5) * dx[0]; + const Real z = use_terrain ? 0.25*( z_nd(i ,j,k) + z_nd(i ,j,k+1) + + z_nd(i+1,j,k) + z_nd(i+1,j,k+1) ) + : prob_lo[2] + (k + 0.5) * dx[2]; + + // Set the y-velocity + y_vel_pert(i, j, k) = parms.V_0; + /*if ((z <= parms.pert_ref_height) && (parms.V_0_Pert_Mag != 0.0)) + { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + Real y_vel_prime = (rand_double*2.0 - 1.0)*parms.V_0_Pert_Mag; + y_vel_pert(i, j, k) += y_vel_prime; + } + if (parms.pert_deltaV != 0.0) + { + const amrex::Real xl = x - prob_lo[0]; + const amrex::Real zl = z / parms.pert_ref_height; + const amrex::Real damp = std::exp(-0.5 * zl * zl); + y_vel_pert(i, j, k) += parms.vfac * damp * z * std::cos(parms.bval * xl); + }*/ + }); + + /* + // Set the z-velocity + ParallelForRNG(zbx, [=, parms=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + const int dom_lo_z = geomdata.Domain().smallEnd()[2]; + const int dom_hi_z = geomdata.Domain().bigEnd()[2]; + + // Set the z-velocity + if (k == dom_lo_z || k == dom_hi_z+1) + { + z_vel_pert(i, j, k) = 0.0; + } + else if (parms.W_0_Pert_Mag != 0.0) + { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + Real z_vel_prime = (rand_double*2.0 - 1.0)*parms.W_0_Pert_Mag; + z_vel_pert(i, j, k) = parms.W_0 + z_vel_prime; + } + }); + */ +} diff --git a/Exec/DevTests/ABL_perturbation_inflow/sourceRun.sh b/Exec/DevTests/ABL_perturbation_inflow/sourceRun.sh new file mode 100644 index 000000000..8d62b4000 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/sourceRun.sh @@ -0,0 +1 @@ +mpiexec -n 4 ./ERF3d.gnu.DEBUG.TPROF.MPI.ex toc_inout_inputs > simulation.out diff --git a/Exec/DevTests/ABL_perturbation_inflow/toc_inout_inputs b/Exec/DevTests/ABL_perturbation_inflow/toc_inout_inputs new file mode 100644 index 000000000..c3a4aee68 --- /dev/null +++ b/Exec/DevTests/ABL_perturbation_inflow/toc_inout_inputs @@ -0,0 +1,96 @@ +# ------------------ INPUTS TO MAIN PROGRAM ------------------- +start_time = 0. +stop_time = 35.0 +#stop_time = 10.0 + +#max_step = 1000 + +amrex.fpe_trap_invalid = 1 + +fabarray.mfiter_tile_size = 1024 1024 1024 + +# PROBLEM SIZE & GEOMETRY +#geometry.prob_extent = 4. 1. 1. +#amr.n_cell = 128 32 32 + +geometry.prob_extent = 10. 1. 1. +#amr.n_cell = 128 16 16 +amr.n_cell = 128 16 64 + +geometry.is_periodic = 0 1 0 + +xlo.type = "Outflow" +xhi.type = "Outflow" +zlo.type = "NoSlipWall" +zhi.type = "SlipWall" + +# TIME STEP CONTROL +erf.no_substepping = 1 +erf.cfl = 0.5 + +erf.dynamicViscosity = 0.0001 # H = 1, therefore utau = 0.2 + +# DIAGNOSTICS & VERBOSITY +erf.sum_interval = 1 # timesteps between computing mass +erf.pert_interval = 1 # timesteps between perturbation output message +erf.v = 1 # verbosity in ERF.cpp +amr.v = 0 # verbosity in Amr.cpp + +# REFINEMENT / REGRIDDING +amr.max_level = 0 # maximum level number allowed + +# PLOTFILES +erf.plot_file_1 = plt # prefix of plotfile name +#erf.plot_per_1 = 0.1 +erf.plot_int_1 = 10 +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta + +# CHECKPOINT FILES +erf.check_file = chk # root name of checkpoint file +erf.check_per = 1.0 + +# Restart for data collection +#erf.restart = "/home/tma/Desktop/TurbChannel/SpinUp/chk233334" +#erf.data_log = "surf.txt" "mean.txt" "flux.txt" "subgrid.txt" +#erf.profile_int = 33334 + +# SOLVER CHOICE +erf.alpha_T = 0.0 +erf.alpha_C = 1.0 +erf.use_gravity = false + +erf.molec_diff_type = "None" +erf.les_type = "Smagorinsky" +erf.Cs = 0.1 + +erf.buoyancy_type = 1 + +# Initial condition for the entire field +erf.init_type = "input_sounding" +erf.input_sounding_file = "input_ReTau2000DNS_sounding.txt" + +# Inflow boundary condition +erf.sponge_type = "input_sponge" +erf.input_sponge_file = "input_ReTau2000DNS_sponge.txt" +erf.sponge_strength = 100000.0 +erf.use_xlo_sponge_damping = true +erf.xlo_sponge_end = 1.0 + +# Turbulent inflow generation +erf.perturbation_type = "source" +erf.perturbation_direction = 1 0 0 +erf.perturbation_layers = 3 +erf.perturbation_offset = 0 + +erf.perturbation_box_dims = 4 4 8 # 0.25 0.25 0.125 +erf.perturbation_nondimensional = 0.042 # Ri +erf.perturbation_T_infinity = 300.0 +erf.perturbation_T_intensity = 0.1 + +# PROBLEM PARAMETERS +prob.rho_0 = 1.0 +prob.A_0 = 1.0 +prob.U_0 = 0.0 +prob.V_0 = 0.0 +prob.W_0 = 0.0 +prob.T_0 = 300.0 diff --git a/Exec/SpongeTest/inputs_sponge_test b/Exec/SpongeTest/inputs_sponge_test index 8d72f7cfb..2ea3194ac 100644 --- a/Exec/SpongeTest/inputs_sponge_test +++ b/Exec/SpongeTest/inputs_sponge_test @@ -26,7 +26,7 @@ zhi.type = "Outflow" # SPONGE ZONE BCS erf.sponge_type = "input_sponge" -erf.input_sponge_file = "input_sponge_file.txt" +erf.input_sponge_file = "input_ReTau2000_loglaw.txt" erf.sponge_strength = 1000.0 erf.use_xlo_sponge_damping = true erf.xlo_sponge_end = 4.0 diff --git a/Source/DataStructs/DataStruct.H b/Source/DataStructs/DataStruct.H index 44a027b15..5482c212c 100644 --- a/Source/DataStructs/DataStruct.H +++ b/Source/DataStructs/DataStruct.H @@ -62,8 +62,7 @@ enum Sponge { }; enum struct PerturbationType { - BPM, CPM, None - // Box perturbation method, Cell perturbation method, None + perturbSource, perturbDirect, None }; /** @@ -238,18 +237,18 @@ struct SolverChoice { // Which type of inflow turbulent generation static std::string turb_pert_type_string = "None"; - pp.query("inlet_perturbation_type",turb_pert_type_string); - if (!turb_pert_type_string.compare("BoxPerturbation")) { - pert_type = PerturbationType::BPM; - amrex::Print() << "Box perturbation method selected\n"; - } else if (!turb_pert_type_string.compare("CellPerturbation")) { - pert_type = PerturbationType::CPM; - amrex::Print() << "Cell perturbation method selected\n"; + pp.query("perturbation_type",turb_pert_type_string); + if (!turb_pert_type_string.compare("source")) { + pert_type = PerturbationType::perturbSource; + amrex::Print() << "Perturb temperature via source term\n"; + } else if (!turb_pert_type_string.compare("direct")) { + pert_type = PerturbationType::perturbDirect; + amrex::Print() << "Perturb temperature via direct field add\n"; } else if (!turb_pert_type_string.compare("None")) { pert_type = PerturbationType::None; amrex::Print() << "No perturbation method selected\n"; } else { - amrex::Abort("Dont know this inlet_perturbation_type"); + amrex::Abort("Dont know this perturbation_type"); } amrex::Vector abl_pressure_grad_in = {0.0, 0.0, 0.0}; diff --git a/Source/DataStructs/TurbPertStruct.H b/Source/DataStructs/TurbPertStruct.H index 40224515c..6f4a1ddeb 100644 --- a/Source/DataStructs/TurbPertStruct.H +++ b/Source/DataStructs/TurbPertStruct.H @@ -3,6 +3,7 @@ #include #include +#include /** * Container holding quantities related to turbulent perturbation parameters @@ -12,47 +13,64 @@ struct TurbulentPerturbation { public: - ~TurbulentPerturbation () { - amrex::Print() << "~TurbulentPerturbation destructor\n"; - } - -//#define DIAGONAL_REF -#define LENGTH_REF - -/* void init_tpi_const(const amrex::Real T_0) - { - // Bulk Richardson number - tpi_nonDim = 0.042; - - // Ambient Temperature - tpi_Tinfty = T_0; - }*/ + ~TurbulentPerturbation () {} // Initializing Perturbation Region + // Currently only support perturbation in the x and y direction // Note: Box will always be initialized at cell centered void init_tpi (const int lev, const amrex::IntVect& nx, amrex::GpuArray const dx) { - // TODO: Use user Param to define this (Currently HARDCODED) - // Perturbation box region setup - int pertBox_offset = 0; - amrex::IntVect regionLo(0+pertBox_offset, 0, 0); - amrex::IntVect regionHi(7+pertBox_offset, nx[1], nx[2]); - amrex::IntVect boxSize(8,8,8); - //amrex::IntVect boxSize(4,4,4); // HACK - - // TODO: This will need to be changed later on - tpi_Lpb = 8*dx[0]; - tpi_Wpb = 8*dx[1]; - tpi_Hpb = 8*dx[2]; - - #ifdef DIAGONAL_REF - tpi_lref = sqrt(boxSize(0)*boxSize(0)*dx[0]*dx[0] + boxSize(1)*boxSize(1)*dx[1]*dx[1]); - #elif defined(LENGTH_REF) - tpi_lref = 8*dx[0]; - #endif + amrex::ParmParse pp(pp_prefix); + + // Reading inputs, and placing assertion for the perturbation inflow to work + pp.queryarr("perturbation_box_dims",tpi_boxDim); + pp.queryarr("perturbation_direction",tpi_direction); + pp.query("perturbation_layers",tpi_layers); + pp.query("perturbation_offset",tpi_offset); + + pp.query("perturbation_nondimensional",tpi_nonDim); + pp.query("perturbation_T_infinity",tpi_Tinf); + pp.query("perturbation_T_intensity",tpi_Ti); + pp.query("perturbation_rho_0",tpi_rho); + pp.query("perturbation_cp",tpi_cp); + + // Check variables message + if (tpi_layers < 0) { amrex::Abort("Please provide a valid perturbation layer value (ie. 3-5)"); } + if (tpi_offset < 0) { amrex::Abort("Please provide a valid inflow cell offset value for perturbation region (ie. 0-5)"); } + for (int i = 0; i < tpi_boxDim.size(); i++) { + if (tpi_boxDim[i] == 0) { amrex::Abort("Please provide valid dimensions for perturbation boxes."); } + } + if (tpi_nonDim < 0.) { amrex::Abort("Please provide a valid nondimensional number (ie. Ri = 0.042)"); } + if (tpi_Tinf < 0.) { amrex::Abort("Please provide a valid ambient temperature value (ie. T_0)"); } + if (tpi_Ti <= 0.) { amrex::Abort("Please provide a valid temperature intensity value (ie. 0-1.0)"); } + if (tpi_rho < 0.) { amrex::Abort("Please provide a valid density (ie. rho_0)"); } + if (tpi_cp < 0.) { amrex::Abort("Please provide a valid specific head capacity"); } + + // Creating perturbation region + amrex::IntVect regionLo; + amrex::IntVect regionHi; + amrex::IntVect boxSize(tpi_boxDim[0],tpi_boxDim[1],tpi_boxDim[2]); // boxSize for individual boxes + + // X-direction perturbation + if (tpi_direction[0]) { + amrex::IntVect tmpLo(0+tpi_offset, 0, 0); + amrex::IntVect tmpHi(((tpi_layers*tpi_boxDim[0])-1)+tpi_offset, nx[1], nx[2]); + regionLo = tmpLo; + regionHi = tmpHi; + } + + // Y-direction Perturbation + if (tpi_direction[1]) { + amrex::IntVect tmpLo(0, 0+tpi_offset, 0); + amrex::IntVect tmpHi(nx[0], ((tpi_layers*tpi_boxDim[1])-1)+tpi_offset, nx[2]); + regionLo = tmpLo; + regionHi = tmpHi; + } + + if(tpi_direction[2]) { amrex::Abort("Currently not supporting z-direction flow perturbation"); } // Creating structure box array for conserved quantity amrex::Box tmp_bx(regionLo, regionHi, amrex::IntVect(0,0,0)); @@ -64,21 +82,36 @@ struct TurbulentPerturbation { pb_mag.resize(pb_ba[lev].size(), 0.); // Set size of vector and initialize - pb_freq.resize(pb_ba[lev].size(), -1.0); + pb_interval.resize(pb_ba[lev].size(), -1.0); pb_local_etime.resize(pb_ba[lev].size(), 0.0); pb_amp.resize(pb_ba[lev].size(), 0.0); + // Computing perturbation reference length + tpi_Lpb = tpi_boxDim[0]*dx[0]; + tpi_Wpb = tpi_boxDim[1]*dx[1]; + tpi_Hpb = tpi_boxDim[2]*dx[2]; + tpi_lref = sqrt(tpi_Lpb*tpi_Lpb + tpi_Wpb*tpi_Wpb); + // Function check point message - amrex::Print() << "Turbulent perturbation region initialized with ba " << pb_ba[lev].size() << " boxes\n"; - - // Function method check point message - amrex::Print() << "Using "; - #ifdef DIAGONAL_REF - amrex::Print() << "box diagonal "; - #elif defined(LENGTH_REF) - amrex::Print() << "box length "; - #endif - amrex::Print() << "distance as reference for turbulent inlet perturbation: tpi_lref = " << tpi_lref << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_box_dims: " << tpi_boxDim[0] << " " + << tpi_boxDim[1] << " " + << tpi_boxDim[2] << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_direction: " << tpi_direction[0] << " " + << tpi_direction[1] << " " + << tpi_direction[2] << "\n\n"; + + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_layers: " << tpi_layers << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_offset: " << tpi_offset << "\n\n"; + + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_nondimensional: " << tpi_nonDim << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_T_infinity: " << tpi_Tinf << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_T_intensity: " << tpi_Ti << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_rho_0: " << tpi_rho << "\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_cp: " << tpi_cp << "\n\n"; + + amrex::PrintToFile("BoxPerturbationOutput") << "Reference length per box = " << tpi_lref << "\n\n"; + + amrex::PrintToFile("BoxPerturbationOutput") << "Turbulent perturbation BoxArray:\n" << pb_ba[lev] << "\n"; } // Perturbation update frequency check. @@ -87,21 +120,24 @@ struct TurbulentPerturbation { void calc_tpi_update (const int lev, const amrex::Real dt, amrex::MultiFab& mf_xvel, - amrex::MultiFab& mf_yvel, - amrex::MultiFab& mf_cons) + amrex::MultiFab& mf_yvel) { + // Setting random number generator for update interval + srand( (unsigned) time(NULL) ); + for (int boxIdx = 0; boxIdx < pb_ba[lev].size(); boxIdx++) { - if ( pb_freq[boxIdx] <= pb_local_etime[boxIdx] ) { + if ( pb_interval[boxIdx] <= pb_local_etime[boxIdx] ) { // Compute mean velocity magnitude within perturbation box - calc_tpi_meanMag(boxIdx, lev, mf_xvel, mf_yvel, mf_cons); + calc_tpi_meanMag_perBox(boxIdx, lev, mf_xvel, mf_yvel); + //calc_tpi_meanMag_firstCell(boxIdx, lev, mf_xvel, mf_yvel); - // Ma and Senocak (2015) Eq. 15 if (pb_mag[boxIdx] !=0.) { - pb_freq[boxIdx] = tpi_lref / pb_mag[boxIdx]; + amrex::Real interval = tpi_lref / pb_mag[boxIdx]; + pb_interval[boxIdx] = RandomReal(0.9*interval,1.1*interval); // 10% variation } // Trigger amplitude calculation per perturbation box - calc_tpi_amp(boxIdx); + calc_tpi_amp(boxIdx, pb_interval[boxIdx]); // Reset local elapsed time pb_local_etime[boxIdx] = 0.; @@ -112,17 +148,81 @@ struct TurbulentPerturbation { } // for } +//#define ECKERT_FORMULATION +#define BULK_RICHARDSON_FORMULATION + + // Perturbation amplitude calculation + void calc_tpi_amp (const int boxIdx, const amrex::Real interval) + { + amrex::Real Um = pb_mag[boxIdx]; + pb_amp[boxIdx] = 0.; // Safety step + + #ifdef ECKERT_FORMULATION + // Muñoz-Esparza et al. (2015) Eq. 9 + pb_amp[boxIdx] = Um * Um / (tpi_rho * tpi_cp * tpi_nonDim); + #endif + + #ifdef BULK_RICHARDSON_FORMULATION + amrex::Real beta = 1./tpi_Tinf; + + // Pseudo Random temperature the ignores scale when mechanically tripping turbulence + amrex::Real g = (tpi_nonDim * Um * Um) / (tpi_Ti * tpi_Hpb); + //amrex::Real g = CONST_GRAV; + + // Ma and Senocak (2023) Eq. 8, solving for delta phi + if (g != 0) pb_amp[boxIdx] = (tpi_nonDim * Um * Um) / (g * beta * tpi_Hpb); + //amrex::Print()<<"tpi_nonDim: "<& src_arr) // Array to apply perturbation + { + for (int boxIdx = 0; boxIdx < pb_ba[lev].size(); boxIdx++) { + amrex::Box pbx = convert(pb_ba[lev][boxIdx], m_ixtype); + amrex::Box ubx = pbx & vbx; + if (ubx.ok()) { + amrex::Real amp_copy = pb_amp[boxIdx]; + ParallelForRNG(ubx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + // Random number generation between 0 and 1 + amrex::Real rand_double = amrex::Random(engine); + + // Rescale between -1 and 1 and multiple with amplitude + src_arr(i,j,k,comp) += (rand_double*2.0 - 1.0) * amp_copy; + + // For box region debug only + #ifdef INDEX_PERTURB + src_arr(i,j,k,comp) = (amrex::Real) (boxIdx + 5.); + #endif + }); + } + } + } + // TODO: Test the difference between these two //#define USE_SLAB_AVERAGE #define USE_VOLUME_AVERAGE // Perturbation box mean velocity magnitude calculation // This is pulled into the structure to also utilize during runtime - void calc_tpi_meanMag (const int boxIdx, - const int lev, - amrex::MultiFab& mf_xvel, - amrex::MultiFab& mf_yvel, - amrex::MultiFab& mf_cons) + void calc_tpi_meanMag_perBox (const int boxIdx, + const int lev, + amrex::MultiFab& mf_xvel, + amrex::MultiFab& mf_yvel) { // Creating local copy of PB box array and magnitude @@ -152,7 +252,7 @@ struct TurbulentPerturbation { amrex::Gpu::deviceReduceSum(&tmp[0], xvel_arry(i,j,k), handler); }); tmp[0] /= (amrex::Real) npts; - #endif + #endif // USE_VOLUME_AVERAGE #ifdef USE_SLAB_AVERAGE amrex::Box ubxSlab_lo = makeSlab(ubx,2,ubx.smallEnd(2)); @@ -173,7 +273,7 @@ struct TurbulentPerturbation { amrex::Gpu::deviceReduceSum(&tmp[2], xvel_arry(i,j,k), handler); }); tmp[2] /= (amrex::Real) npts_hi; - #endif + #endif // USE_SLAB_AVERAGE } // if } // MFIter @@ -194,7 +294,7 @@ struct TurbulentPerturbation { amrex::Gpu::deviceReduceSum(&tmp[1], yvel_arry(i,j,k), handler); }); tmp[1] /= (amrex::Real) npts; - #endif + #endif // USE_VOLUME_AVERAGE #ifdef USE_SLAB_AVERAGE amrex::Box ubxSlab_lo = makeSlab(ubx,2,ubx.smallEnd(2)); @@ -215,112 +315,141 @@ struct TurbulentPerturbation { amrex::Gpu::deviceReduceSum(&tmp[3], yvel_arry(i,j,k), handler); }); tmp[3] /= (amrex::Real) npts_hi; - #endif + #endif // USE_SLAB_AVERAGE } // if } // MFIter // Computing the average magnitude within PB - for (amrex::MFIter mfi(mf_cons, TileNoZ()); mfi.isValid(); ++mfi) { - amrex::Box const& vbx = mfi.validbox(); - amrex::Box pbx = convert(m_pb_ba[boxIdx], vbx.ixType()); - amrex::Box ubx = pbx & vbx; - if (ubx.ok()) { - #ifdef USE_SLAB_AVERAGE - m_pb_mag[boxIdx] = 0.5*(sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]) + sqrt(tmp[2]*tmp[2] + tmp[3]*tmp[3])); - #endif - - #ifdef USE_VOLUME_AVERAGE - m_pb_mag[boxIdx] = sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]); - #endif - } // if - } // MFIter + #ifdef USE_SLAB_AVERAGE + m_pb_mag[boxIdx] = 0.5*(sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]) + sqrt(tmp[2]*tmp[2] + tmp[3]*tmp[3])); + #endif + #ifdef USE_VOLUME_AVERAGE + m_pb_mag[boxIdx] = sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]); + #endif } -//#define ECKERT_FORMULATION -#define BULK_RICHARDSON_FORMULATION - - // Perturbation amplitude calculation - void calc_tpi_amp (const int boxIdx) + // This emulates calc_tpi_meanMag_perBox() but is heavily simplified for + // Eckert number formulation + void calc_tpi_meanMag_firstCell (const int boxIdx, + const int lev, + amrex::MultiFab& mf_xvel, + amrex::MultiFab& mf_yvel) { - amrex::Real g = CONST_GRAV; - amrex::Real beta = 1./tpi_Tinfty; - amrex::Real Um = pb_mag[boxIdx]; - - // Reset the perturbation amplitude - pb_amp[boxIdx] = 0.; - - #ifdef BULK_RICHARDSON_FORMULATION - // Ma and Senocak (2023) Eq. 17 - pb_amp[boxIdx] = tpi_nonDim * Um * Um * Um / (g * beta * tpi_lref * tpi_Hpb); - #endif - - } + // Creating local copy of PB box array and magnitude + const amrex::BoxArray m_pb_ba = pb_ba[lev]; + amrex::Real* m_pb_mag = get_pb_mag(); -//#define INDEX_PERTURB + // Storage of averages per PB + // Index: 0=u (vol/slab_lo), 1=v (vol/slab_lo) + amrex::Gpu::DeviceVector tmp_d(2,0.); + amrex::Real* tmp = tmp_d.data(); - // Applying perturbation amplitude onto source term (Umphrey and Senocak 2016) - // Random perturbation is applied as a white noise on the temperature source term - // it becomes colored through the filtering of temperature transport equation from - // the eddy diffusivity. - void apply_tpi (const int lev, - const amrex::Box& vbx, // box union from upper level - const int comp, // Component to modify - const amrex::IndexType m_ixtype, // IntVect type of src_arr - amrex::Array4 const& src_arr)// Source Array to apply perturbation - { - for (int boxIdx = 0; boxIdx < pb_ba[lev].size(); boxIdx++) { - amrex::Box pbx = convert(pb_ba[lev][boxIdx], m_ixtype); + // Averaging u components + for (amrex::MFIter mfi(mf_xvel, TileNoZ()) ; mfi.isValid(); ++mfi) { + const amrex::Box &vbx = mfi.validbox(); + // This is hardcoded so that it's always on the 1st cell level (May need to generalize for EB) + amrex::Box pbx(amrex::IntVect(m_pb_ba[boxIdx].smallEnd(0),m_pb_ba[boxIdx].smallEnd(1),0), + amrex::IntVect(m_pb_ba[boxIdx].bigEnd(0) ,m_pb_ba[boxIdx].bigEnd(1) ,1), + vbx.ixType()); amrex::Box ubx = pbx & vbx; + + // Operation over box union if (ubx.ok()) { - amrex::Real amp_copy = pb_amp[boxIdx]; // This exposes a copy so the GPU can capture by value - ParallelForRNG(ubx, [=] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { - // Random number generation between 0 and 1 - amrex::Real rand_double = amrex::Random(engine); + const amrex::Array4 &xvel_arry = mf_xvel.array(mfi); + int npts = ubx.numPts(); + ParallelFor(amrex::Gpu::KernelInfo().setReduction(true), ubx, [=] + AMREX_GPU_DEVICE(int i, int j, int k, amrex::Gpu::Handler const& handler) noexcept { + amrex::Gpu::deviceReduceSum(&tmp[0], xvel_arry(i,j,k), handler); + }); + tmp[0] /= (amrex::Real) npts; + } // if + } // MFIter - // Rescale between -1 and 1 and multiple with amplitude - src_arr(i,j,k,comp) = (rand_double*2.0 - 1.0) * amp_copy; + // Averaging v components + for (amrex::MFIter mfi(mf_yvel, TileNoZ()) ; mfi.isValid(); ++mfi) { + const amrex::Box &vbx = mfi.validbox(); + // This is hardcoded so that it's always on the 1st cell level (May need to generalize for EB) + amrex::Box pbx(amrex::IntVect(m_pb_ba[boxIdx].smallEnd(0),m_pb_ba[boxIdx].smallEnd(1),0), + amrex::IntVect(m_pb_ba[boxIdx].bigEnd(0) ,m_pb_ba[boxIdx].bigEnd(1) ,1), + vbx.ixType()); + amrex::Box ubx = pbx & vbx; - // For box region debug only - #ifdef INDEX_PERTURB - src_arr(i,j,k,comp) = (amrex::Real) (boxIdx + 1.); - #endif + // Operation over box union + if (ubx.ok()) { + const amrex::Array4 &yvel_arry = mf_yvel.array(mfi); + int npts = ubx.numPts(); + ParallelFor(amrex::Gpu::KernelInfo().setReduction(true), ubx, [=] + AMREX_GPU_DEVICE(int i, int j, int k, amrex::Gpu::Handler const& handler) noexcept { + amrex::Gpu::deviceReduceSum(&tmp[1], yvel_arry(i,j,k), handler); }); - } - } - } + tmp[1] /= (amrex::Real) npts; + } // if + } // MFIter + // Computing the average magnitude within 1st z level slab + m_pb_mag[boxIdx] = sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]); + } // Quality of life function definitions amrex::Real* get_pb_mag() { return pb_mag.data(); } - void debug () + // Output debug message into a file + void debug (amrex::Real time) { + amrex::PrintToFile("BoxPerturbationOutput") << "#################### PB output at time = " + << time << " ####################\n"; + for (int i = 0; i < pb_mag.size(); i++) { - amrex::Print() << "[" << i<< "] pb_mag=" << pb_mag[i] - << " | pb_freq=" << pb_freq[i] - << " | pb_local_etime=" << pb_local_etime[i] <<"\n"; + amrex::PrintToFile("BoxPerturbationOutput") << "[" << i + << "] pb_Umag=" << pb_mag[i] + << " | pb_interval=" << pb_interval[i] + << " (" << pb_local_etime[i] + << ") | pb_amp=" << pb_amp[i] << "\n"; } + amrex::PrintToFile("BoxPerturbationOutput") << "\n"; } - // Public constant constants - amrex::Real tpi_Tinfty; // [K] - amrex::Real tpi_nonDim; + std::string pp_prefix {"erf"}; // Public data members - amrex::Vector pb_ba; // PB box array - amrex::Vector pb_mag; // BP mean magnitude [m/s] + amrex::Vector pb_ba; // PB box array + amrex::Vector pb_mag; // BP mean magnitude [m/s] private: - // Private constant constants - amrex::Real tpi_Hpb; // PB height [m] - amrex::Real tpi_Lpb; // PB length [m] - amrex::Real tpi_Wpb; // PB width [m] - amrex::Real tpi_lref; // PB reference length [m] + // Random number generation between range (used for interval calculation) + amrex::Real RandomReal (const amrex::Real min, const amrex::Real max) + { + amrex::Real r = (amrex::Real) rand() / (amrex::Real) RAND_MAX; + return min + r * (max - min); + } + + // Private data members + int tpi_layers; // Number of layers of perturbation boxes + int tpi_offset; // Cells to offset the start of the perturbation region + + amrex::Vector tpi_boxDim; // Dimensions of each perturbation box + amrex::Vector tpi_direction; // Direction of the peturbation + + amrex::Real tpi_nonDim; // Nondimensional Value + + // Richardson Formulation + amrex::Real tpi_Ti; // Temperature intensity value + amrex::Real tpi_Tinf; // Reference temperature [K] + + // Eckert Formulation + amrex::Real tpi_rho; // Reference density + amrex::Real tpi_cp; // Specific heat capaticty + + // Physical dimensions + amrex::Real tpi_Hpb; // PB height [m] + amrex::Real tpi_Lpb; // PB length [m] + amrex::Real tpi_Wpb; // PB width [m] + amrex::Real tpi_lref; // PB reference length [m] - // Storage Arrays - amrex::Vector pb_freq; // PB frequency [1/s] + // Perturbation data arrays + amrex::Vector pb_interval; // PB update time [s] amrex::Vector pb_local_etime; // PB local elapsed time [s] amrex::Vector pb_amp; // PB perturbation amplitude Ri:[K] Ec:[K/s] diff --git a/Source/ERF.H b/Source/ERF.H index 61134f455..ff0696c68 100644 --- a/Source/ERF.H +++ b/Source/ERF.H @@ -428,7 +428,6 @@ private: amrex::Vector& lev_old); // Initialize the Turbulent perturbation - void turbPert_constants (const int lev); void turbPert_update (const int lev, const amrex::Real dt); void turbPert_amplitude (const int lev); @@ -883,6 +882,7 @@ private: // Diagnostic output interval static int sum_interval; + static int pert_interval; static amrex::Real sum_per; // Native or NetCDF diff --git a/Source/ERF.cpp b/Source/ERF.cpp index 2c00edfc1..741c68296 100644 --- a/Source/ERF.cpp +++ b/Source/ERF.cpp @@ -46,6 +46,8 @@ int ERF::mg_verbose = 0; int ERF::sum_interval = -1; Real ERF::sum_per = -1.0; +int ERF::pert_interval = -1; + // Native AMReX vs NetCDF std::string ERF::plotfile_type = "amrex"; @@ -483,6 +485,13 @@ ERF::post_timestep (int nstep, Real time, Real dt_lev0) sum_integrated_quantities(time); } + if (solverChoice.pert_type == PerturbationType::perturbSource || + solverChoice.pert_type == PerturbationType::perturbDirect) { + if (is_it_time_for_action(nstep, time, dt_lev0, pert_interval, -1.)) { + turbPert.debug(time); + } + } + if (profile_int > 0 && (nstep+1) % profile_int == 0) { if (cc_profiles) { // all variables cell-centered @@ -809,6 +818,13 @@ ERF::InitData () sum_integrated_quantities(t_new[0]); } + if (solverChoice.pert_type == PerturbationType::perturbSource || + solverChoice.pert_type == PerturbationType::perturbDirect) { + if (is_it_time_for_action(istep[0], t_new[0], dt[0], pert_interval, -1.)) { + turbPert.debug(t_new[0]); + } + } + // We only write the file at level 0 for now if (output_bndry_planes) { @@ -1221,14 +1237,13 @@ ERF::init_only (int lev, Real time) } // Initialize turbulent perturbation - if (solverChoice.pert_type == PerturbationType::BPM) { + if (solverChoice.pert_type == PerturbationType::perturbSource || + solverChoice.pert_type == PerturbationType::perturbDirect) { if (lev == 0) { - turbPert_constants(lev); turbPert_update(lev, 0.); turbPert_amplitude(lev); } } - } // read in some parameters from inputs file @@ -1274,6 +1289,8 @@ ERF::ReadParameters () pp.query("sum_interval", sum_interval); pp.query("sum_period" , sum_per); + pp.query("pert_interval", pert_interval); + // Time step controls pp.query("cfl", cfl); pp.query("init_shrink", init_shrink); diff --git a/Source/ERF_make_new_arrays.cpp b/Source/ERF_make_new_arrays.cpp index cde26fb8e..35b15c9ec 100644 --- a/Source/ERF_make_new_arrays.cpp +++ b/Source/ERF_make_new_arrays.cpp @@ -308,7 +308,9 @@ ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm, // Turbulent perturbation region initialization //********************************************************* // TODO: Test perturbation on multiple levels - if (solverChoice.pert_type == PerturbationType::BPM) { + if (solverChoice.pert_type == PerturbationType::perturbSource || + solverChoice.pert_type == PerturbationType::perturbDirect) + { if (lev == 0) { turbPert.init_tpi(lev, geom[lev].Domain().bigEnd(), geom[lev].CellSizeArray()); } diff --git a/Source/Initialization/ERF_init_TurbPert.cpp b/Source/Initialization/ERF_init_TurbPert.cpp index 28aacd70e..cea297e9c 100644 --- a/Source/Initialization/ERF_init_TurbPert.cpp +++ b/Source/Initialization/ERF_init_TurbPert.cpp @@ -4,8 +4,6 @@ //DUSTIN MA: May 28th, 2024 -#define DEBUG_PERTBOX_MSG - #include #include #include @@ -13,12 +11,6 @@ using namespace amrex; -void -ERF::turbPert_constants(const int lev) -{ - prob->init_turbPert_const(turbPert); -} - void ERF::turbPert_update (const int lev, const Real local_dt) { @@ -26,22 +18,15 @@ ERF::turbPert_update (const int lev, const Real local_dt) auto& lev_new = vars_new[lev]; // Accessing local data - MultiFab cons_data(lev_new[Vars::cons].boxArray(), lev_new[Vars::cons].DistributionMap(), - lev_new[Vars::cons].nComp() , lev_new[Vars::cons].nGrow()); MultiFab xvel_data(lev_new[Vars::xvel].boxArray(), lev_new[Vars::xvel].DistributionMap(), 1, lev_new[Vars::xvel].nGrowVect()); MultiFab yvel_data(lev_new[Vars::yvel].boxArray(), lev_new[Vars::yvel].DistributionMap(), 1, lev_new[Vars::yvel].nGrowVect()); - MultiFab::Copy (cons_data, lev_new[Vars::cons], 0, 0, 1, lev_new[Vars::xvel].nGrowVect()); MultiFab::Copy (xvel_data, lev_new[Vars::xvel], 0, 0, 1, lev_new[Vars::xvel].nGrowVect()); MultiFab::Copy (yvel_data, lev_new[Vars::yvel], 0, 0, 1, lev_new[Vars::yvel].nGrowVect()); // Computing perturbation update time - turbPert.calc_tpi_update(lev, local_dt, xvel_data, yvel_data, cons_data); - - #ifdef DEBUG_PERTBOX_MSG - turbPert.debug(); - #endif + turbPert.calc_tpi_update(lev, local_dt, xvel_data, yvel_data); - Print() << "Turbulent perturbation update time and amplitude initialized\n"; + Print() << "Successfully initialized turbulent perturbation update time and amplitude\n"; } // Calculate the perturbation region amplitude. @@ -69,15 +54,6 @@ ERF::turbPert_amplitude (int lev) yvel_pert.setVal(0.); zvel_pert.setVal(0.); - int fix_random_seed = 0; - ParmParse pp("erf"); pp.query("fix_random_seed", fix_random_seed); - // Note that the value of 1024UL is not significant -- the point here is just to set the - // same seed for all MPI processes for the purpose of regression testing - if (fix_random_seed) { - Print() << "Fixing the random seed" << std::endl; - InitRandom(1024UL); - } - #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif @@ -104,13 +80,15 @@ ERF::turbPert_amplitude (int lev) Array4 r_hse_arr = r_hse.array(mfi); Array4 p_hse_arr = p_hse.array(mfi); - turbPert.apply_tpi(lev, bx, RhoTheta_comp, m_ixtype, cons_pert_arr); // Using boxArray + turbPert.apply_tpi(lev, bx, RhoTheta_comp, m_ixtype, cons_pert_arr); + prob->init_custom_pert(bx, xbx, ybx, zbx, cons_arr, cons_pert_arr, xvel_pert_arr, yvel_pert_arr, zvel_pert_arr, r_hse_arr, p_hse_arr, z_nd_arr, z_cc_arr, geom[lev].data(), mf_m, mf_u, mf_v, solverChoice); } // mfi + // This initialization adds the initial perturbation direction on the RhoTheta field MultiFab::Add(lev_new[Vars::cons], cons_pert, RhoTheta_comp, RhoTheta_comp, 1, cons_pert.nGrow()); } diff --git a/Source/SourceTerms/ERF_make_sources.cpp b/Source/SourceTerms/ERF_make_sources.cpp index 5b54a86bf..817fa2bdc 100644 --- a/Source/SourceTerms/ERF_make_sources.cpp +++ b/Source/SourceTerms/ERF_make_sources.cpp @@ -334,11 +334,9 @@ void make_sources (int level, // ************************************************************************************* // Add perturbation // ************************************************************************************* - if (solverChoice.pert_type == PerturbationType::BPM) { - auto m_ixtype = S_data[IntVars::cons].boxArray().ixType(); - - // Apply stored values onto cell_src - turbPert.apply_tpi(level, bx, RhoTheta_comp, m_ixtype, cell_src); + if (solverChoice.pert_type == PerturbationType::perturbSource) { + auto m_ixtype = S_data[IntVars::cons].boxArray().ixType(); // Conserved term + turbPert.apply_tpi(level, bx, RhoTheta_comp, m_ixtype, cell_src); // Applied as source term } } // mfi } // OMP diff --git a/Source/TimeIntegration/ERF_Advance.cpp b/Source/TimeIntegration/ERF_Advance.cpp index 02448f2bf..b74e4632d 100644 --- a/Source/TimeIntegration/ERF_Advance.cpp +++ b/Source/TimeIntegration/ERF_Advance.cpp @@ -36,14 +36,28 @@ ERF::Advance (int lev, Real time, Real dt_lev, int iteration, int /*ncycle*/) MultiFab& W_new = vars_new[lev][Vars::zvel]; // TODO: Can test on multiple levels later - // Only apply to level 0 - // DUSTIN MA - if (solverChoice.pert_type == PerturbationType::BPM) { - if (lev == 0) { - turbPert.calc_tpi_update(lev, dt_lev, U_old, V_old, S_old); - turbPert.debug(); + // Update the inflow perturbation update time and amplitude + if (lev == 0) { + if (solverChoice.pert_type == PerturbationType::perturbSource || + solverChoice.pert_type == PerturbationType::perturbDirect) + { + turbPert.calc_tpi_update(lev, dt_lev, U_old, V_old); + } + + // If perturbDirect is selected, directly add the computed perturbation + // on the conserved field + // XXX Currently gives "Erroneous arithmetic operation" error + if (solverChoice.pert_type == PerturbationType::perturbDirect) + { + auto m_ixtype = S_old.boxArray().ixType(); // Conserved term + for (MFIter mfi(S_old,TileNoZ()); mfi.isValid(); ++mfi) { + Box bx = mfi.tilebox(); + const Array4 & cell_data = S_old.array(mfi); + turbPert.apply_tpi(lev, bx, RhoTheta_comp, m_ixtype, cell_data); + } } } + // configure ABLMost params if used MostWall boundary condition if (phys_bc_type[Orientation(Direction::z,Orientation::low)] == ERF_BC::MOST) { if (m_most) { diff --git a/Source/prob_common.H b/Source/prob_common.H index 0107dcb18..dcdd4e0f4 100644 --- a/Source/prob_common.H +++ b/Source/prob_common.H @@ -445,16 +445,6 @@ public: }); } - /** - * Function to set constant values for turbulent perturbation calculation - */ - void - init_turbPert_const(TurbulentPerturbation& turbPert) - { - turbPert.tpi_Tinfty = base_parms.T_0; - turbPert.tpi_nonDim = 0.042; - } - protected: // Struct to store problem parameters ProbParmDefaults base_parms;