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

Add correction factors for pressure-based Green function #90

Merged
merged 4 commits into from
Jan 18, 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
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
39 changes: 32 additions & 7 deletions src/mirco_setparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
#include <Teuchos_ParameterList.hpp>
#include <Teuchos_RCP.hpp>
#include <Teuchos_XMLParameterListHelpers.hpp>
#include <map>
#include <string>
#include <vector>

#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,10 +52,25 @@ void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double&
// Composite Poisson's ratio
CompositePoissonsRatio = CompositeYoungs / (2 * CompositeShear) - 1;

// Correction factor vector
std::vector<double> alpha_con{0.778958541513360, 0.805513388666376, 0.826126871395416,
0.841369158110513, 0.851733020725652, 0.858342234203154, 0.862368243479785,
0.864741597831785};
// 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 map store the shape
// factors for resolution of 1 to 8.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively you could use a map here, something like

const std::map<int, double> shape_factors_presure{{1,0.961389237917602},{2,0.924715342432435},...};

Then you can access the data with shape_factors_pressure[Resolution] instead of shape_factors_pressure[Resolution - 1], i.e., you map a resolution value to a pressure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the map proposal. It makes the assignment of resolution to the value very explicit.


// 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::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::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 @@ -66,7 +82,16 @@ void MIRCO::SetParameters(double& E1, double& E2, double& LateralLength, double&
InitialTopologyStdDeviation = geoParams.get<double>("InitialTopologyStdDeviation");
Tolerance = geoParams.get<double>("Tolerance");
Delta = geoParams.get<double>("Delta");
alpha = alpha_con[Resolution - 1];
ElasticComplianceCorrection = LateralLength * CompositeYoungs / alpha;

if (PressureGreenFunFlag)
{
ShapeFactor = shape_factors_pressure.at(Resolution);
}
else
{
ShapeFactor = shape_factors_force.at(Resolution);
}

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