11#ifndef INP_CONTACTPAIRDECK_H
12#define INP_CONTACTPAIRDECK_H
71 bool dampingOn =
true,
bool frictionOn =
true,
72 double Kn = 0.,
double eps = 1.,
double mu = 0.,
73 double KnFactor = 1.,
double betanFactor = 1.,
74 double deltaMax = 1.,
double vMax = 0.)
99 bool dampingOn =
true,
bool frictionOn =
true,
100 double Kn = 0.,
double eps = 1.,
double mu = 0.,
101 double KnFactor = 1.,
double betanFactor = 1.,
102 double deltaMax = 1.,
double vMax = 0.,
double K = 0.) {
106 if (computeContactR) {
107 if (contactR < 1E-10) {
108 throw std::runtime_error(
"Conctar radius factor can not be zero.");
110 j[
"Contact_Radius_Factor"] = contactR;
112 j[
"Contact_Radius"] = contactR;
116 if (vMax < 1.E-10)
throw std::runtime_error(
"Need V_Max parameter for contact force.");
117 else j[
"V_Max"] = vMax;
119 if (deltaMax < 1.E-10) deltaMax = 1.;
120 j[
"Delta_Max"] = deltaMax;
125 if (dampingOn and betanFactor < 1.E-10) dampingOn =
false;
126 if (!dampingOn) betanFactor = 0.;
128 if (frictionOn and mu < 1.E-10) {
129 throw std::runtime_error(
"Friction coefficient can not be zero.");
135 j[
"Damping_On"] = dampingOn;
138 j[
"Friction_On"] = frictionOn;
139 j[
"Friction_Coeff"] = mu;
141 j[
"Kn_Factor"] = KnFactor;
142 j[
"Beta_n_Factor"] = betanFactor;
155 if (j.find(
"Contact_Radius_Factor") != j.end()) {
159 if (j.find(
"Contact_Radius") == j.end())
160 throw std::runtime_error(
"Need Contact_Radius or Contact_Radius_Factor.");
166 if (j.find(
"Kn") != j.end()) {
171 if (j.find(
"V_Max") == j.end())
throw std::runtime_error(
"V_Max is needed for contact.");
179 d_eps = j.value(
"Epsilon", 1.);
188 d_mu = j.value(
"Friction_Coeff", 0.);
189 d_K = j.value(
"K", 0.);
192 throw std::runtime_error(
"Friction coefficient can not be zero.");
195 throw std::runtime_error(
"Bulk modulus can not be zero.");
207 std::string
printStr(
int nt = 0,
int lvl = 0)
const {
209 std::ostringstream oss;
210 oss << tabS <<
"------- ContactPairDeck --------" << std::endl << std::endl;
211 oss << tabS <<
"Contact radius = " <<
d_contactR << std::endl;
213 <<
", Kn = " <<
d_Kn << std::endl;
214 oss << tabS <<
"epsilon = " <<
d_eps <<
", Beta_n = " <<
d_betan << std::endl;
215 oss << tabS <<
"Friction coefficient = " <<
d_mu << std::endl;
216 oss << tabS <<
"Damping status = " <<
d_dampingOn << std::endl;
219 oss << tabS <<
"Bulk modulus = " <<
d_K << std::endl;
220 oss << tabS << std::endl;
230 void print(
int nt = 0,
int lvl = 0)
const { std::cout <<
printStr(nt, lvl); }
nlohmann::ordered_json json
Collection of methods and database related to input.
std::string getTabS(int nt)
Returns tab spaces of a given size.