Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
Add the README and building instructions (#21)
Browse files Browse the repository at this point in the history
* add skeleton for README

* using PeleLMeX clangformat

* edit readme

* add badges

* add CI badge

* fix badge

* edit the README

* add the build script

* edit the example script

* add the example keywords for input file

* edit the README

* edit the README

* user specified path for the database
  • Loading branch information
wjge authored Nov 16, 2023
1 parent c7cfa69 commit eb76192
Show file tree
Hide file tree
Showing 16 changed files with 1,540 additions and 1,406 deletions.
104 changes: 93 additions & 11 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,12 +1,94 @@
BasedOnStyle: WebKit
Language: Cpp
IndentWidth: 4
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakConstructorInitializers: BeforeColon
ColumnLimit: 80
BreakBeforeBraces: Allman
AlignConsecutiveAssignments: true
AlignOperands: true
AllowShortIfStatementsOnASingleLine: true
# -*- mode: yaml -*-
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: TopLevel
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
IndentCaseLabels: true
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: false
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never

40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
PeleRad
==========
# PeleRad

[![CI](https://github.com/AMReX-Combustion/PeleRad/actions/workflows/linux.yml/badge.svg)](https://github.com/AMReX-Combustion/PeleRad)
[![AMReX Badge](https://img.shields.io/static/v1?label=%22powered%20by%22&message=%22AMReX%22&color=%22blue%22)](https://amrex-codes.github.io/amrex/)
[![Exascale Computing Project](https://img.shields.io/badge/supported%20by-ECP-blue)](https://www.exascaleproject.org/research-project/combustion-pele/)

## Table of Contents
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

## Description
PeleRad is a module for modeling radiative transfer in reacting flows. It supports GPU performance portability and adaptive mesh refinement through AMReX and is coupled to PeleLMeX.

## Installation
1. Clone the repository: `git clone https://github.com/AMReX-Combustion/PeleRad.git`
2. The example CMake scripts for Summit CUDA build and Frontier HIP build are in the '/scripts' folder.
3. To enable the unit tests, PeleRad needs to build with the Boost library.

To build with the PeleLMeX flow solver, GNUMake is prefered.
One example script to build a test case on Frontier is provided in the '/scripts' folder.

To run the script:
'./build_PeleLMeX_Fontier.sh'

## Usage
PeleRad is designed for modeling radiative transfer in reacting flows. To activate and use PeleRad in conjunction with PeleLMeX, follow these steps:
1. Add 'USE_PELERAD = TRUE' in the GNUmakefile in the case folder.
2. If using the clang compiler on Frontier, link the c++ file system by adding 'LIBRARIES += -lstdc++fs'.
3. Add the pelerad input keywords to the amrex-style input file in the case folder. Example keywords can be found in '/inputs/inputs.egLMeX'
4. Specify the path of the spectral database ($PELERAD_HOME/data/kpDB/) is needed for the 'pelerad.kppath' keywords in the input file.

## License
The license file is located at
https://github.com/AMReX-Combustion/PeleMP/blob/master/license.txt


PeleRad is a module for modeling radiative transfer in reacting flows.
19 changes: 19 additions & 0 deletions inputs/inputs.egforLMeX
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
peleLM.do_rad_solve = 1
pelerad.kppath = "path/data/kpDB/"
pelerad.composite_solve = 1
pelerad.use_hypre = 0
pelerad.verbose = 0
pelerad.max_iter = 200
pelerad.max_coarsening_level = 10
pelerad.reltol = 1.0e-4
pelerad.abstol = 1.0e-4
pelerad.bottom_reltol = 1.0e-6
pelerad.bottom_abstol = 1.0e-6
pelerad.agglomeration = 1
pelerad.consolidation = 0
pelerad.bottom_verbose = 0
pelerad.maxorder = 2
pelerad.linop_maxorder = 2
pelerad.max_fmg_iter = 0
pelerad.lo_bc = Robin Periodic Periodic
pelerad.hi_bc = Robin Periodic Periodic
32 changes: 32 additions & 0 deletions scripts/build_PeleLMeX_Frontier.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash -l

MYPWD=${PWD}

module load PrgEnv-cray cmake rocm/5.2.0 craype-x86-trento craype-accel-amd-gfx90a cray-libsci/21.08.1.2

# git clone --recursive --branch development https://github.com/AMReX-Combustion/PeleLMeX.git
git clone --recursive --branch pr_rad https://github.com/wjge/PeleLMeX.git
git clone --branch main https://github.com/AMReX-Combustion/PeleRad.git
git clone --branch eb_robin https://github.com/WeiqunZhang/amrex.git
git clone --branch pr_rad https://github.com/wjge/PeleMP.git

export PELELMEX_HOME=${MYPWD}/PeleLMeX
export AMREX_HOME=${MYPWD}/amrex
export PELE_PHYSICS_HOME=${MYPWD}/PeleLMeX/Submodules/PelePhysics
export PELEMP_HOME=${MYPWD}/PeleMP
export AMREX_HYDRO_HOME=${MYPWD}/PeleLMeX/Submodules/AMReX-Hydro
export PELERAD_HOME=${MYPWD}/PeleRad

cd ${PELEMP_HOME}/Exec/SootTests/PeleLMeX/laminar_flame

# Build LMeX laminar_flame case
#Build SUNDIALS and MAGMA
make -j8 COMP=clang USE_HIP=TRUE USE_MPI=TRUE TINY_PROFILE=TRUE PELE_USE_MAGMA=TRUE HOSTNAME=frontier TPLrealclean
make -j8 COMP=clang USE_HIP=TRUE USE_MPI=TRUE TINY_PROFILE=TRUE PELE_USE_MAGMA=TRUE HOSTNAME=frontier TPL

#Build PeleLMeX
make -j8 COMP=clang USE_HIP=TRUE USE_MPI=TRUE TINY_PROFILE=TRUE PELE_USE_MAGMA=TRUE HOSTNAME=frontier realclean
make -j8 COMP=clang USE_HIP=TRUE USE_MPI=TRUE TINY_PROFILE=TRUE PELE_USE_MAGMA=TRUE HOSTNAME=frontier

echo "pelerad.kppath = "$PELERAD_HOME/data/kpDB/"" >> first-input
./PeleLMeX2d.hip.x86-trento.TPROF.MPI.HIP.ex first-input
39 changes: 19 additions & 20 deletions src/AMRParam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@
#include <AMReX_Vector.H>
#include <string>

namespace PeleRad
{
namespace PeleRad {

struct AMRParam
{
public:
amrex::ParmParse pp_;
amrex::ParmParse pp_;

int max_level_;
int ref_ratio_;
int n_cell_;
int max_grid_size_;
int prob_type_;
std::string plot_file_name_;
int max_level_;
int ref_ratio_;
int n_cell_;
int max_grid_size_;
int prob_type_;
std::string plot_file_name_;

AMREX_GPU_HOST
AMRParam(amrex::ParmParse const& pp) : pp_(pp)
{
pp_.query("max_level", max_level_);
pp_.query("ref_ratio", ref_ratio_);
pp_.query("n_cell", n_cell_);
pp_.query("max_grid_size", max_grid_size_);
pp_.query("prob_type", prob_type_);
pp.query("plot_file_name", plot_file_name_);
}
AMREX_GPU_HOST
AMRParam(amrex::ParmParse const& pp) : pp_(pp)
{
pp_.query("max_level", max_level_);
pp_.query("ref_ratio", ref_ratio_);
pp_.query("n_cell", n_cell_);
pp_.query("max_grid_size", max_grid_size_);
pp_.query("prob_type", prob_type_);
pp.query("plot_file_name", plot_file_name_);
}
};

}
} // namespace PeleRad
#endif
51 changes: 25 additions & 26 deletions src/Constants.hpp
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
#ifndef CONSTANTS_HPP
#define CONSTANTS_HPP

namespace PeleRad
{
namespace PeleRad {

struct RadComps
{
int co2Indx = -1;
int h2oIndx = -1;
int coIndx = -1;
int ch4Indx = -1;
int c2h4Indx = -1;
int co2Indx = -1;
int h2oIndx = -1;
int coIndx = -1;
int ch4Indx = -1;
int c2h4Indx = -1;

void checkIndices()
{
if (co2Indx > 0)
std::cout << " include radiative gas: CO2, the index is " << co2Indx
<< std::endl;
if (h2oIndx > 0)
std::cout << " include radiative gas: H2O, the index is " << h2oIndx
<< std::endl;
if (coIndx > 0)
std::cout << " include radiative gas: CO, the index is " << coIndx
<< std::endl;
if (ch4Indx > 0)
std::cout << " include radiative gas: CH4, the index is " << coIndx
<< std::endl;
if (c2h4Indx > 0)
std::cout << " include radiative gas: C2H4, the index is " << coIndx
<< std::endl;
}
void checkIndices()
{
if (co2Indx > 0)
std::cout << " include radiative gas: CO2, the index is " << co2Indx
<< std::endl;
if (h2oIndx > 0)
std::cout << " include radiative gas: H2O, the index is " << h2oIndx
<< std::endl;
if (coIndx > 0)
std::cout << " include radiative gas: CO, the index is " << coIndx
<< std::endl;
if (ch4Indx > 0)
std::cout << " include radiative gas: CH4, the index is " << coIndx
<< std::endl;
if (c2h4Indx > 0)
std::cout << " include radiative gas: C2H4, the index is " << coIndx
<< std::endl;
}
};

}
} // namespace PeleRad
#endif
Loading

0 comments on commit eb76192

Please sign in to comment.