Skip to content

Commit

Permalink
Merge branch 'hpc-improv' of github.com:Edward-RSE/python into hpc-im…
Browse files Browse the repository at this point in the history
…prov
  • Loading branch information
Edward-RSE committed Feb 9, 2024
2 parents 26ef349 + b90e0cf commit dbbd3e5
Show file tree
Hide file tree
Showing 60 changed files with 16,399 additions and 10,582 deletions.
67 changes: 30 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: C/C++ CI

name: "Python: continuous integration tests"
on:
push:
branches:
Expand All @@ -11,64 +10,47 @@ on:
- "main"
env:
PYTHON: ${{ github.workspace }}

jobs:
greeting_job:
greeting:
name: Greeting job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Print out environment variables"
run: |
echo "WORKSPACE IS $GITHUB_WORKSPACE $PYTHON"
$PYTHON/bin/Setup_Py_Dir
echo "WORKSPACE IS $GITHUB_WORKSPACE"
echo "PYTHON ENV VARIABLE IS: $PYTHON"
build:
build_and_test:
name: Build Python and run tests
runs-on: ubuntu-latest
needs: greeting
steps:
- uses: actions/checkout@v3
- name: configure
#- name: "Installing build dependencies"
# run: sudo apt update && apt install -y build-essential cmake

- name: Configuring Python
run: ./configure
- name: make gh_workflow_install
- name: Build GH Workflow version of Python
run: make gh_workflow_install

run:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.x' # Version range

- name: Install dependencies
- name: Install Python (the language) dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
cd $PYTHON/examples/gh-workflow/
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit test framework
run: |
cd $PYTHON/source/tests
make clean
make check CC=gcc
# - name: Compile programs, again
# run: |
# cd $PYTHON/source
# make CC=gcc INDENT=no all

- name: compile helper programs and setup
run: |
cd $PYTHON/source/
make clean
make CC=gcc INDENT=no all
make clean
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/Setup_Py_Dir
- name: balmer test
run: |
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/py -f -v 1 balmer_test
python $PYTHON/py_progs/balmer_decrement.py balmer_test
- name: read in parameter files
- name: Checking Python compiled and can read in inputs correctly
run: |
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/Setup_Py_Dir
Expand All @@ -82,3 +64,14 @@ jobs:
$PYTHON/bin/py -i ngc5548
$PYTHON/bin/py -i lamp_post
$PYTHON/bin/py -i cv_standard_import
- name: Running unit tests
run: |
cd $PYTHON/source/tests
make check CC=gcc
- name: Running Balmer test case
run: |
cd $PYTHON/examples/gh-workflow/
$PYTHON/bin/py -f -v 1 balmer_test
python $PYTHON/py_progs/balmer_decrement.py balmer_test
36 changes: 27 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ project(Python LANGUAGES C)

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_COMPILER mpicc)
set(CMAKE_CXX_COMPILER mpixx)
include_directories(include)
link_directories(lib)
add_definitions(-DMPI_ON)
Expand Down Expand Up @@ -178,21 +179,23 @@ set(PYTHON_SOURCE
source/communicate_wind.c
source/communicate_plasma.c
source/communicate_macro.c
source/communicate_spectra.c
)



set(PY_WIND_SOURCE source/py_wind_ion.c source/py_wind_macro.c
source/py_wind_sub.c source/py_wind_write.c
source/define_wind.c
source/communicate_wind.c)
source/communicate_wind.c
source/communicate_spectra.c)

set(WINDSAVE2TABLE_SOURCE source/windsave2table_sub.c
source/define_wind.c
source/communicate_wind.c)

set(RAD_HYDRO_SOURCE source/rad_hydro_files.c)

set(MODIFY_WIND_SOURCE source/modify_wind.c)

set(INSPECT_WIND_SOURCE source/inspect_wind.c)

set(OPTICAL_DEPTH_SOURCE
Expand All @@ -206,16 +209,15 @@ set(TEST_SOURCE
${PYTHON_SOURCE}
source/define_wind.c
source/tests/tests/test_define_wind.c
source/communicate_wind.c)

#${CUDA_SOURCE})

source/communicate_wind.c
source/tests/unit_test_model.c
source/tests/tests/test_run_mode.c
)

# Create the executables for each program, and link the required libraries

# Python
add_executable(python source/python.c ${PYTHON_SOURCE}
source/janitor.c)
add_executable(python source/python.c ${PYTHON_SOURCE})
target_link_libraries(python gsl gslcblas m)

# Py_wind
Expand All @@ -227,6 +229,22 @@ add_executable(windsave2table source/windsave2table.c ${PYTHON_SOURCE}
${WINDSAVE2TABLE_SOURCE})
target_link_libraries(windsave2table gsl gslcblas m)

# rad_hydro_files
add_executable(rad_hydro_files ${PYTHON_SOURCE} ${RAD_HYDRO_SOURCE})
target_link_libraries(rad_hydro_files gsl gslcblas m)

# modify_wind
add_executable(modify_wind ${PYTHON_SOURCE} ${MODIFY_WIND_SOURCE})
target_link_libraries(modify_wind gsl gslcblas m)

# inspect_wind
add_executable(inspect_wind ${PYTHON_SOURCE} ${INSPECT_WIND_SOURCE})
target_link_libraries(inspect_wind gsl gslcblas m)

