Skip to content

Commit

Permalink
Add documentation and use const for the shape factors
Browse files Browse the repository at this point in the history
  • Loading branch information
RShaw026 committed Jan 18, 2024
1 parent 023f4ac commit 3b0ced5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ int main(int argc, char* argv[])

bool WarmStartingFlag = false;
int Resolution = 0;
double nu1 = 0.0, nu2 = 0.0, CompositeYoungs = 0.0, CompositePoissonsRatio = 0.0, alpha = 0.0,
ElasticComplianceCorrection = 0.0, GridSize = 0.0, Tolerance = 0.0, E1 = 0.0, E2 = 0.0,
LateralLength = 0.0, Delta = 0.0;
double nu1 = 0.0, nu2 = 0.0, CompositeYoungs = 0.0, CompositePoissonsRatio = 0.0,
ShapeFactor = 0.0, ElasticComplianceCorrection = 0.0, GridSize = 0.0, Tolerance = 0.0,
E1 = 0.0, E2 = 0.0, LateralLength = 0.0, Delta = 0.0;
bool RandomTopologyFlag = false;
bool RandomSeedFlag = false;
double Hurst = 0.0;
Expand All @@ -33,9 +33,9 @@ int main(int argc, char* argv[])
bool PressureGreenFunFlag = false;

MIRCO::SetParameters(E1, E2, LateralLength, nu1, nu2, CompositeYoungs, CompositePoissonsRatio,
alpha, ElasticComplianceCorrection, GridSize, Tolerance, Delta, TopologyFilePath, Resolution,
InitialTopologyStdDeviation, inputFileName, RandomTopologyFlag, Hurst, RandomSeedFlag,
RandomGeneratorSeed, WarmStartingFlag, MaxIteration, PressureGreenFunFlag);
ShapeFactor, ElasticComplianceCorrection, GridSize, Tolerance, Delta, TopologyFilePath,
Resolution, InitialTopologyStdDeviation, inputFileName, RandomTopologyFlag, Hurst,
RandomSeedFlag, RandomGeneratorSeed, WarmStartingFlag, MaxIteration, PressureGreenFunFlag);

// Identical Vectors/Matricies, therefore only created one here.
int ngrid = int(ceil((LateralLength - (GridSize / 2)) / GridSize));
Expand Down
26 changes: 15 additions & 11 deletions src/mirco_setparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "mirco_filesystem_utils.h"

void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double& nu1, double& nu2,
double& CompositeYoungs, double& CompositePoissonsRatio, double& alpha,
double& CompositeYoungs, double& CompositePoissonsRatio, double& ShapeFactor,
double& ElasticComplianceCorrection, double& GridSize, double& Tolerance, double& Delta,
std::string& TopologyFilePath, int& Resolution, double& InitialTopologyStdDeviation,
const std::string& inputFileName, bool& RandomTopologyFlag, double& Hurst, bool& RandomSeedFlag,
Expand Down Expand Up @@ -51,19 +51,23 @@ void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double&
// Composite Poisson's ratio
CompositePoissonsRatio = CompositeYoungs / (2 * CompositeShear) - 1;

// Correction factor vectors
// These are the correction factors to calculate the elastic compliance of the micro-scale contact
// constitutive law for various resolutions.
// Shape factors (See section 3.3 of https://doi.org/10.1007/s00466-019-01791-3)
// These are the shape factors to calculate the elastic compliance correction of the micro-scale
// contact constitutive law for various resolutions.
// NOTE: Currently MIRCO works for resouluion of 1 to 8. The following vectors store the shape
// factors for resolution of 1 to 8.

// 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
std::vector<double> alpha_con_pressure{0.961389237917602, 0.924715342432435, 0.899837531880697,
0.884976751041942, 0.876753783192863, 0.872397956576882, 0.871958228537090,
const std::vector<double> shape_factors_pressure{0.961389237917602, 0.924715342432435,
0.899837531880697, 0.884976751041942, 0.876753783192863, 0.872397956576882, 0.871958228537090,
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
std::vector<double> alpha_con_force{0.778958541513360, 0.805513388666376, 0.826126871395416,
0.841369158110513, 0.851733020725652, 0.858342234203154, 0.862368243479785,
const std::vector<double> shape_factors_force{0.778958541513360, 0.805513388666376,
0.826126871395416, 0.841369158110513, 0.851733020725652, 0.858342234203154, 0.862368243479785,
0.864741597831785};

// Setting up the geometrical parameters.
Expand All @@ -79,13 +83,13 @@ void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double&

if (PressureGreenFunFlag)
{
alpha = alpha_con_pressure[Resolution - 1];
ShapeFactor = shape_factors_pressure[Resolution - 1];
}
else
{
alpha = alpha_con_force[Resolution - 1];
ShapeFactor = shape_factors_force[Resolution - 1];
}

ElasticComplianceCorrection = LateralLength * CompositeYoungs / alpha;
ElasticComplianceCorrection = LateralLength * CompositeYoungs / ShapeFactor;
GridSize = LateralLength / (pow(2, Resolution) + 1);
}

0 comments on commit 3b0ced5

Please sign in to comment.