|
|
|
|
|
## main.cc
|
|
|
|
|
|
| **command**| **description**|
|
|
|
|:-----------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------|
|
|
|
| `int main(int argc, char *argv[]){ ` | main function. |
|
|
|
| `DamageTestParam test_param;` | an object to dispatch parameters. |
|
|
|
| `DamageTestContext<DamageTestMesh> driver(argc,argv,test_param);` | an object to drive the TLS problem. `DamageTestMesh` is for classical mesh problem (gmsh). For octree mesh, use `DamageTestOctree` |
|
|
|
| `xParseData & damageinfo = test_param.getDamParam();` | parse the file *damageinfo.dat * . |
|
|
|
| `DamageTestParam test_param;` | an object to transfer parameters from the main to the TLS solver. |
|
|
|
| `DamageTestContext<DamageTestMesh> driver(argc,argv,test_param);` | an object to drive the TLS solver. `DamageTestMesh` is for classical mesh problem (gmsh). For octree mesh, use `DamageTestOctree` . This call to the constructor read option given in argument and usually main.dat/damageinfo.dat files . It have a extra defaulted argument (not visible here) which correspond to usual interpretation of argument when launching the program. With some test an extra option reader is used to pass specific argument to the program. |
|
|
|
| `xParseData & damageinfo = test_param.getDamParam();` | Retrieve xParseData instance corresponding to damageinfo.dat information . |
|
|
|
| ` double distance_L = 0.6 ` | some geometrical parameters (dimension of the model) that can not be evaluated easily automatically. |
|
|
|
| `double ouverture_damage= driver.getDamageOpening();` | if the initial opening is needed, it can be evaluate with the function `getDamageOpening()` |
|
|
|
| `double lc = damageinfo.getDouble("lc");` | return a parameter read by the parser. |
|
|
|
| `xAcceptRangeXY filterF(xmid-distance_c/2.,xmid+distance_c/2.,distance_h+distance_c-epsilon,distance_h+distance_c+epsilon);` | create a filter to evaluate a mean displacement on a physical zone ( will be a parameter of `curveWriter` below). |
|
|
|
| `test_param.setRefLoadFactor(distance_c * specimen_thickness);` | resize the reference load factor, here for 2D problem : pressure has to be converted to force. |
|
|
|
| `curveWriter effdep(filterF);` | declaration of an output curve: the definition of `curveWriter` is given in the *main.h*. |
|
|
|
| `// test_param.setCurveWriter(effdep);` | set the CurveWriter objet to the driver of the TLS problem. |
|
|
|
| `xPointToDouble initial_crack=xOppositeP2Double(xSphere(mPoint(xmid , 0.,0.), ouverture_damage));` | declare an initial level set: it must be a pre-damaged zone or a fictivious zone, but the declaration is mandatory. |
|
|
|
| `test_param.setLsInDef(initial_crack);` | set the initial level set to the driver of the TLS problem. |
|
|
|
| `mPoint point1(xmid-distance_a/2.,0.,0.);` | create two points arround the crack lips to evaluate the opening (if the initiation zone is known a fortiori) |
|
|
|
| `curveWriter effdep(filterF);` | declaration of output curves : the definition of `curveWriter` is given in the *main.h*. |
|
|
|
| `test_param.setCurveWriter(effdep);` | transfer the CurveWriter objet to the TLS solver. |
|
|
|
| `xPointToDouble initial_crack=xOppositeP2Double(xSphere(mPoint(xmid , 0.,0.), ouverture_damage));` | declare an initial signed distance function as a xPointToDouble instance (function object that give an operator wich take a geometric position and return a value): it must be a pre-damaged zone or a fictivious zone, but the declaration is mandatory.. |
|
|
|
| `test_param.setLsInDef(initial_crack);` | transfer the initial level set to the TLS solver. It is mandatory. |
|
|
|
| `mPoint point1(xmid-distance_a/2.,0.,0.);` | create two points arround the crack lips to evaluate the opening (if the initiation zone is known a priori) |
|
|
|
| `mPoint point2(xmid+distance_a/2.,0.,0.);` | - |
|
|
|
| `std::map < int, Trellis_Util::mPoint > points;` | declaration of a `map` of point. This map will be a parameter of ` xeExportSensors sensors` below. |
|
|
|
| `points[0] = point1;` | - |
|
|
|
| `points[1] = point2;` | - |
|
|
|
| `xeExportSensors sensors(0, points);` | declaration of a sensor in the first direction (x) = direction 0 |
|
|
|
| `double young_modulus = 0.;` | material parameters must be set in the main file. The main.dat is not used at now. |
|
|
|
| `xeExportSensors sensors(0, points);` | declaration of a sensor in the first direction (x) = direction 0 |
|
|
|
| ` test_param.setSensors(sensors);` | transfer the sensor instance to the TLS solver so that CurveWriter may compute expected information. |
|
|
|
| `double young_modulus = 0.;` | material parameters that will be read from a file(see below). |
|
|
|
| `double poisson = 0.;` | - |
|
|
|
| `readYoungPoisson("data/matrix.mat", young_modulus, poisson);` | after declaration, the parameters are read in a file. For multiple material problem, this had to be done as such as their are materials. |
|
|
|
| `readYoungPoisson("data/matrix.mat", young_modulus, poisson);` | after declaration, the parameters are read from a file (with a .mat extension in general). For multiple material problem, this had to be done as many time as their are materials. |
|
|
|
| `xEvalConstant < double > eval_Yc(damageinfo.getDouble("Yc"));` | declare a evaluator for the energy release rate of the material, initialized with the parameter given in the *damageinfo.dat* |
|
|
|
| `xEvalYoungModulus eval_young(young_modulus);` | the same for the Young modulus . The definition of the `xEvalYoungModulus ` is given in the `main.h`. |
|
|
|
| `xEvalConstant < double > eval_poisson(poisson);` | the same for the Poisson ratio |
|
|
|
| `test_param.setCaractEval(eval_young,eval_poisson,eval_Yc);` | set the evaluators to the driver of the TLS problem. |
|
|
|
| `driver.init_test();` | initialize the TLS problem. |
|
|
|
| `river.run_test();` | run the TLS problem. |
|
|
|
| `river.end_test();` | end the TLS problem. |
|
|
|
| `test_param.setCaractEval(eval_young,eval_poisson,eval_Yc);` | transfer evaluators to the TLS solver. |
|
|
|
| `driver.init_test();` | initialize the TLS solver. |
|
|
|
| `river.run_test();` | run the TLS solver. |
|
|
|
| `river.end_test();` | end the TLS solver. |
|
|
|
| `} ` | - |
|
|
|
|
|
|
|