Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Jan 30, 2025
1 parent 2f6e3bf commit 6e601cb
Show file tree
Hide file tree
Showing 143 changed files with 6,971 additions and 15,285 deletions.
4 changes: 4 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ Checks: >
cppcoreguidelines-*,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-magic-numbers,
hicpp-*,
misc-*,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-pass-by-value,
mpi-*,
performance-*,
readability-*,
-readability-else-after-return,
-readability-identifier-length,
-readability-magic-numbers,
-readability-convert-member-functions-to-static,
WarningsAsErrors: '*'
1 change: 0 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
pull_request:
branches:
- master
- devel
types:
- opened
- reopened
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ main
#Output files
applications/*/*.vtk
*.vtu
*.pvtu
*.vts
*.frt
integratedFields.txt
Expand Down
4 changes: 2 additions & 2 deletions applications/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include "core/variableAttributes.h"
#include "equations.cc"

#include <core/ParseCommandLineOpts.h>
#include <core/inputFileReader.h>
#include <core/parse_cmd_options.h>
#include <core/variableAttributeLoader.h>

// Header file for postprocessing that may or may not exist
Expand Down Expand Up @@ -38,7 +38,7 @@ main(int argc, char **argv)
std::string parameters_filename;
try
{
ParseCommandLineOpts cli_options(argc, argv);
parseCMDOptions cli_options(argc, argv);
parameters_filename = cli_options.getParametersFilename();
}
catch (const char *msg)
Expand Down
33 changes: 33 additions & 0 deletions applications/multigrid_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##
# CMake script for the PRISMS-PF applications
# Adapted from the ASPECT CMake file
##

cmake_minimum_required(VERSION 3.3.0)

include(${CMAKE_SOURCE_DIR}/../../cmake/setup_application.cmake)

project(myapp)

# Set location of files
include_directories(${CMAKE_SOURCE_DIR}/../../include)
include_directories(${CMAKE_SOURCE_DIR}/../../src)
include_directories(${CMAKE_SOURCE_DIR})

# Set the location of the main.cc file
set(TARGET_SRC "${CMAKE_SOURCE_DIR}/main.cc" "${CMAKE_SOURCE_DIR}/equations.cc" "${CMAKE_SOURCE_DIR}/ICs_and_BCs.cc")

# Set targets & link libraries for the build type
if(${PRISMS_PF_BUILD_DEBUG} STREQUAL "ON")
add_executable(main_debug ${TARGET_SRC})
set_property(TARGET main_debug PROPERTY OUTPUT_NAME main-debug)
deal_ii_setup_target(main_debug DEBUG)
target_link_libraries(main_debug ${CMAKE_SOURCE_DIR}/../../libprisms-pf-debug.a)
endif()

if(${PRISMS_PF_BUILD_RELEASE} STREQUAL "ON")
add_executable(main_release ${TARGET_SRC})
set_property(TARGET main_release PROPERTY OUTPUT_NAME main)
deal_ii_setup_target(main_release RELEASE)
target_link_libraries(main_release ${CMAKE_SOURCE_DIR}/../../libprisms-pf-release.a)
endif()
24 changes: 24 additions & 0 deletions applications/multigrid_test/ICs_and_BCs.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <cmath>
#include <config.h>
#include <core/boundary_conditions/nonuniform_dirichlet.h>

template <int dim>
void
customNonuniformDirichlet<dim>::set_nonuniform_dirichlet(
[[maybe_unused]] const uint &index,
[[maybe_unused]] const uint &boundary_id,
[[maybe_unused]] const uint &component,
[[maybe_unused]] const dealii::Point<dim> &point,
[[maybe_unused]] double &scalar_value,
[[maybe_unused]] double &vector_component_value) const
{
if (index == 0)
{
if (boundary_id == 0 || boundary_id == 1)
{
scalar_value = std::sin(point[1] * M_PI);
}
}
}

INSTANTIATE_UNI_TEMPLATE(customNonuniformDirichlet)
68 changes: 68 additions & 0 deletions applications/multigrid_test/custom_pde.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#ifndef CUSTOM_PDE_H_
#define CUSTOM_PDE_H_

#include <core/matrix_free_operator.h>
#include <core/user_inputs/user_input_parameters.h>
#include <core/variable_attributes.h>

using namespace dealii;

/**
* \brief This is a derived class of `matrixFreeOperator` where the user implements their
* PDEs.
*
* \tparam dim The number of dimensions in the problem.
* \tparam degree The polynomial degree of the shape functions.
* \tparam number Datatype to use. Either double or float.
*/
template <int dim, int degree, typename number>
class customPDE : public matrixFreeOperator<dim, degree, number>
{
public:
using scalarValue = dealii::VectorizedArray<number>;
using scalarGrad = dealii::Tensor<1, dim, dealii::VectorizedArray<number>>;
using scalarHess = dealii::Tensor<2, dim, dealii::VectorizedArray<number>>;
using vectorValue = dealii::Tensor<1, dim, dealii::VectorizedArray<number>>;
using vectorGrad = dealii::Tensor<2, dim, dealii::VectorizedArray<number>>;
using vectorHess = dealii::Tensor<3, dim, dealii::VectorizedArray<number>>;

/**
* \brief Constructor.
*/
customPDE(const userInputParameters<dim> &_user_inputs)
: matrixFreeOperator<dim, degree, number>(_user_inputs.var_attributes)
, user_inputs(_user_inputs)
{}

private:
/**
* \brief User-implemented class for the RHS of explicit equations.
*/
void
compute_explicit_RHS(variableContainer<dim, degree, number> &variable_list,
const dealii::Point<dim, dealii::VectorizedArray<number>>
&q_point_loc) const override;

/**
* \brief User-implemented class for the RHS of nonexplicit equations.
*/
void
compute_nonexplicit_RHS(variableContainer<dim, degree, number> &variable_list,
const dealii::Point<dim, dealii::VectorizedArray<number>>
&q_point_loc) const override;

/**
* \brief User-implemented class for the LHS of nonexplicit equations.
*/
void
compute_nonexplicit_LHS(variableContainer<dim, degree, number> &variable_list,
const dealii::Point<dim, dealii::VectorizedArray<number>>
&q_point_loc) const override;

/**
* \brief The userinputs.
*/
const userInputParameters<dim> &user_inputs;
};

