Skip to content

Commit

Permalink
Merge pull request #114 from n-claes/refactor/settings
Browse files Browse the repository at this point in the history
Major change in behaviour of settings
  • Loading branch information
n-claes authored Mar 2, 2023
2 parents a85c5a8 + 0977beb commit dd55ca9
Show file tree
Hide file tree
Showing 133 changed files with 5,082 additions and 3,227 deletions.
43 changes: 21 additions & 22 deletions .github/workflows/legolas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ on:
pull_request:
branches: [master, develop]

env:
CC: /usr/bin/gcc-10
FC: /usr/bin/gfortran-10
PFUNIT_DIR: /home/runner/work/legolas/legolas/tests/pFUnit/build/installed
LEGOLASDIR: /home/runner/work/legolas/legolas
ARPACK_ROOT: /home/runner/work/legolas/legolas/tests/arpack-ng

jobs:
test:
name: "${{ matrix.name }}"
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- name: unit-tests
coverage: true
- name: regression
coverage: true

name: [unit-tests, regression]
os: [ubuntu-latest]
compiler: [gfortran-11]
coverage: [true]

env:
FC: ${{ matrix.compiler }}
PFUNIT_DIR: /home/runner/work/legolas/legolas/tests/pFUnit/build/installed
LEGOLASDIR: /home/runner/work/legolas/legolas
ARPACK_ROOT: /home/runner/work/legolas/legolas/tests/arpack-ng

name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
Expand All @@ -39,16 +37,17 @@ jobs:
with:
cmake-version: "3.24.x"

- name: Install dependencies
- name: Install Legolas dependencies
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.compiler }}
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
sudo apt-get install lcov
gfortran-10 --version
${FC} --version
cmake --version
which gcov
which gcov-10
gcov --version
- name: Install Python dependencies & Pylbo
run: |
python -m pip install --upgrade pip
Expand All @@ -61,7 +60,7 @@ jobs:
uses: actions/cache@v1
with:
path: tests/pFUnit/
key: ${{ runner.os }}-pfunitv1
key: ${{ runner.os }}-pfunitv2

- name: Build pFUnit
if: steps.pfunit-cache.outputs.cache-hit != 'true'
Expand All @@ -80,7 +79,7 @@ jobs:
uses: actions/cache@v1
with:
path: tests/arpack-ng/
key: ${{ runner.os }}-arpackv2
key: ${{ runner.os }}-arpackv3

