Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ BOUT.log.*
*.pdf
*~
.BOUT.pid*
.vscode/
23 changes: 12 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

# Update submodules
# Adapted from https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} -c submodule.recurse=false submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
# find_package(Git QUIET)
# if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# message(STATUS "Submodule update")
# execute_process(COMMAND ${GIT_EXECUTABLE} -c submodule.recurse=false submodule update --init --recursive
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
# RESULT_VARIABLE GIT_SUBMOD_RESULT)
# if(NOT GIT_SUBMOD_RESULT EQUAL "0")
# message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
# endif()
# endif()

# Get the Git revision
include(GetGitRevisionDescription)
Expand All @@ -33,7 +33,8 @@ endif()
message(STATUS "Git revision: ${HERMES_REVISION}")

# BOUT++ is a dependency
add_subdirectory(external/BOUT-dev)
# add_subdirectory(external/BOUT-dev)
find_package(bout++ REQUIRED)

set(HERMES_SOURCES
src/hermes-2.cxx
Expand Down
Binary file added hermes-2
Binary file not shown.
22 changes: 19 additions & 3 deletions include/hermes-2.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ protected:

int precon(BoutReal t, BoutReal gamma, BoutReal delta);
private:
// grid region boundaries
int jyseps1_1;
int jyseps1_2;
int jyseps2_1;
int jyseps2_2;

// Equilibrium current
Field2D Jpar0;

BoutReal nelim_floor; // Global density floor
BoutReal nesheath_floor; // Density floor used in sheath boundary conditions
BoutReal kappa_epar_floor; // Electron heat conductivity floor

// Evolving variables
Field3D Ne; // Electron density
Expand Down Expand Up @@ -90,6 +98,10 @@ private:
// Impurity radiation
BoutReal fimp; // Impurity fraction (of Ne)
bool impurity_adas; // True if using ImpuritySpecies, false if using
bool impurity_split_y; // Split the fixed fraction impurities by region
BoutReal fimp_id; // fimp in the inner divertor (0 -> jyseps1_1)
BoutReal fimp_od; // fimp in the outer divertor (jyseps2_2 -> -1)
BoutReal fimp_us; // fimp in the upstream (between jyseps1_1 and jyseps2_2)
ImpuritySpecies *impurity; // Atomicpp impurity

BoutReal carbon_fraction;
Expand Down Expand Up @@ -142,6 +154,7 @@ private:
bool sheath_closure; // Sheath closure sink on vorticity (if sinks = true)
bool drift_wave; // Drift-wave closure (if sinks=true)

bool slab_radial_buffers; // an alternatice radial buffer region for use in slab geometry
bool radial_buffers; // Radial buffer regions
int radial_inner_width; // Number of points in the inner radial buffer
int radial_outer_width; // Number of points in the outer radial buffer
Expand Down Expand Up @@ -181,14 +194,16 @@ private:
BoutReal numdiff, hyper, hyperpar; ///< Numerical dissipation
int low_pass_z; // Fourier filter in Z
BoutReal z_hyper_viscos, x_hyper_viscos, y_hyper_viscos; // 4th-order derivatives
bool low_n_diffuse; // Diffusion in parallel direction at low density
bool low_n_diffuse_perp; // Diffusion in perpendicular direction at low density
BoutReal low_n_diffuse; // Diffusion in parallel direction at low density
BoutReal low_n_diffuse_perp; // Diffusion in perpendicular direction at low density
BoutReal ne_hyper_z, pe_hyper_z; // Hyper-diffusion
BoutReal nvi_hyper_z, vepsi_hyper_z; // hyper-diffusion on ion terms
BoutReal scale_num_cs; // Scale numerical sound speed
BoutReal floor_num_cs; // Apply a floor to the numerical sound speed
bool vepsi_dissipation; // Dissipation term in VePsi equation
bool vort_dissipation; // Dissipation term in Vorticity equation
bool phi_dissipation; // Dissipation term in Vorticity equation, depending on phi
BoutReal phi_dissipation; // Dissipation term in Vorticity equation, depending on phi
BoutReal delp2_dissipation; // Dissipation using delp2

// Sources and profiles

Expand Down Expand Up @@ -222,6 +237,7 @@ private:

// Curvature, Grad-B drift
Vector3D Curlb_B; // Curl(b/B)
bool revCurlb_B; // Reverse direction of Curl(b/B) vector

// Perturbed parallel gradient operators
const Field3D Grad_parP(const Field3D &f);
Expand Down
2 changes: 2 additions & 0 deletions include/mixed.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ private:
Field3D Pnlim; // Limited pressure, used to calculate pressure-driven diffusive flows
Field3D Vn;
Field3D Dnn;

Field3D Riz, Rrc, Rcx, Rex;

bool sheath_ydown, sheath_yup;

Expand Down
5 changes: 4 additions & 1 deletion include/neutral-model.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public:

// Options for calculating rates
OPTION(options, Eionize, 30); // Energy loss per ionisation [eV]
OPTION(options, h_excitation, true); // Add to plasma radiation sink
}
virtual ~NeutralModel() {}

Expand Down Expand Up @@ -74,11 +75,13 @@ protected:
UpdatedRadiatedPower hydrogen; // Atomic rates (H.Willett)

BoutReal Eionize; // Energy loss per ionisation [eV]

bool h_excitation; // add excitation energy to the hydrogen radiation energy sink

void neutral_rates(const Field3D &Ne, const Field3D &Te, const Field3D &Ti, const Field3D &Vi, // Plasma quantities
const Field3D &Nn, const Field3D &Tn, const Field3D &Vnpar, // Neutral gas
Field3D &S, Field3D &F, Field3D &Qi, Field3D &R, // Transfer rates
Field3D &Riz, Field3D &Rrc, Field3D &Rcx); // Rates
Field3D &Riz, Field3D &Rrc, Field3D &Rcx, Field3D &Rex); // Rates

private:
NeutralModel();
Expand Down
26 changes: 26 additions & 0 deletions include/revision.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// Information about the version of Hermes
///
/// The build system will update this file on every commit, which may
/// result in files that include it getting rebuilt. Therefore it
/// should be included in as few places as possible

#ifndef HERMES_REVISION_H
#define HERMES_REVISION_H

namespace hermes {
namespace version {
/// The git commit hash
#ifndef HERMES_REVISION
constexpr auto revision = "@HERMES_REVISION@";
#else
// Stringify value passed at compile time
#define BUILDFLAG1_(x) #x
#define BUILDFLAG(x) BUILDFLAG1_(x)
constexpr auto revision = BUILDFLAG(HERMES_REVISION);
#undef BUILDFLAG1
#undef BUILDFLAG
#endif
} // namespace version
} // namespace hermes

#endif // HERMES_REVISION_H
4 changes: 2 additions & 2 deletions src/full-velocity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ void FullVelocity::update(const Field3D &Ne, const Field3D &Te,
/////////////////////////////////////////////////////
// Atomic processes

Field3D Riz, Rrc, Rcx;
neutral_rates(Ne, Te, Ti, Vi, Nn, Tn, Vnpar, S, F, Qi, Rp, Riz, Rrc, Rcx);
Field3D Riz, Rrc, Rcx, Rex;
neutral_rates(Ne, Te, Ti, Vi, Nn, Tn, Vnpar, S, F, Qi, Rp, Riz, Rrc, Rcx, Rex);

Fperp = Rrc + Rcx; // Friction for vorticity

Expand Down
Loading