#endif
53 changes: 53 additions & 0 deletions applications/multigrid_test/equations.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "custom_pde.h"

#include <config.h>
#include <core/type_enums.h>
#include <core/variable_attribute_loader.h>

void
customAttributeLoader::loadVariableAttributes()
{
set_variable_name(0, "phi");
set_variable_type(0, SCALAR);
set_variable_equation_type(0, TIME_INDEPENDENT);

set_dependencies_value_term_RHS(0, "");
set_dependencies_gradient_term_RHS(0, "grad(phi)");
set_dependencies_value_term_LHS(0, "");
set_dependencies_gradient_term_LHS(0, "grad(change(phi))");
}

void
customAttributeLoader::loadPostProcessorVariableAttributes()
{}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_explicit_RHS(
[[maybe_unused]] variableContainer<dim, degree, number> &variable_list,
[[maybe_unused]] const Point<dim, VectorizedArray<number>> &q_point_loc) const
{}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_nonexplicit_RHS(
[[maybe_unused]] variableContainer<dim, degree, number> &variable_list,
[[maybe_unused]] const Point<dim, VectorizedArray<number>> &q_point_loc) const
{
scalarGrad phix = variable_list.get_scalar_gradient(0);

variable_list.set_scalar_gradient_term(0, -phix);
}

template <int dim, int degree, typename number>
void
customPDE<dim, degree, number>::compute_nonexplicit_LHS(
[[maybe_unused]] variableContainer<dim, degree, number> &variable_list,
[[maybe_unused]] const Point<dim, VectorizedArray<number>> &q_point_loc) const
{
scalarGrad change_phix = variable_list.get_scalar_gradient(0, CHANGE);

variable_list.set_scalar_gradient_term(0, change_phix, CHANGE);
}

INSTANTIATE_TRI_TEMPLATE(customPDE)
Loading

0 comments on commit 6e601cb

Please sign in to comment.