Skip to content

Commit

Permalink
Merge pull request #5 from GRTLCollaboration/enhancement/naming_and_l…
Browse files Browse the repository at this point in the history
…icense

Enhancement - naming and license
  • Loading branch information
JCAurre authored Dec 6, 2024
2 parents f5f6869 + 2679f64 commit de20873
Show file tree
Hide file tree
Showing 66 changed files with 712 additions and 617 deletions.
3 changes: 1 addition & 2 deletions Examples/ScalarFieldBH/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ makefiles += releasedExamples_AMRPoisson_execVariableCoefficient
# Choose a method USE_CTTK or USE_CTTKHybrid
# cxxcppflags = -DUSE_CTTK
cxxcppflags = -DUSE_CTTKHybrid
# cxxcppflags = -DUSE_OtherMethod

# the base name(s) of the application(s) in this directory
ebase = Main_ScalarFieldBH
Expand All @@ -32,7 +31,7 @@ src_dirs := ../../Source \
../../Source/Tools \
../../Source/Variables \
../../Source/TaggingCriteria \
../../Source/Operator \
../../Source/Operator \
../../Source/Operator/SolverOperator

# shared code for building example programs
Expand Down
19 changes: 12 additions & 7 deletions Examples/ScalarFieldBH/Main_ScalarFieldBH.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
/* GRTresna
* Copyright 2024 The GRTL Collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#include "mpi.h"
#include <iostream>

#include "CTTK.hpp"
#include "CTTKHybrid.hpp"
#include "GRParmParse.hpp"
#include "GRSolver.hpp"
#include "ScalarField.hpp"

Expand All @@ -28,24 +34,23 @@ int main(int argc, char *argv[])
exit(0);
}

// Read params here for now

// Create solver, specifying method and matter
// Read params input file
char *inFile = argv[1];
GRParmParse pp(argc - 2, argv + 2, NULL, inFile);

// Create solver, specifying method and matter
// Need to define these in the environment - see
// https://github.com/GRTLCollaboration/GRTresna/wiki/Solver-methods
// for more details
#if defined(USE_CTTK)
GRSolver<CTTK<ScalarField>, ScalarField> solver(pp);
pout() << "Using CTTK" << endl;
#elif defined(USE_CTTKHybrid)
GRSolver<CTTKHybrid<ScalarField>, ScalarField> solver(pp);
pout() << "Using CTTK Hybrid" << endl;
#elif defined(USE_OtherMethod)
GRSolver<OtherMethod<ScalarField>, ScalarField> solver(pp);
pout() << "Using Other Method" << endl;
#else
#error \
"No valid method defined. Please define one of the methods in the GNUMakefile."
"No valid GRSolver method defined. Please define one of the methods in the GNUMakefile. See the wiki page on solver methods for more details."
#endif

solver.setup();
Expand Down
6 changes: 6 additions & 0 deletions Examples/ScalarFieldBH/MatterParams.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* GRTresna
* Copyright 2024 The GRTL Collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#ifndef MATTERPARAMS_HPP_
#define MATTERPARAMS_HPP_

#include "GRParmParse.hpp"
#include "REAL.H"

namespace MatterParams
Expand Down
15 changes: 0 additions & 15 deletions Examples/ScalarFieldBH/MultigridUserVariables.hpp

This file was deleted.

20 changes: 20 additions & 0 deletions Examples/ScalarFieldBH/MultigridVariables.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* GRTresna
* Copyright 2024 The GRTL collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#ifndef MULTIGRIDVARIABLES_HPP
#define MULTIGRIDVARIABLES_HPP

#include "MetricVariables.hpp"
#include "ScalarFieldVariables.hpp"

namespace MultigridVariables
{
static const std::array<std::string, NUM_METRIC_VARS> metric_variable_names =
MetricVariables::variable_names;
static const std::array<std::string, NUM_MULTIGRID_VARS - NUM_METRIC_VARS>
matter_variable_names = MatterVariables::variable_names;
} // namespace MultigridVariables

#endif /* MULTIGRIDVARIABLES_HPP */
5 changes: 5 additions & 0 deletions Examples/ScalarFieldBH/MyMatterFunctions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* GRTresna
* Copyright 2024 The GRTL Collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#include "ScalarField.hpp"

