Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup: use pi constant #129

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CabanaPD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <CabanaPD_BodyTerm.hpp>
#include <CabanaPD_Boundary.hpp>
#include <CabanaPD_Comm.hpp>
#include <CabanaPD_Constants.hpp>
#include <CabanaPD_DisplacementProfile.hpp>
#include <CabanaPD_Fields.hpp>
#include <CabanaPD_Force.hpp>
Expand Down
24 changes: 24 additions & 0 deletions src/CabanaPD_Constants.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/****************************************************************************
* Copyright (c) 2022 by Oak Ridge National Laboratory *
* All rights reserved. *
* *
* This file is part of CabanaPD. CabanaPD is distributed under a *
* BSD 3-clause license. For the licensing terms see the LICENSE file in *
* the top-level directory. *
* *
* SPDX-License-Identifier: BSD-3-Clause *
****************************************************************************/

#ifndef CONSTANTS_H
#define CONSTANTS_H

#include "mpi.h"

namespace CabanaPD
{

// FIXME: Kokkos::numbers::pi_v<double> when minimum 4.0 is required.
constexpr double pi = M_PI;

} // namespace CabanaPD
#endif
4 changes: 2 additions & 2 deletions src/CabanaPD_Input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <nlohmann/json.hpp>

#include <CabanaPD_Constants.hpp>
#include <CabanaPD_Output.hpp>

namespace CabanaPD
Expand Down Expand Up @@ -125,8 +126,7 @@ class Inputs
double K = inputs["bulk_modulus"]["value"];
double delta = inputs["horizon"]["value"];
// FIXME: this is copied from the forces
double c =
18.0 * K / ( 3.141592653589793 * delta * delta * delta * delta );
double c = 18.0 * K / ( pi * delta * delta * delta * delta );

for ( int i = -( m + 1 ); i < m + 2; i++ )
{
Expand Down
3 changes: 2 additions & 1 deletion src/force/CabanaPD_ForceModels_PMB.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef FORCE_MODELS_PMB_H
#define FORCE_MODELS_PMB_H

#include <CabanaPD_Constants.hpp>
#include <CabanaPD_ForceModels.hpp>
#include <CabanaPD_Types.hpp>

Expand Down Expand Up @@ -48,7 +49,7 @@ struct ForceModel<PMB, Elastic, TemperatureIndependent> : public BaseForceModel
{
delta = _delta;
K = _K;
c = 18.0 * K / ( 3.141592653589793 * delta * delta * delta * delta );
c = 18.0 * K / ( pi * delta * delta * delta * delta );
streeve marked this conversation as resolved.
Show resolved Hide resolved
}
};

Expand Down
Loading