Skip to content

Commit

Permalink
Merge pull request #8 from aurora-multiphysics/2-add-read-heat-flux-hdf5
Browse files Browse the repository at this point in the history
Intermediate stage of reading heat flux values from ASCOT5 HDF5 file. Input from @dynamicist about design and general C++ features.
  • Loading branch information
bielsnohr authored Aug 12, 2021
2 parents 122b6ad + b5f625d commit cda252a
Show file tree
Hide file tree
Showing 23 changed files with 890 additions and 325 deletions.
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/docker-existing-dockerfile
{
"name": "Phaethon Dockerfile",

// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",

// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../Dockerfile",

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": ["ms-vscode.cpptools-extension-pack", "ms-azuretools.vscode-docker"]

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
}
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/secrets.dev.yaml
**/values.dev.yaml
/moose
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[submodule "ascot5-python"]
path = ascot5-python
url = [email protected]:ascot/python.git
[submodule "moose"]
path = moose
url = [email protected]:idaholab/moose.git
branch = master
[submodule "ascot5"]
path = ascot5
url = [email protected]:ascot/ascot5.git
44 changes: 44 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"configurations": [
{
"name": "MOOSE-Linux",
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}/build/header_symlinks",
"${workspaceFolder}/unit/build/header_symlinks",
"${MOOSE_DIR}/framework/build/header_symlinks",
"${MOOSE_DIR}/framework/contrib/gtest",
"${MOOSE_DIR}/modules/module_loader/build/header_symlinks",
"${MOOSE_DIR}/framework/contrib/boost/include",
"${MOOSE_DIR}/framework/contrib/hit",
"${MOOSE_DIR}/framework/contrib/json/include",
"${MOOSE_DIR}/libmesh/installed/include",
"/usr/include/hdf5/serial",
"${PETSC_DIR}/include"
],
"defines": [],
"compilerPath": "/usr/bin/mpicxx",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64",
"browse": {
"path": [
"${workspaceFolder}",
"${workspaceFolder}/build/header_symlinks",
"${workspaceFolder}/unit/build/header_symlinks",
"${MOOSE_DIR}/framework/build/header_symlinks",
"${MOOSE_DIR}/framework/contrib/gtest",
"${MOOSE_DIR}/modules/module_loader/build/header_symlinks",
"${MOOSE_DIR}/framework/contrib/boost/include",
"${MOOSE_DIR}/framework/contrib/hit",
"${MOOSE_DIR}/framework/contrib/json/include",
"${MOOSE_DIR}/libmesh/installed/include",
"/usr/include/hdf5/serial",
"${PETSC_DIR}/include"
]
},
"compilerArgs": [ ]
}
],
"version": 4
}
48 changes: 48 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/phaethon-dbg",
"args": [
"-i",
"test/tests/simple_diffusion/simple_diffusion.i"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "lldb",
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
}
},
{
"name": "(lldb) Unit Test Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/unit/phaethon-unit-dbg",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
}
}
]
}
20 changes: 20 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"files.associations": {
"*.C": "cpp",
"*.h": "cpp",
"cmath": "cpp",
"ratio": "cpp",
"*.tcc": "cpp",
"fstream": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"streambuf": "cpp",
"vector": "cpp"
},
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"restructuredtext.languageServer.disabled": true
}
117 changes: 117 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Unit Tests",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
},
"options": {"shell": {"args": ["-ic"]}},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"args": ["--directory=${workspaceFolder}/unit", "METHOD=devel", "-j4"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["absolute"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Makefike debug",
"type": "shell",
"command": "make",
"group": "none",
"options": {"shell": {"args": ["-ic"]}},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"args": ["METHOD=dbg", "-j4"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["absolute"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Makefike clean",
"type": "shell",
"command": "make",
"group": "none",
"options": {"shell": {"args": ["-ic"]}},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"args": ["clean"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["absolute"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
},
{
"label": "Test",
"type": "shell",
"command": "./run_tests",
"group": "test",
"options": {"shell": {"args": ["-ic"]}},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"args": ["-j4"]
},
{
"label": "Run Unit Tests",
"type": "shell",
"command": "./unit/run_tests",
"group": {
"kind": "test",
"isDefault": true
},
"options": {"shell": {"args": ["-ic"]}},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"args": ["-j4"]
}
]
}
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
####################
# ASCOT5 Build Stage
####################
# TODO should probably move away from using submodules. It means the version
# information of dependencies is scattered, and it would be better to centralise
# it here.
FROM helenbrooks/moose-ubuntu AS ascot5-moose-ubuntu

# Basic environment
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /home/ascot5
# Set path to shared library for Python interface to use and other environment
ENV LD_LIBRARY_PATH=/home/ascot5 EDITOR=vim LC_ALL=C.UTF-8 LANG=C.UTF-8

# ASCOT5 main C program and library
RUN apt-get update && apt-get -y install make libhdf5-dev
COPY ascot5 ./
# This is a completely serial version with no MPI or OpenMP offloading to GPUs
ENV MAKE_OPT='NOGIT=true CC=h5cc MPI=0 FLAGS=-foffload=disable'
RUN make clean ${MAKE_OPT}} && make ascot5_main ${MAKE_OPT} && \
make libascot ${MAKE_OPT} && \
ln -s -t /usr/local/bin/ $(readlink -f ascot5_main)

# ASCOT5 Python
RUN apt-get -y install python3-pip
COPY ascot5-python ./ascot5-python
RUN pip install ascot5-python/a5py

###################################
# Phaethon Dependencies Build Stage
###################################
FROM ascot5-moose-ubuntu AS phaethon-deps

RUN pip install meshio[all] click

##################################
# Phaethon Development Environment
##################################
FROM phaethon-deps as phaethon-dev

ENV METHOD=devel
WORKDIR /home/moose
# Update libMesh and PETSc
RUN ./scripts/update_and_rebuild_petsc.sh --prefix=/home/petsc && \
./scripts/update_and_rebuild_libmesh.sh --with-mpi
# This is needed or it mpiexec complains because docker runs as root
# Discussion on this issue https://github.com/open-mpi/ompi/issues/4451
ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
# Re-build MOOSE framework in devel mode
RUN cd test && make -j4 && ./run_tests -j4
RUN cd modules && make -j4 && ./run_tests -j4

RUN apt-get -y install clang-format curl
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get -y install git-lfs && \
git lfs install
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ XFEM := no
include $(MOOSE_DIR)/modules/modules.mk
###############################################################################

# Additional libraries for HDF5 support
ADDITIONAL_INCLUDES := -I/usr/include/hdf5/serial
ADDITIONAL_LIBS := -lhdf5_hl_cpp -lhdf5_cpp -lhdf5_serial_hl -lhdf5_serial

# dep apps
APPLICATION_DIR := $(CURDIR)
APPLICATION_NAME := phaethon
Expand Down
Loading

0 comments on commit cda252a

Please sign in to comment.