Real ScalarField::my_potential_function(const Real &phi_here) const
Expand Down
3 changes: 1 addition & 2 deletions Examples/ScalarFieldCosmo/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ makefiles += releasedExamples_AMRPoisson_execVariableCoefficient
# Choose a method USE_CTTK or USE_CTTKHybrid
cxxcppflags = -DUSE_CTTK
# cxxcppflags = -DUSE_CTTKHybrid
# cxxcppflags = -DUSE_OtherMethod

# the base name(s) of the application(s) in this directory
ebase = Main_ScalarFieldCosmo
Expand All @@ -32,7 +31,7 @@ src_dirs := ../../Source \
../../Source/Tools \
../../Source/Variables \
../../Source/TaggingCriteria \
../../Source/Operator \
../../Source/Operator \
../../Source/Operator/SolverOperator

# shared code for building example programs
Expand Down
22 changes: 15 additions & 7 deletions Examples/ScalarFieldCosmo/Main_ScalarFieldCosmo.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
/* GRTresna
* Copyright 2024 The GRTL Collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#include "mpi.h"
#include <iostream>

#include "CTTK.hpp"
#include "CTTKHybrid.hpp"
#include "GRParmParse.hpp"
#include "GRSolver.hpp"
#include "ScalarField.hpp"

Expand All @@ -11,6 +17,9 @@ using namespace std;
int main(int argc, char *argv[])
{
int status = 0;
#ifdef _OPENMP
std::cout << "#threads = " << omp_get_max_threads() << std::endl;
#endif
#ifdef CH_MPI
MPI_Init(&argc, &argv);
int rank;
Expand All @@ -25,24 +34,23 @@ int main(int argc, char *argv[])
exit(0);
}

// Read params here for now

// Create solver, specifying method and matter
// Read params input file
char *inFile = argv[1];
GRParmParse pp(argc - 2, argv + 2, NULL, inFile);

// Create solver, specifying method and matter
// Need to define these in the environment - see
// https://github.com/GRTLCollaboration/GRTresna/wiki/Solver-methods
// for more details
#if defined(USE_CTTK)
GRSolver<CTTK<ScalarField>, ScalarField> solver(pp);
pout() << "Using CTTK" << endl;
#elif defined(USE_CTTKHybrid)
GRSolver<CTTKHybrid<ScalarField>, ScalarField> solver(pp);
pout() << "Using CTTK Hybrid" << endl;
#elif defined(USE_OtherMethod)
GRSolver<OtherMethod<ScalarField>, ScalarField> solver(pp);
pout() << "Using Other Method" << endl;
#else
#error \
"No valid method defined. Please define one of the methods in the GNUMakefile."
"No valid GRSolver method defined. Please define one of the methods in the GNUMakefile. See the wiki page on solver methods for more details."
#endif

solver.setup();
Expand Down
6 changes: 6 additions & 0 deletions Examples/ScalarFieldCosmo/MatterParams.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* GRTresna
* Copyright 2024 The GRTL Collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#ifndef MATTERPARAMS_HPP_
#define MATTERPARAMS_HPP_

#include "GRParmParse.hpp"
#include "REAL.H"

namespace MatterParams
Expand Down
15 changes: 0 additions & 15 deletions Examples/ScalarFieldCosmo/MultigridUserVariables.hpp

This file was deleted.

20 changes: 20 additions & 0 deletions Examples/ScalarFieldCosmo/MultigridVariables.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* GRTresna
* Copyright 2024 The GRTL collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#ifndef MULTIGRIDVARIABLES_HPP
#define MULTIGRIDVARIABLES_HPP

#include "MetricVariables.hpp"
#include "ScalarFieldVariables.hpp"

namespace MultigridVariables
{
static const std::array<std::string, NUM_METRIC_VARS> metric_variable_names =
MetricVariables::variable_names;
static const std::array<std::string, NUM_MULTIGRID_VARS - NUM_METRIC_VARS>
matter_variable_names = MatterVariables::variable_names;
} // namespace MultigridVariables

#endif /* MULTIGRIDVARIABLES_HPP */
5 changes: 5 additions & 0 deletions Examples/ScalarFieldCosmo/MyMatterFunctions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* GRTresna
* Copyright 2024 The GRTL collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

