From be4a3194d628e586a179df6bd0f0065335cf1e67 Mon Sep 17 00:00:00 2001 From: Mukul Dave Date: Fri, 18 Oct 2024 11:39:47 -0700 Subject: [PATCH] clang-format --- amr-wind/CFDSim.H | 2 +- amr-wind/incflo.H | 4 ++-- amr-wind/incflo.cpp | 4 +++- amr-wind/utilities/index_operations.H | 14 +++++++------ amr-wind/wind_energy/ABLBoundaryPlane.H | 10 +++++----- amr-wind/wind_energy/ABLBoundaryPlane.cpp | 24 ++++++++++++++--------- amr-wind/wind_energy/ABLFieldInit.cpp | 18 ++++++++++------- amr-wind/wind_energy/ABLReadERFFcn.H | 14 ++++++------- 8 files changed, 52 insertions(+), 38 deletions(-) diff --git a/amr-wind/CFDSim.H b/amr-wind/CFDSim.H index decaac0fc1..7427520314 100644 --- a/amr-wind/CFDSim.H +++ b/amr-wind/CFDSim.H @@ -161,7 +161,7 @@ private: #ifdef ERF_AW_MULTIBLOCK MultiBlockContainer* m_mbc = nullptr; - ReadERFFunction m_read_erf {nullptr}; + ReadERFFunction m_read_erf{nullptr}; #endif }; diff --git a/amr-wind/incflo.H b/amr-wind/incflo.H index efa319606f..4a94d0d5d6 100644 --- a/amr-wind/incflo.H +++ b/amr-wind/incflo.H @@ -160,8 +160,8 @@ public: void ReadCheckpointFile(); #ifdef ERF_AW_MULTIBLOCK - void SetMultiBlockPointer(MultiBlockContainer *mbc) { m_sim.set_mbc(mbc); } - void set_read_erf(ReadERFFunction fcn) {m_sim.set_read_erf(fcn);} + void SetMultiBlockPointer(MultiBlockContainer* mbc) { m_sim.set_mbc(mbc); } + void set_read_erf(ReadERFFunction fcn) { m_sim.set_read_erf(fcn); } #endif private: diff --git a/amr-wind/incflo.cpp b/amr-wind/incflo.cpp index 383e92c351..88a33bed80 100644 --- a/amr-wind/incflo.cpp +++ b/amr-wind/incflo.cpp @@ -24,7 +24,9 @@ incflo::incflo() // But the arrays for them have been resized. #ifdef ERF_AW_MULTIBLOCK - amrex::Print() << std::endl << "AMR-Wind is initializing.. "<< std::endl << std::endl; + amrex::Print() << std::endl + << "AMR-Wind is initializing.. " << std::endl + << std::endl; #endif // Check if dry run is requested and set up if so diff --git a/amr-wind/utilities/index_operations.H b/amr-wind/utilities/index_operations.H index b8d0bab7fe..79067628c3 100644 --- a/amr-wind/utilities/index_operations.H +++ b/amr-wind/utilities/index_operations.H @@ -8,9 +8,10 @@ namespace amr_wind::utils { -//! Return closest index (from lower) of value in vector, lbound verion for ERF coupling -AMREX_FORCE_INLINE int -closest_index_ubound(const amrex::Vector& vec, const amrex::Real value) +//! Return closest index (from lower) of value in vector +//! lbound verion is required for ERF coupling +AMREX_FORCE_INLINE int closest_index_ubound( + const amrex::Vector& vec, const amrex::Real value) { auto const it = std::upper_bound(vec.begin(), vec.end(), value); AMREX_ALWAYS_ASSERT(it != vec.end()); @@ -19,11 +20,12 @@ closest_index_ubound(const amrex::Vector& vec, const amrex::Real va return std::max(idx - 1, 0); } -AMREX_FORCE_INLINE int -closest_index_lbound(const amrex::Vector& vec, const amrex::Real value) +AMREX_FORCE_INLINE int closest_index_lbound( + const amrex::Vector& vec, const amrex::Real value) { amrex::Real one_minus_eps = 1.0 - 1.e-8; - auto const it = std::lower_bound(vec.begin(), vec.end(), one_minus_eps*value); + auto const it = + std::lower_bound(vec.begin(), vec.end(), one_minus_eps * value); AMREX_ALWAYS_ASSERT(it != vec.end()); const int idx = static_cast(std::distance(vec.begin(), it)); diff --git a/amr-wind/wind_energy/ABLBoundaryPlane.H b/amr-wind/wind_energy/ABLBoundaryPlane.H index 2eaaf122ce..546ba4c7e0 100644 --- a/amr-wind/wind_energy/ABLBoundaryPlane.H +++ b/amr-wind/wind_energy/ABLBoundaryPlane.H @@ -164,7 +164,7 @@ public: io_mode mode() const { return m_io_mode; } #ifdef ERF_AW_MULTIBLOCK - MultiBlockContainer* mbc() {return *m_mbc;} + MultiBlockContainer* mbc() { return *m_mbc; } #endif private: @@ -174,11 +174,11 @@ private: #ifdef ERF_AW_MULTIBLOCK // pointer to pointer : when ABL boundary plane gets intiialized, amr-wind - // CFDsim does not yet have the up to date pointer to the mbc or the read_erf function - // be careful: if this is used before amr-wind gets the mbc pointer set - // bad things will happen + // CFDsim does not yet have the up to date pointer to the mbc or the + // read_erf function, be careful: if this is used before amr-wind gets the + // mbc pointer set bad things will happen MultiBlockContainer** m_mbc; - ReadERFFunction* m_read_erf {nullptr}; + ReadERFFunction* m_read_erf{nullptr}; #endif #ifdef AMR_WIND_USE_NETCDF diff --git a/amr-wind/wind_energy/ABLBoundaryPlane.cpp b/amr-wind/wind_energy/ABLBoundaryPlane.cpp index 8861d45301..694546f311 100644 --- a/amr-wind/wind_energy/ABLBoundaryPlane.cpp +++ b/amr-wind/wind_energy/ABLBoundaryPlane.cpp @@ -168,7 +168,8 @@ void InletData::read_data_native( auto ori = oit(); amrex::Real one_plus_eps = 1.0 + 1.e-8; - AMREX_ALWAYS_ASSERT(((m_tn <= one_plus_eps*time) && (time <= one_plus_eps*m_tnp1))); + AMREX_ALWAYS_ASSERT( + ((m_tn <= one_plus_eps * time) && (time <= one_plus_eps * m_tnp1))); AMREX_ALWAYS_ASSERT(fld->num_comp() == bndry_n[ori].nComp()); AMREX_ASSERT(bndry_n[ori].boxArray() == bndry_np1[ori].boxArray()); @@ -254,9 +255,12 @@ bool InletData::is_populated(amrex::Orientation ori) const } ABLBoundaryPlane::ABLBoundaryPlane(CFDSim& sim) - : m_time(sim.time()), m_repo(sim.repo()), m_mesh(sim.mesh()) + : m_time(sim.time()) + , m_repo(sim.repo()) + , m_mesh(sim.mesh()) #ifdef ERF_AW_MULTIBLOCK - , m_mbc(sim.mbc()), m_read_erf(sim.get_read_erf()) + , m_mbc(sim.mbc()) + , m_read_erf(sim.get_read_erf()) #endif { amrex::ParmParse pp("ABL"); @@ -294,7 +298,8 @@ ABLBoundaryPlane::ABLBoundaryPlane(CFDSim& sim) } #endif - if (!(m_out_fmt == "native" || m_out_fmt == "netcdf" || m_out_fmt == "erf-multiblock")) { + if (!((m_out_fmt == "native") || (m_out_fmt == "netcdf") || + (m_out_fmt == "erf-multiblock"))) { amrex::Print() << "Warning: boundary output format not recognized, " "changing to native format" << std::endl; @@ -350,7 +355,8 @@ void ABLBoundaryPlane::initialize_data() } } if ((m_io_mode == io_mode::output) && (m_out_fmt == "erf-multiblock")) { - amrex::Abort("ABLBoundaryPlane: can't output data in erf-multiblock mode"); + amrex::Abort( + "ABLBoundaryPlane: can't output data in erf-multiblock mode"); } } @@ -766,7 +772,8 @@ void ABLBoundaryPlane::read_header() } } else if (m_out_fmt == "erf-multiblock") { - m_in_times.push_back(-1.0e13); // create space for storing time at erf old and new timestep + m_in_times.push_back(-1.0e13); // create space for storing time at erf + // old and new timestep m_in_times.push_back(-1.0e13); int nc = 0; @@ -804,10 +811,9 @@ void ABLBoundaryPlane::read_file() #ifdef ERF_AW_MULTIBLOCK if (m_out_fmt == "erf-multiblock") { - //m_read_erf = sim.get_read_erf(); + // m_read_erf = sim.get_read_erf(); ReadERFFunction read_erf = *m_read_erf; - if (read_erf) - { + if (read_erf) { read_erf(m_time, m_in_times, m_in_data, m_fields, mbc()); } else { amrex::Abort("read_erf function is undefined."); diff --git a/amr-wind/wind_energy/ABLFieldInit.cpp b/amr-wind/wind_energy/ABLFieldInit.cpp index 725e0fe286..0846eecd2f 100644 --- a/amr-wind/wind_energy/ABLFieldInit.cpp +++ b/amr-wind/wind_energy/ABLFieldInit.cpp @@ -27,12 +27,12 @@ void ABLFieldInit::initialize_from_inputfile() // ABL-with-bubble pp_abl.query("use_bubble", m_use_bubble); if (m_use_bubble) { - amrex::Print() << "Initializing with bubble" << std::endl; - pp_abl.getarr("bubble_loc", m_bubble_loc); - pp_abl.query("bubble_radius", m_bubble_radius); - pp_abl.query("bubble_temp_ratio", m_bubble_temp_ratio); + amrex::Print() << "Initializing with bubble" << std::endl; + pp_abl.getarr("bubble_loc", m_bubble_loc); + pp_abl.query("bubble_radius", m_bubble_radius); + pp_abl.query("bubble_temp_ratio", m_bubble_temp_ratio); } else { - amrex::Print() << "Not initializing with bubble" << std::endl; + amrex::Print() << "Not initializing with bubble" << std::endl; } // Temperature variation as a function of height @@ -259,8 +259,12 @@ void ABLFieldInit::operator()( amrex::Real ratio = 1.0; if (m_use_bubble) { - amrex::Real radius = std::sqrt((x-bcx)*(x-bcx) + (y-bcy)*(y-bcy) + (z-bcz)*(z-bcz)); - ratio = 1.0 + (m_bubble_temp_ratio - 1.0) * exp(-0.5 * radius* radius / (m_bubble_radius * m_bubble_radius)); + amrex::Real radius = std::sqrt( + (x - bcx) * (x - bcx) + (y - bcy) * (y - bcy) + + (z - bcz) * (z - bcz)); + ratio = 1.0 + (m_bubble_temp_ratio - 1.0) * + exp(-0.5 * radius * radius / + (m_bubble_radius * m_bubble_radius)); } temperature(i, j, k, 0) *= ratio; diff --git a/amr-wind/wind_energy/ABLReadERFFcn.H b/amr-wind/wind_energy/ABLReadERFFcn.H index e910e4be45..9274246dc8 100644 --- a/amr-wind/wind_energy/ABLReadERFFcn.H +++ b/amr-wind/wind_energy/ABLReadERFFcn.H @@ -4,14 +4,14 @@ class MultiBlockContainer; namespace amr_wind { - class InletData; +class InletData; } -using ReadERFFunction = std::function &, - amr_wind::InletData&, - const amrex::Vector&, - MultiBlockContainer* )>; +using ReadERFFunction = std::function&, + amr_wind::InletData&, + const amrex::Vector&, + MultiBlockContainer*)>; #endif /* ABLREADERFFCN_H */