Skip to content

Commit

Permalink
Use std::map for shape factors
Browse files Browse the repository at this point in the history
  • Loading branch information
RShaw026 committed Jan 18, 2024
1 parent 3b0ced5 commit 144f1ed
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/mirco_setparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_RCP.hpp>
#include <Teuchos_XMLParameterListHelpers.hpp>
#include <map>
#include <string>
#include <vector>

Expand Down Expand Up @@ -60,15 +61,16 @@ void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double&
// The following pressure based constants are calculated by solving a flat indentor problem using
// the pressure based Green function described in Pohrt and Li (2014).
// http://dx.doi.org/10.1134/s1029959914040109
const std::vector<double> shape_factors_pressure{0.961389237917602, 0.924715342432435,
0.899837531880697, 0.884976751041942, 0.876753783192863, 0.872397956576882, 0.871958228537090,
0.882669916668780};
const std::map<int, double> shape_factors_pressure{{1, 0.961389237917602}, {2, 0.924715342432435},
{3, 0.899837531880697}, {4, 0.884976751041942}, {5, 0.876753783192863},
{6, 0.872397956576882}, {7, 0.871958228537090}, {8, 0.882669916668780}};

// The following force based constants are taken from Table 1 of Bonari et al. (2020).
// https://doi.org/10.1007/s00466-019-01791-3
const std::vector<double> shape_factors_force{0.778958541513360, 0.805513388666376,
0.826126871395416, 0.841369158110513, 0.851733020725652, 0.858342234203154, 0.862368243479785,
0.864741597831785};
const std::map<int, double> shape_factors_force{{1, 0.778958541513360}, {2, 0.805513388666376},
{3, 0.826126871395416}, {4, 0.841369158110513}, {5, 0.851733020725652},
{6, 0.858342234203154}, {7, 0.862368243479785}, {8, 0.864741597831785}};


// Setting up the geometrical parameters.
Teuchos::ParameterList& geoParams =
Expand All @@ -83,11 +85,11 @@ void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double&

if (PressureGreenFunFlag)
{
ShapeFactor = shape_factors_pressure[Resolution - 1];
ShapeFactor = shape_factors_pressure.at(Resolution);
}
else
{
ShapeFactor = shape_factors_force[Resolution - 1];
ShapeFactor = shape_factors_force.at(Resolution);
}

ElasticComplianceCorrection = LateralLength * CompositeYoungs / ShapeFactor;
Expand Down

0 comments on commit 144f1ed

Please sign in to comment.