#include "ScalarField.hpp"

Real ScalarField::my_potential_function(const Real &phi_here) const
Expand Down
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2024, GRTL Collaboration / GRTresna
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 changes: 16 additions & 10 deletions Source/Core/BoundaryConditions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* GRTresna
* Copyright 2024 The GRTL Collaboration.
* Please refer to LICENSE in GRTresna's root directory.
*/

// Chombo includes
#include "FArrayBox.H"
#include "ProblemDomain.H"
Expand Down Expand Up @@ -25,8 +30,8 @@ BoundaryConditions::params_t::params_t()
reflective_boundaries_exist = false;
vars_parity_metric = MetricVariables::vars_parity;
vars_parity_matter = MatterVariables::vars_parity;
vars_parity_grchombo = GRChomboUserVariables::vars_parity;
vars_parity_constraint = ConstraintUserVariables::vars_parity;
vars_parity_grchombo = GRChomboVariables::vars_parity;
vars_parity_constraint = ConstraintVariables::vars_parity;
extrapolation_order = 1;
}

Expand Down Expand Up @@ -133,7 +138,7 @@ void BoundaryConditions::write_reflective_conditions(int idir,
int parity = get_var_parity(icomp, idir, a_params);
if (parity == -1)
{
pout() << MultigridUserVariables::metric_variable_names[icomp]
pout() << MultigridVariables::metric_variable_names[icomp]
<< " ";
}
}
Expand All @@ -142,7 +147,7 @@ void BoundaryConditions::write_reflective_conditions(int idir,
int parity = get_var_parity(icomp, idir, a_params);
if (parity == -1)
{
pout() << MultigridUserVariables::matter_variable_names[icomp]
pout() << MultigridVariables::matter_variable_names[icomp]
<< " ";
}
}
Expand All @@ -152,7 +157,7 @@ void BoundaryConditions::write_reflective_conditions(int idir,
get_var_parity(icomp, idir, a_params, VariableType::grchombo);
if (parity == -1)
{
pout() << GRChomboUserVariables::variable_names[icomp] << " ";
pout() << GRChomboVariables::variable_names[icomp] << " ";
}
}
for (int icomp = 0; icomp < NUM_CONSTRAINT_VARS; icomp++)
Expand All @@ -161,7 +166,7 @@ void BoundaryConditions::write_reflective_conditions(int idir,
get_var_parity(icomp, idir, a_params, VariableType::constraint);
if (parity == -1)
{
pout() << ConstraintUserVariables::variable_names[icomp] << " ";
pout() << ConstraintVariables::variable_names[icomp] << " ";
}
}
}
Expand Down Expand Up @@ -201,10 +206,8 @@ void BoundaryConditions::write_boundary_conditions(const params_t &a_params)
pout() << "---------------------------------" << endl;
}

/// The function which returns the parity of each of the vars in
/// UserVariables.hpp The parity should be defined in the params file, and
/// will be output to the pout files for checking at start/restart of
/// simulation (It is only required for reflective boundary conditions.)
/// The function which returns the parity of each of the vars depending on the
// type. (It is only required for reflective boundary conditions.)
int BoundaryConditions::get_var_parity(int a_comp, int a_dir,
const VariableType var_type) const
{
Expand Down Expand Up @@ -354,6 +357,7 @@ void BoundaryConditions::fill_constraint_box(const Side::LoHiSide a_side,
fill_constant_cell(a_state, iv, a_side, idir, psi_comps,
0.0);

// TODO: Check if reinstating this improves solver?
// const extrapolating for V_i (means Aij = 0)
// int extrapolation_order = 0;
// fill_extrapolating_cell(a_state, iv, a_side, idir,
Expand Down Expand Up @@ -431,6 +435,8 @@ void BoundaryConditions::fill_boundary_cells_dir(
fill_constant_cell(out_box, iv, a_side, dir, psi_comps,
1.0);

// TODO: Again check if this changes things
// and if not remove
// int extrapolation_order = 0;
// fill_extrapolating_cell(out_box, iv, a_side, dir,
// Vi_comps,
Expand Down
Loading

0 comments on commit de20873

Please sign in to comment.