-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from landinjm/update_automatic_test_script
Update automatic test script
- Loading branch information
Showing
46 changed files
with
4,790 additions
and
268 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
tests/automatic_tests/CHAC_anisotropyRegularized/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
## | ||
# CMake script for the PRISMS-PF applications: | ||
## | ||
|
||
|
||
# Required cmake version. This should be inline with what is required | ||
# for the dealii installation. | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) | ||
|
||
# Find deal.II installation | ||
FIND_PACKAGE(deal.II 9.2.0 REQUIRED | ||
HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}) | ||
|
||
# Check to make sure deal.II is configured with p4est | ||
IF(NOT ${DEAL_II_WITH_P4EST}) | ||
MESSAGE(FATAL_ERROR "\n" | ||
"*** deal.II was not installed with p4est. ***\n\n" | ||
"The p4est library is a mandatory prerequisite for PRISMS-PF. Please consult the \n" | ||
"user guide to confirm that deal.II and p4est were installed and configured correctly." | ||
) | ||
ENDIF() | ||
|
||
DEAL_II_INITIALIZE_CACHED_VARIABLES() | ||
|
||
# Set up the debug, release, and run targets | ||
ADD_CUSTOM_TARGET(debug | ||
COMMAND +env ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} | ||
COMMAND +env ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all | ||
COMMENT "Switch CMAKE_BUILD_TYPE to Debug" | ||
) | ||
|
||
ADD_CUSTOM_TARGET(release | ||
COMMAND +env ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} | ||
COMMAND +env ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all | ||
COMMENT "Switch CMAKE_BUILD_TYPE to Release" | ||
) | ||
|
||
ADD_CUSTOM_TARGET(run COMMAND main | ||
COMMENT "Run with ${CMAKE_BUILD_TYPE} configuration" | ||
) | ||
|
||
PROJECT(myapp) | ||
if (${CMAKE_BUILD_TYPE} MATCHES DebugRelease) | ||
SET(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
|
||
# Check if postprocess.cc and nucleation.cc exist and set preprocessor variables | ||
if (EXISTS "postprocess.cc") | ||
add_definitions(-DPOSTPROCESS_FILE_EXISTS) | ||
endif() | ||
if (EXISTS "nucleation.cc") | ||
add_definitions(-DNUCLEATION_FILE_EXISTS) | ||
endif() | ||
|
||
ADD_EXECUTABLE(main main.cc ) | ||
|
||
DEAL_II_SETUP_TARGET(main) | ||
|
||
set(cmd "cmake") | ||
set(arg "CMakeLists.txt") | ||
set(dir ${PROJECT_SOURCE_DIR}/../../..) | ||
EXECUTE_PROCESS(COMMAND ${cmd} ${arg} | ||
WORKING_DIRECTORY ${dir}) | ||
|
||
set(cmd "make") | ||
|
||
EXECUTE_PROCESS(COMMAND ${cmd} | ||
WORKING_DIRECTORY ${dir}) | ||
|
||
if (${CMAKE_BUILD_TYPE} STREQUAL "Release") | ||
TARGET_LINK_LIBRARIES(main ${CMAKE_SOURCE_DIR}/../../../libprisms_pf.a) | ||
elseif(${CMAKE_BUILD_TYPE} STREQUAL "DebugRelease") | ||
TARGET_LINK_LIBRARIES(main ${CMAKE_SOURCE_DIR}/../../../libprisms_pf.a) | ||
else() | ||
TARGET_LINK_LIBRARIES(main ${CMAKE_SOURCE_DIR}/../../../libprisms_pf_debug.a) | ||
endif() |
80 changes: 80 additions & 0 deletions
80
tests/automatic_tests/CHAC_anisotropyRegularized/ICs_and_BCs.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// =========================================================================== | ||
// FUNCTION FOR INITIAL CONDITIONS | ||
// =========================================================================== | ||
|
||
template <int dim, int degree> | ||
void | ||
customPDE<dim, degree>::setInitialCondition([[maybe_unused]] const Point<dim> &p, | ||
[[maybe_unused]] const unsigned int index, | ||
[[maybe_unused]] double &scalar_IC, | ||
[[maybe_unused]] Vector<double> &vector_IC) | ||
{ | ||
// --------------------------------------------------------------------- | ||
// ENTER THE INITIAL CONDITIONS HERE | ||
// --------------------------------------------------------------------- | ||
// Enter the function describing conditions for the fields at point "p". | ||
// Use "if" statements to set the initial condition for each variable | ||
// according to its variable index | ||
|
||
double r = 0.0; | ||
|
||
if (index == 0) | ||
{ | ||
r = 0.0; | ||
for (unsigned int dir = 0; dir < dim; dir++) | ||
{ | ||
r += (p[dir] - userInputs.domain_size[dir] / 2.0) * | ||
(p[dir] - userInputs.domain_size[dir] / 2.0); | ||
} | ||
r = std::sqrt(r); | ||
double n = 0.5 * (1.0 - std::tanh((r - userInputs.domain_size[0] / 4.0) / 4.0)); | ||
scalar_IC = 0.082 * 16.0 / (userInputs.domain_size[0] / 4.0) + | ||
(3.0 * n * n - 2.0 * n * n * n); | ||
} | ||
else if (index == 1) | ||
{ | ||
r = 0.0; | ||
for (unsigned int dir = 0; dir < dim; dir++) | ||
{ | ||
r += (p[dir] - userInputs.domain_size[dir] / 2.0) * | ||
(p[dir] - userInputs.domain_size[dir] / 2.0); | ||
} | ||
r = std::sqrt(r); | ||
scalar_IC = 0.5 * (1.0 - std::tanh((r - userInputs.domain_size[0] / 4.0) / 4.0)); | ||
} | ||
else | ||
{ | ||
scalar_IC = 0.0; | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
} | ||
|
||
// =========================================================================== | ||
// FUNCTION FOR NON-UNIFORM DIRICHLET BOUNDARY CONDITIONS | ||
// =========================================================================== | ||
|
||
template <int dim, int degree> | ||
void | ||
customPDE<dim, degree>::setNonUniformDirichletBCs( | ||
[[maybe_unused]] const Point<dim> &p, | ||
[[maybe_unused]] const unsigned int index, | ||
[[maybe_unused]] const unsigned int direction, | ||
[[maybe_unused]] const double time, | ||
[[maybe_unused]] double &scalar_BC, | ||
[[maybe_unused]] Vector<double> &vector_BC) | ||
{ | ||
// -------------------------------------------------------------------------- | ||
// ENTER THE NON-UNIFORM DIRICHLET BOUNDARY CONDITIONS HERE | ||
// -------------------------------------------------------------------------- | ||
// Enter the function describing conditions for the fields at point "p". | ||
// Use "if" statements to set the boundary condition for each variable | ||
// according to its variable index. This function can be left blank if there | ||
// are no non-uniform Dirichlet boundary conditions. For BCs that change in | ||
// time, you can access the current time through the variable "time". The | ||
// boundary index can be accessed via the variable "direction", which starts | ||
// at zero and uses the same order as the BC specification in parameters.in | ||
// (i.e. left = 0, right = 1, bottom = 2, top = 3, front = 4, back = 5). | ||
|
||
// ------------------------------------------------------------------------- | ||
} |
92 changes: 92 additions & 0 deletions
92
tests/automatic_tests/CHAC_anisotropyRegularized/customPDE.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include "../../../include/matrixFreePDE.h" | ||
|
||
using namespace dealii; | ||
|
||
template <int dim, int degree> | ||
class customPDE : public MatrixFreePDE<dim, degree> | ||
{ | ||
public: | ||
// Constructor | ||
customPDE(userInputParameters<dim> _userInputs) | ||
: MatrixFreePDE<dim, degree>(_userInputs) | ||
, userInputs(_userInputs) {}; | ||
|
||
// Function to set the initial conditions (in ICs_and_BCs.h) | ||
void | ||
setInitialCondition([[maybe_unused]] const Point<dim> &p, | ||
[[maybe_unused]] const unsigned int index, | ||
[[maybe_unused]] double &scalar_IC, | ||
[[maybe_unused]] Vector<double> &vector_IC) override; | ||
|
||
// Function to set the non-uniform Dirichlet boundary conditions (in | ||
// ICs_and_BCs.h) | ||
void | ||
setNonUniformDirichletBCs([[maybe_unused]] const Point<dim> &p, | ||
[[maybe_unused]] const unsigned int index, | ||
[[maybe_unused]] const unsigned int direction, | ||
[[maybe_unused]] const double time, | ||
[[maybe_unused]] double &scalar_BC, | ||
[[maybe_unused]] Vector<double> &vector_BC) override; | ||
|
||
private: | ||
#include "../../../include/typeDefs.h" | ||
|
||
const userInputParameters<dim> userInputs; | ||
|
||
// Function to set the RHS of the governing equations for explicit time | ||
// dependent equations (in equations.h) | ||
void | ||
explicitEquationRHS( | ||
[[maybe_unused]] variableContainer<dim, degree, VectorizedArray<double>> | ||
&variable_list, | ||
[[maybe_unused]] Point<dim, VectorizedArray<double>> q_point_loc) const override; | ||
|
||
// Function to set the RHS of the governing equations for all other equations | ||
// (in equations.h) | ||
void | ||
nonExplicitEquationRHS( | ||
[[maybe_unused]] variableContainer<dim, degree, VectorizedArray<double>> | ||
&variable_list, | ||
[[maybe_unused]] Point<dim, VectorizedArray<double>> q_point_loc) const override; | ||
|
||
// Function to set the LHS of the governing equations (in equations.h) | ||
void | ||
equationLHS( | ||
[[maybe_unused]] variableContainer<dim, degree, VectorizedArray<double>> | ||
&variable_list, | ||
[[maybe_unused]] Point<dim, VectorizedArray<double>> q_point_loc) const override; | ||
|
||
// Function to set postprocessing expressions (in postprocess.h) | ||
#ifdef POSTPROCESS_FILE_EXISTS | ||
void | ||
postProcessedFields( | ||
[[maybe_unused]] const variableContainer<dim, degree, VectorizedArray<double>> | ||
&variable_list, | ||
[[maybe_unused]] variableContainer<dim, degree, VectorizedArray<double>> | ||
&pp_variable_list, | ||
[[maybe_unused]] const Point<dim, VectorizedArray<double>> q_point_loc) | ||
const override; | ||
#endif | ||
|
||
// Function to set the nucleation probability (in nucleation.h) | ||
#ifdef NUCLEATION_FILE_EXISTS | ||
double | ||
getNucleationProbability([[maybe_unused]] variableValueContainer variable_value, | ||
[[maybe_unused]] double dV) const override; | ||
#endif | ||
|
||
// ================================================================ | ||
// Methods specific to this subclass | ||
// ================================================================ | ||
|
||
// ================================================================ | ||
// Model constants specific to this subclass | ||
// ================================================================ | ||
|
||
double McV = userInputs.get_model_constant_double("McV"); | ||
double MnV = userInputs.get_model_constant_double("MnV"); | ||
double epsilonM = userInputs.get_model_constant_double("epsilonM"); | ||
double delta2 = userInputs.get_model_constant_double("delta2"); | ||
|
||
// ================================================================ | ||
}; |
Oops, something went wrong.