# py_optd
add_executable(py_optd ${PYTHON_SOURCE} ${OPTICAL_DEPTH_SOURCE})
target_link_libraries(py_optd gsl gslcblas m)

# test
add_executable(py_unit_test ${TEST_SOURCE})
target_link_libraries(py_unit_test m gsl gslcblas cunit)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Disk.colour_correction
==========================
Type of colour correction to use

Type
Enumerator

Values
Done12
Temperature dependent form of colour correction from Done 2012 (see :doc:`Disk <../radiation/disk>`)


File
`setup_disk.c <https://github.com/agnwinds/python/blob/master/source/setup_disk.c>`_


Parent(s)
* :ref:`Disk.radiation`: ``True``

* :ref:`Disk.type`: ``flat``, ``vertically.extended``

* :ref:`Disk.rad_type_to_make_wind`: ``bb``, ``models``, ``mod_bb``
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Type

Values
bb
Multi-line description, must keep indentation.
Blackbody from each annulus

models
Multi-line description, must keep indentation.
Use model files such as stellar atmosphers

uniform
Multi-line description, must keep indentation.
mod_bb
modified blackbody (colour correction)


File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ Type

Values
bb
Multi-line description, must keep indentation.
Blackbody from each annulus

models
Multi-line description, must keep indentation.
Use model files such as stellar atmosphers

mod_bb
modified blackbody (colour correction)


File
Expand All @@ -26,3 +29,5 @@ Parent(s)
Child(ren)
* :ref:`Input_spectra.model_file`

* :ref:`Disk.colour_correction`

36 changes: 19 additions & 17 deletions docs/sphinx/source/radiation/disk.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
The Disk
########

The disk is normally treated as infinitely thin and defined by an inner boundary and an outer boundary. It assumed to be in Keplerian rotation about
the central object in the system. The temperature distribution of the disk
is normally assumed to be that of a standard Shakura-Sunyaev disk, with a hard
boundary at its inner edge. Options are provided for reading in a non-standard
temperature distribution.
The disk is normally treated as infinitely thin and defined by an inner boundary and an outer boundary. It assumed to be in Keplerian rotation about the central object in the system. The temperature distribution of the disk is normally assumed to be that of a standard Shakura-Sunyaev disk, with a hard boundary at its inner edge. Options are provided for reading in a non-standard temperature distribution.

An option is provide for a vertically extended disk, whose thickness increases
as with distance from the central object object.
as with distance from the central object object.

The parameters involved in describing a flat disk are::

Disk.type(none,flat,vertically.extended) flat
Disk.radiation(yes,no) yes
Disk.rad_type_to_make_wind(bb,models) bb
Disk.rad_type_to_make_wind(bb,models,mod_bb) bb
Disk.temperature.profile(standard,readin) standard
Disk.mdot(msol/yr) 5
Disk.radmax(cm) 1e17

Colour Correction (mod_bb)
=============================

A simple form of the disc colour correction is available in the code, accessible via the
:ref:`Disk.rad_type_to_make_wind(bb,models,mod_bb)` keyword. The colour correction factor, :math:`f_{\rm col}`, is defined such that

.. math::
B_\nu (\nu, T) \to f_{\rm col}^{-4} B_\nu (\nu, f_{\rm col} T).
This correction is designed to approximate the effect of radiative transfer in the disc atmosphere. We adopt the form given by `Done et al. 2012 <https://academic.oup.com/mnras/article/420/3/1848/977649>`_, in which :math:`f_{\rm col}=1` for :math:`T<3\times10^4~{\rm K}`, and for :math:`T>3\times10^4~{\rm K}`

.. math::
f_{\rm col}(T)=\left(\frac{T}{3\times10^4~{\rm K}} \right)^{0.82}.
Vertically Extended disk (Details)
Expand Down Expand Up @@ -52,16 +61,9 @@ not take into account the fact that the disk area of a vertically extended disk
Non-Standard Temperature Profile
================================================

If desired the user can read the temperature profile for the disk from a file. Each
line in the file should consist of a radius and a temperature (and optionally a value of log g)
separated by whitespace (in the
first two columns) The values are assumed to be entered in a logical order, that is in
ascending values of radius. Lines, such as comments or header names of an astropy table, will be ignored.
If desired the user can read the temperature profile for the disk from a file. Each line in the file should consist of a radius (in cm) and a temperature (in K), and optionally a value of :math:`\log g`. The values separated by whitespace (in the first two columns). The values are assumed to be entered in a logical order, that is in ascending values of radius. Lines such as comments or header names of an astropy table, will be ignored.

The log g value is not required to generate BB spectra, but is required if the spectrum from the disk is to be generated from a
two-dimensional grid of models, usually a set of spectra generated to represent the spectra from a set of stellar
atmospheres calculations.
The :math:`\log g` value is not required to generate BB spectra, but is required if the spectrum from the disk is to be generated from a two-dimensional grid of models, usually a set of spectra generated to represent the spectra from a set of stellar atmospheres calculations.

With this option, the radius of the disk will be set to the maximum radius (the last value of r) in
the file.
With this option, the radius of the disk will be set to the maximum radius (the last value of r) in the file.

Loading

0 comments on commit dbbd3e5

Please sign in to comment.