-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user-defined ("custom") temperature sources (#1407)
* Implement stub for update_rhotheta_sources * Initialize sources and add calls to update function * Copy to device in update function * Pass source pointer to slow RHS update functions * Add custom source term within the RHS update * Make a copy of the ABL problem * Override Problem::update_rhotheta_sources() * Fix sign error * Add test problem inputs * Add missing file * Add option to have source terms correspond to prim vars * Document custom forcing
- Loading branch information
Showing
19 changed files
with
528 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
set(erf_exe_name erf_abl_with_temperature_source) | ||
|
||
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}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = FALSE | ||
|
||
TEST = TRUE | ||
USE_ASSERTION = TRUE | ||
|
||
#USE_POISSON_SOLVE = TRUE | ||
|
||
# GNU Make | ||
Bpack := ./Make.package | ||
Blocs := . | ||
ERF_HOME := ../.. | ||
ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DevTests/TemperatureSource | ||
include $(ERF_HOME)/Exec/Make.ERF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CEXE_headers += prob.H | ||
CEXE_sources += prob.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is a copy of the ABL problem, but with update_rhotheta_sources defined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1000.0 300.0 0.0 | ||
0.0 300.0 0.0 10.0 0.0 | ||
1000.0 300.0 0.0 10.0 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# ------------------ INPUTS TO MAIN PROGRAM ------------------- | ||
stop_time = 999.9 | ||
max_step = 20 | ||
|
||
amrex.fpe_trap_invalid = 1 | ||
|
||
fabarray.mfiter_tile_size = 1024 1024 1024 | ||
|
||
# PROBLEM SIZE & GEOMETRY | ||
geometry.prob_extent = 40. 40. 640. | ||
amr.n_cell = 4 4 64 | ||
|
||
geometry.is_periodic = 1 1 0 | ||
|
||
zlo.type = "SlipWall" | ||
zhi.type = "SlipWall" | ||
|
||
# INITIALIZATION | ||
erf.init_type = input_sounding | ||
erf.init_sounding_ideal = true | ||
|
||
# TIME STEP CONTROL | ||
erf.fixed_dt = 0.1 | ||
|
||
# DIAGNOSTICS & VERBOSITY | ||
amr.v = 1 # verbosity in Amr.cpp | ||
erf.v = 1 # verbosity in ERF.cpp -- needs to be 1 to write out data_log files | ||
erf.sum_interval = 1 # timesteps between computing mass | ||
|
||
# REFINEMENT / REGRIDDING | ||
amr.max_level = 0 # maximum level number allowed | ||
|
||
# CHECKPOINT FILES | ||
erf.check_file = chk # root name of checkpoint file | ||
erf.check_int = -1 # number of timesteps between checkpoints | ||
|
||
# PLOTFILES | ||
erf.plot_file_1 = plt # prefix of plotfile name | ||
erf.plot_int_1 = 5 # number of timesteps between plotfiles (DEBUG) | ||
erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta | ||
|
||
# SOLVER CHOICES | ||
erf.use_gravity = true | ||
erf.use_coriolis = false | ||
|
||
erf.molec_diff_type = "None" | ||
erf.les_type = "None" | ||
|
||
erf.add_custom_rhotheta_forcing = true | ||
erf.custom_forcing_uses_primitive_vars = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#ifndef _PROB_H_ | ||
#define _PROB_H_ | ||
|
||
#include <string> | ||
|
||
#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 QKE_0 = 0.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 | ||
|
||
// 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<amrex::Real > const& state, | ||
amrex::Array4<amrex::Real > const& x_vel, | ||
amrex::Array4<amrex::Real > const& y_vel, | ||
amrex::Array4<amrex::Real > const& z_vel, | ||
amrex::Array4<amrex::Real > const& r_hse, | ||
amrex::Array4<amrex::Real > const& p_hse, | ||
amrex::Array4<amrex::Real const> const& z_nd, | ||
amrex::Array4<amrex::Real const> const& z_cc, | ||
amrex::GeometryData const& geomdata, | ||
amrex::Array4<amrex::Real const> const& mf_m, | ||
amrex::Array4<amrex::Real const> const& mf_u, | ||
amrex::Array4<amrex::Real const> const& mf_v, | ||
const SolverChoice& sc) override; | ||
|
||
void update_rhotheta_sources ( | ||
const amrex::Real& time, | ||
amrex::Vector<amrex::Real>& src, | ||
amrex::Gpu::DeviceVector<amrex::Real>& d_src, | ||
const amrex::Geometry& geom, | ||
std::unique_ptr<amrex::MultiFab>& z_phys_cc) override; | ||
|
||
protected: | ||
std::string name() override { return "ABL"; } | ||
|
||
private: | ||
ProbParm parms; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.