- name: Build ARPACK
if: steps.arpack-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -128,7 +127,7 @@ jobs:
cd coverage
lcov --capture --directory $LEGOLASDIR/build \
--output-file ${{ matrix.name }}.info \
--gcov-tool /usr/bin/gcov-10
--gcov-tool /usr/bin/gcov-11
# filter out coverage files
find $LEGOLASDIR/build -name '*.gc*' -delete
Expand Down
25 changes: 7 additions & 18 deletions post_processing/pylbo/automation/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@
("x_start", (int, np.integer, float)),
("x_end", (int, np.integer, float)),
("gridpoints", (int, np.integer)),
("mesh_accumulation", bool),
("ev_1", (int, np.integer, float)),
("ev_2", (int, np.integer, float)),
("sigma_1", (int, np.integer, float)),
("sigma_2", (int, np.integer, float)),
("force_r0", bool),
("coaxial", bool),
],
"equilibriumlist": [
("equilibrium_type", str),
("boundary_type", str),
("use_defaults", bool),
("remove_spurious_eigenvalues", bool),
("nb_spurious_eigenvalues", (int, np.integer)),
],
"savelist": [
("write_matrices", bool),
Expand All @@ -29,32 +22,30 @@
("write_derived_eigenfunctions", bool),
("show_results", bool),
("basename_datfile", str),
("basename_logfile", str),
("output_folder", str),
("logging_level", (int, np.integer)),
("dry_run", bool),
("write_eigenfunction_subset", bool),
("eigenfunction_subset_center", complex),
("eigenfunction_subset_radius", (int, np.integer, float)),
],
"physicslist": [
("physics_type", str),
("mhd_gamma", float),
("incompressible", bool),
("dropoff_edge_dist", (int, np.integer, float)),
("dropoff_width", (int, np.integer, float)),
("flow", bool),
("radiative_cooling", bool),
("ncool", (int, np.integer)),
("cooling_curve", str),
("external_gravity", bool),
("thermal_conduction", bool),
("use_fixed_tc_para", bool),
("parallel_conduction", bool),
("perpendicular_conduction", bool),
("fixed_tc_para_value", (int, np.integer, float)),
("use_fixed_tc_perp", bool),
("fixed_tc_perp_value", (int, np.integer, float)),
("resistivity", bool),
("use_fixed_resistivity", bool),
("fixed_eta_value", (int, np.integer, float)),
("fixed_resistivity_value", (int, np.integer, float)),
("use_eta_dropoff", bool),
("dropoff_edge_dist", (int, np.integer, float)),
("dropoff_width", (int, np.integer, float)),
("viscosity", bool),
("viscosity_value", (int, np.integer, float)),
("viscous_heating", bool),
Expand All @@ -64,10 +55,8 @@
("elec_inertia", bool),
("inertia_dropoff", bool),
("electron_fraction", (int, np.integer, float)),
("incompressible", bool),
],
"unitslist": [
("cgs_units", bool),
("unit_density", (int, np.integer, float)),
("unit_temperature", (int, np.integer, float)),
("unit_magneticfield", (int, np.integer, float)),
Expand Down
17 changes: 16 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ set (sources
mod_equilibrium_params.f08
dataIO/mod_exceptions.f08
dataIO/mod_logging.f08
dataIO/mod_console.f08
settings/physics/mod_flow_settings.f08
settings/physics/mod_cooling_settings.f08
settings/physics/mod_gravity_settings.f08
settings/physics/mod_resistivity_settings.f08
settings/physics/mod_viscosity_settings.f08
settings/physics/mod_conduction_settings.f08
settings/physics/mod_hall_settings.f08
settings/mod_settings.f08
settings/mod_dims.f08
settings/mod_io_settings.f08
settings/mod_solver_settings.f08
settings/mod_physics_settings.f08
settings/mod_grid_settings.f08
settings/mod_equilibrium_settings.f08
settings/mod_units.f08
mod_physical_constants.f08
utils/mod_get_indices.f08
matrices/datastructure/mod_matrix_node.f08
Expand All @@ -14,7 +30,6 @@ set (sources
matrices/datastructure/mod_banded_matrix_hermitian.f08
matrices/datastructure/mod_banded_operations.f08
matrices/datastructure/mod_transform_matrix.f08
mod_units.f08
mod_grid.f08
mod_types.f08
mod_check_values.f08
Expand Down
52 changes: 28 additions & 24 deletions src/boundaries/mod_boundary_manager.f08
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module mod_boundary_manager
use mod_global_variables, only: dp, dim_quadblock
use mod_global_variables, only: dp
use mod_logging, only: log_message, str
use mod_matrix_structure, only: matrix_t
use mod_settings, only: settings_t
implicit none

private
Expand All @@ -14,70 +15,73 @@ module mod_boundary_manager
logical, save, protected :: apply_noslip_bounds_right

interface
module subroutine apply_essential_boundaries_left(matrix)
module subroutine apply_essential_boundaries_left(matrix, settings)
type(matrix_t), intent(inout) :: matrix
type(settings_t), intent(in) :: settings
end subroutine apply_essential_boundaries_left

module subroutine apply_essential_boundaries_right(matrix)
module subroutine apply_essential_boundaries_right(matrix, settings)
type(matrix_t), intent(inout) :: matrix
type(settings_t), intent(in) :: settings
end subroutine apply_essential_boundaries_right

module subroutine apply_natural_boundaries_left(matrix)
module subroutine apply_natural_boundaries_left(matrix, settings)
type(matrix_t), intent(inout) :: matrix
type(settings_t), intent(in) :: settings
end subroutine apply_natural_boundaries_left

module subroutine apply_natural_boundaries_right(matrix)
module subroutine apply_natural_boundaries_right(matrix, settings)
type(matrix_t), intent(inout) :: matrix
type(settings_t), intent(in) :: settings
end subroutine apply_natural_boundaries_right
end interface

public :: apply_boundary_conditions

contains

subroutine apply_boundary_conditions(matrix_A, matrix_B)
subroutine apply_boundary_conditions(matrix_A, matrix_B, settings)
!> the A-matrix with boundary conditions imposed on exit
type(matrix_t), intent(inout) :: matrix_A
!> the B-matrix with boundary conditions imposed on exit
type(matrix_t), intent(inout) :: matrix_B
!> the settings object
type(settings_t), intent(in) :: settings

call set_boundary_flags()
call set_boundary_flags(settings)

! handle left side boundary conditions B-matrix
call apply_natural_boundaries_left(matrix_B)
call apply_essential_boundaries_left(matrix_B)
call apply_natural_boundaries_left(matrix_B, settings)
call apply_essential_boundaries_left(matrix_B, settings)
! handle left side boundary conditions A-matrix
call apply_natural_boundaries_left(matrix_A)
call apply_essential_boundaries_left(matrix_A)
call apply_natural_boundaries_left(matrix_A, settings)
call apply_essential_boundaries_left(matrix_A, settings)
! handle right side boundary conditions B-matrix
call apply_natural_boundaries_right(matrix_B)
call apply_essential_boundaries_right(matrix_B)
call apply_natural_boundaries_right(matrix_B, settings)
call apply_essential_boundaries_right(matrix_B, settings)
! handle right side boundary conditions A-matrix
call apply_natural_boundaries_right(matrix_A)
call apply_essential_boundaries_right(matrix_A)
call apply_natural_boundaries_right(matrix_A, settings)
call apply_essential_boundaries_right(matrix_A, settings)
end subroutine apply_boundary_conditions


subroutine set_boundary_flags()
use mod_equilibrium, only: kappa_field
use mod_global_variables, only: &
thermal_conduction, viscosity, coaxial, dp_LIMIT, geometry
subroutine set_boundary_flags(settings)
type(settings_t), intent(in) :: settings


apply_T_bounds = .false.
apply_noslip_bounds_left = .false.
apply_noslip_bounds_right = .false.

! check if we need regularity conditions on T, this is the case if we have
! perpendicular thermal conduction
if (thermal_conduction .and. any(abs(kappa_field % kappa_perp) > dp_LIMIT)) then
apply_T_bounds = .true.
end if
apply_T_bounds = settings%physics%conduction%has_perpendicular_conduction()

! for viscosity, check if we need a no-slip condition.
if (viscosity) then
if (settings%physics%viscosity%is_enabled()) then
apply_noslip_bounds_right = .true.
! does not apply on-axis for cylindrical, unless two coaxial walls are present
if (coaxial .or. geometry == "Cartesian") then
if (settings%grid%coaxial .or. settings%grid%get_geometry() == "Cartesian") then
apply_noslip_bounds_left = .true.
end if
end if
Expand Down
Loading

0 comments on commit dd55ca9

Please sign in to comment.