Skip to content

Commit

Permalink
Turbulent inflow generation technique (erf-model#1657)
Browse files Browse the repository at this point in the history
* Box perturbation setup start

* perturbation box implementation start

* added geometry into CalcTurbPert()

* Using index of box to created boxes

* Index Perturbation box initialization working

* added Perturbation box initialization in init_stuff(), next create class for PerturbationRegion

* created 3 functions init_PerturbationRegion(), calc_TurbPert_amplitude(), and calc_TurbPert_updateTime. Now PB boxes initialize at t=0s

* cleaned up some portions of the code. Now start implemented t>0s PB

* start of struct TurbPert implementation

* created TurbPert structure and compiles/runs fines. Now t>=0 uses same function to create turbulent perturbations.

* name change to TurbulentPerturbation structure

* made small modifications to perturbation funcion call. Start playing with momentum perturbation.

* Averaging paraview out put through impermeability enforcement. Added in random number generator in Perturbation amplitude.

* Cleaned up some code, and added comments for tomorrow start. Tomorrow: Implement update-time and amplitude

* distribution mapping debug w/ Aaron

* debugging mf global access

* mf now is seen outside of struct

* moving on PB implementation to using vectors for per box unique value.

* Replaced all perturbation boxes from boxArray and vector to MultiFab. Current version works with np=1, but not np>1.

* fixed parallelization problem. Succesfully accessed velocity at initialization. Moving on to calculate update time/think about how to calculate perturbation amplitude on the fly.

* Created elapsed time array for mf in tpi. Start writing perturbation amplitude calculations.

* mirgrated over to ssh github check

* PB u_mean calc per bx using box union (volume averaged). PB items uses vectors. PB frequency triggeres amplitude calculation. PB apply_tpi applied random number perturbation.

* Added in Ma&senocak2023 PB amp formulation. Made PB velocity average thread safe. Created some initial constant values for PB.

* debugging ubx output (start)

* Bug fixed: object.makeSlab() will modify the object, while makeSlab(object,...) will make a copy then edit copy.

* Generalized slab average formulation. Can begin some kind of small test to perturb flow. General setup complete

* (June 18) TurbulentPerturbation struct now own all computation for PB. Slab average implemented. Start runtime tests.

* deleted trailing white space to pass github check

* Modified some names, made sure CMake compile.

* Changes in attemping to pass workout test

* TurbPertStruct.H doesn't like ParallelFor within it?

* TurbPertStruct.H ParallelFor loops now using pass-by-value so GPU does not access illegal memory

* Update TurbPertStruct.H

cuda pass-by- workout test

* quick fix for CUDA error

* attemping to fix oneAPI SYCL workflow error

* Inflow perturbation 1st PR. Cleared all github workflow error

* flipped order of solverChoice.pert_type to avoid level error. ready for 1st PR

---------

Co-authored-by: Ting-Hsuan (Dustin) Ma <[email protected]>
Co-authored-by: Aaron M. Lattanzi <[email protected]>
  • Loading branch information
3 people authored Jun 24, 2024
1 parent 5ce79bb commit a0ea769
Show file tree
Hide file tree
Showing 17 changed files with 547 additions and 9 deletions.
1 change: 1 addition & 0 deletions CMake/BuildERFExe.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function(build_erf_lib erf_lib_name)
${SRC_DIR}/Initialization/ERF_init_from_metgrid.cpp
${SRC_DIR}/Initialization/ERF_init_uniform.cpp
${SRC_DIR}/Initialization/ERF_init1d.cpp
${SRC_DIR}/Initialization/ERF_init_TurbPert.cpp
${SRC_DIR}/Initialization/ERF_input_sponge.cpp
${SRC_DIR}/IO/Checkpoint.cpp
${SRC_DIR}/IO/ERF_ReadBndryPlanes.cpp
Expand Down
2 changes: 1 addition & 1 deletion Exec/ABL/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ USE_HIP = FALSE
USE_SYCL = FALSE

# Debugging
DEBUG = FALSE
DEBUG = TRUE

TEST = TRUE
USE_ASSERTION = TRUE
Expand Down
27 changes: 26 additions & 1 deletion Source/DataStructs/DataStruct.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <DiffStruct.H>
#include <SpongeStruct.H>
#include <TurbStruct.H>
#include <TurbPertStruct.H>

enum struct ABLDriverType {
None, PressureGradient, GeostrophicWind
Expand Down Expand Up @@ -60,6 +61,11 @@ enum Sponge {
ubar_sponge, vbar_sponge, nvars_sponge
};

enum struct PerturbationType {
BPM, CPM, None
// Box perturbation method, Cell perturbation method, None
};

/**
* Container holding many of the algorithmic options and parameters
*/
Expand Down Expand Up @@ -224,12 +230,28 @@ struct SolverChoice {
abl_driver_type = ABLDriverType::PressureGradient;
} else if (!abl_driver_type_string.compare("GeostrophicWind")) {
abl_driver_type = ABLDriverType::GeostrophicWind;
} else if (!abl_driver_type_string.compare("None")){
} else if (!abl_driver_type_string.compare("None")) {
abl_driver_type = ABLDriverType::None; // No ABL driver for simulating classical fluid dynamics problems
} else {
amrex::Error("Don't know this abl_driver_type");
}

// 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";
} 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::Vector<amrex::Real> abl_pressure_grad_in = {0.0, 0.0, 0.0};
pp.queryarr("abl_pressure_grad",abl_pressure_grad_in);
for(int i = 0; i < AMREX_SPACEDIM; ++i) abl_pressure_grad[i] = abl_pressure_grad_in[i];
Expand Down Expand Up @@ -487,6 +509,9 @@ struct SolverChoice {
// User wishes to output time averaged velocity fields
bool time_avg_vel = false;

// Type of perturbation
PerturbationType pert_type;

// Numerical diffusion
bool use_NumDiff{false};
amrex::Real NumDiffCoeff{0.};
Expand Down
1 change: 1 addition & 0 deletions Source/DataStructs/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ CEXE_headers += DiffStruct.H
CEXE_headers += AdvStruct.H
CEXE_headers += SpongeStruct.H
CEXE_headers += TurbStruct.H
CEXE_headers += TurbPertStruct.H
Loading

0 comments on commit a0ea769

Please sign in to comment.