Skip to content
Snippets Groups Projects
Commit 64c573aa authored by Maltez Cavalheiro Kévin's avatar Maltez Cavalheiro Kévin
Browse files

test xcode

parent ac8387c7
No related branches found
No related tags found
1 merge request!6merge kevin branch
Lx = 5;
Ly = 2;
nx = 50;
ny = 20;
Point(1) = {0, 0, 0, 1.0};
Point(2) = {Lx, 0, 0, 1.0};
Point(3) = {Lx, Ly, 0, 1.0};
Point(4) = {0, Ly, 0, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Curve Loop(1) = {4, 1, 2, 3};
Plane Surface(1) = {1};
Transfinite Curve {3, 1} = nx+1 Using Progression 1;
Transfinite Curve {4, 2} = ny+1 Using Progression 1;
Transfinite Surface {1};
Recombine Surface {1}; // quads instead of triangles
Physical Curve("left_edge", 5) = {4};
Physical Surface("domain", 6) = {1};
Physical Curve("top_edge", 7) = {3};
Physical Curve("right_edge", 8) = {2};
// additional parameters given to the solver
SetNumber("Boundary Conditions/left_edge/ux", 0.); // HERE YOU DO NOT HAVE TO IMPOSE BOTH ux and uy simultaneously ! (permet aussi de simuler appuis à roulettes)
//SetNumber("Boundary Conditions/left_edge/uy", 0.);
SetNumber("Materials/domain/Young", 210e3);
SetNumber("Materials/domain/Poisson", 0.3);
SetNumber("Materials/domain/rho",7800); //volumic mass of acier
SetNumber("Boundary Conditions/top_edge/tx", 0.); // ALWAYS NEED TO IMPOSE BOTH tx AND ty ON A GIVEN EDGE (realiste, OK) !
SetNumber("Boundary Conditions/top_edge/ty", 0.); //set to some non-zero value to induce vertical deflection
SetNumber("Boundary Conditions/right_edge/tx", 21e3); // for simple tension conditions
SetNumber("Boundary Conditions/right_edge/ty", 0.);
SetNumber("Volumic Forces/domain/bx",0.);
SetNumber("Volumic Forces/domain/by",0.); //set to -9.81 for gravity
Lx = 10;
Ly = 10;
nx = 5;
ny = 5;
Point(1) = {0, 0, 0, 1.0};
Point(2) = {Lx, 0, 0, 1.0};
Point(3) = {Lx, Ly, 0, 1.0};
Point(4) = {0, Ly, 0, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Curve Loop(1) = {4, 1, 2, 3};
Plane Surface(1) = {1};
Transfinite Curve {3, 1} = nx+1 Using Progression 1;
Transfinite Curve {4, 2} = ny+1 Using Progression 1;
Transfinite Surface {1};
Recombine Surface {1}; // quads instead of triangles
Physical Curve("bottom_edge", 1) = {1};
Physical Curve("left_edge", 2) = {2};
Physical Surface("domain", 1) = {5};
Physical Curve("top_edge",3) = {3};
Physical Curve("right_edge", 4) = {4};
Physical Point("top_left", 1) = {6};
Physical Point("top_right", 2) = {7};
Physical Point("bottom_right", 3) = {8};
Physical Point("bottom_left", 4) = {9};
// additional parameters given to the solver
SetNumber("Boundary Conditions/left_edge/ux", 0.);
SetNumber("Boundary Conditions/left_edge/uy", 0.5);
SetNumber("Materials/domain/Young", 210e3);
SetNumber("Materials/domain/Poisson", 0.3);
SetNumber("Boundary Conditions/top_edge/tx", 0.);
SetNumber("Boundary Conditions/top_edge/ty", -100.);
\ No newline at end of file
......@@ -7,7 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
0AB1D63327CD086A00377C4A /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0AB1D63227CD086A00377C4A /* main.cpp */; };
0A58B92727CD961800EA98BB /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A58B92627CD961800EA98BB /* main.cpp */; };
0A85287E27D242F300D1C30F /* code_louis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A85287D27D242F300D1C30F /* code_louis.cpp */; };
0A85288827D2BF8500D1C30F /* code_kevin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A85288627D2BF8500D1C30F /* code_kevin.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -23,8 +25,14 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0AB1D62F27CD086A00377C4A /* test_bem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_bem; sourceTree = BUILT_PRODUCTS_DIR; };
0AB1D63227CD086A00377C4A /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
0A58B92627CD961800EA98BB /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
0A85287A27D22FD700D1C30F /* test_bem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = test_bem; sourceTree = BUILT_PRODUCTS_DIR; };
0A85287B27D242A400D1C30F /* rectangle.geo */ = {isa = PBXFileReference; lastKnownFileType = text; path = rectangle.geo; sourceTree = SOURCE_ROOT; };
0A85287C27D242F200D1C30F /* my_geo.geo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = my_geo.geo; sourceTree = "<group>"; };
0A85287D27D242F300D1C30F /* code_louis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = code_louis.cpp; sourceTree = "<group>"; };
0A85287F27D2433100D1C30F /* code_louis.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = code_louis.hpp; sourceTree = "<group>"; };
0A85288627D2BF8500D1C30F /* code_kevin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = code_kevin.cpp; sourceTree = "<group>"; };
0A85288727D2BF8500D1C30F /* code_kevin.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = code_kevin.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -42,22 +50,20 @@
isa = PBXGroup;
children = (
0AB1D63127CD086A00377C4A /* test_bem */,
0AB1D63027CD086A00377C4A /* Products */,
0A85287A27D22FD700D1C30F /* test_bem */,
);
sourceTree = "<group>";
};
0AB1D63027CD086A00377C4A /* Products */ = {
isa = PBXGroup;
children = (
0AB1D62F27CD086A00377C4A /* test_bem */,
);
name = Products;
sourceTree = "<group>";
};
0AB1D63127CD086A00377C4A /* test_bem */ = {
isa = PBXGroup;
children = (
0AB1D63227CD086A00377C4A /* main.cpp */,
0A85287B27D242A400D1C30F /* rectangle.geo */,
0A85287C27D242F200D1C30F /* my_geo.geo */,
0A58B92627CD961800EA98BB /* main.cpp */,
0A85287D27D242F300D1C30F /* code_louis.cpp */,
0A85287F27D2433100D1C30F /* code_louis.hpp */,
0A85288627D2BF8500D1C30F /* code_kevin.cpp */,
0A85288727D2BF8500D1C30F /* code_kevin.hpp */,
);
path = test_bem;
sourceTree = "<group>";
......@@ -79,7 +85,7 @@
);
name = test_bem;
productName = test_bem;
productReference = 0AB1D62F27CD086A00377C4A /* test_bem */;
productReference = 0A85287A27D22FD700D1C30F /* test_bem */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
......@@ -105,7 +111,7 @@
Base,
);
mainGroup = 0AB1D62627CD086A00377C4A;
productRefGroup = 0AB1D63027CD086A00377C4A /* Products */;
productRefGroup = 0AB1D62627CD086A00377C4A;
projectDirPath = "";
projectRoot = "";
targets = (
......@@ -119,7 +125,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0AB1D63327CD086A00377C4A /* main.cpp in Sources */,
0A85287E27D242F300D1C30F /* code_louis.cpp in Sources */,
0A58B92727CD961800EA98BB /* main.cpp in Sources */,
0A85288827D2BF8500D1C30F /* code_kevin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -241,7 +249,25 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
GCC_NO_COMMON_BLOCKS = NO;
HEADER_SEARCH_PATHS = (
"/usr/local/include/gmsh-4.9.5-MacOSX-sdk/include",
/usr/local/eigen/3.4.0_1/include/eigen3/,
);
LIBRARY_SEARCH_PATHS = (
"/usr/local/lib/gmsh-4.9.5-MacOSX-sdk/lib",
/usr/local/eigen/3.4.0_1/include/eigen3/,
);
OTHER_LDFLAGS = (
"-Xclang",
"-fopenmp",
"-O2",
"-g",
"-lgmsh",
"-DNDEBUG",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SYSTEM_HEADER_SEARCH_PATHS = /usr/local/;
};
name = Debug;
};
......@@ -249,7 +275,25 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
GCC_NO_COMMON_BLOCKS = NO;
HEADER_SEARCH_PATHS = (
"/usr/local/include/gmsh-4.9.5-MacOSX-sdk/include",
/usr/local/eigen/3.4.0_1/include/eigen3/,
);
LIBRARY_SEARCH_PATHS = (
"/usr/local/lib/gmsh-4.9.5-MacOSX-sdk/lib",
/usr/local/eigen/3.4.0_1/include/eigen3/,
);
OTHER_LDFLAGS = (
"-Xclang",
"-fopenmp",
"-O2",
"-g",
"-lgmsh",
"-DNDEBUG",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SYSTEM_HEADER_SEARCH_PATHS = /usr/local/;
};
name = Release;
};
......
......@@ -10,5 +10,13 @@
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>0AB1D62E27CD086A00377C4A</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
This diff is collapsed.
#include <gmsh.h> // gmsh main header
#include <iostream> // for cout
#include <map>
#include <sstream> // for stringstream
#include <Eigen/Dense> // Eigen library
#include <Eigen/Sparse> // Eigen library for sparse matrices (QUESTION: OK to use it ?)
#include <Eigen/SparseCholesky> // solving sparse linear systems (QUESTION: OK to use it ?)
#include <cmath>
using namespace std;
using namespace gmsh;
using namespace Eigen;
int code_simple(int argc, char **argv);
int code_kevin(int argc, char **argv);
void initialise_H_matrix(Matrix<double, 3, 3> &H_matrix, double nu, double E);
void initialisation(double &E,double &nu,double &rho,double &bx,double &by,map<string, pair<int, int>> &groups,vector<size_t> &all_nodeTags,vector<double> &all_nodecoord,vector<double> &all_nodeparametricCoord,vector<string> &keys);
int compute_K_matrix(vector<size_t> &all_nodeTags, map<string, pair<int, int>> &groups, string &integration_rule, double bx, double rho, double by, Matrix<double, 3, 3> &H_matrix, SparseMatrix<double> &full_K_matrix,vector<double> &full_f_vector, string groupname);
int boundary_conditions(vector<string> &keys, string &groupname, double &tx, double &ty, map<string, pair<int, int>> &groups, vector<int> &tags, string &integration_rule, vector<double> &full_f_vector);
int dirichlet(vector<int> &new_indices, vector<double> &dir_BC, vector<string> &keys, double &ux, double &uy, string &groupname, map<string, pair<int, int>> &groups, vector<int> &tags, int &number_removed_lines);
void filling(vector<size_t> &all_nodeTags, int &number_removed_lines, vector<int> &new_indices, SparseMatrix<double> &full_K_matrix, vector<double> &full_f_vector, vector<double> &dir_BC,SparseMatrix<double> &reduced_K_matrix,vector<double> &reduced_f_vector);
void reduce_system_solver(vector<size_t> &all_nodeTags, int &number_removed_lines, vector<double> &reduced_f_vector, SparseMatrix<double> &reduced_K_matrix, VectorXd &final_reduced_d, VectorXd &final_reduced_f);
void nodal_values(vector<double> &full_d_vector, vector<int> &new_indices, vector<double> &dir_BC, VectorXd &final_reduced_d);
void plot_and_save(vector<size_t> &all_nodeTags, vector<double> &full_d_vector, vector<string> &names);
void post_processing(string &integration_rule, vector<double> &full_d_vector, Matrix<double, 3, 3> &H_matrix, double &nu, double &E, vector<string> &names);
This diff is collapsed.
#include <gmsh.h> // gmsh main header
#include <iostream> // for cout
#include <map>
#include <sstream> // for stringstream
#include <Eigen/Dense> // Eigen library
#include <Eigen/Sparse> // Eigen library for sparse matrices (QUESTION: OK to use it ?)
#include <Eigen/SparseCholesky> // solving sparse linear systems (QUESTION: OK to use it ?)
#include <cmath>
using namespace std;
using namespace gmsh;
using namespace Eigen;
int code_louis(int argc, char **argv);
This diff is collapsed.
#include <gmsh.h> // gmsh main header
#include <iostream> // for cout
#include <map>
#include <sstream> // for stringstream
#include <Eigen/Dense> // Eigen library
#include <Eigen/Sparse> // Eigen library for sparse matrices (QUESTION: OK to use it ?)
#include <Eigen/SparseCholesky> // solving sparse linear systems (QUESTION: OK to use it ?)
#include <cmath>
using namespace std;
using namespace gmsh;
using namespace Eigen;
int code_simple(int argc, char **argv);
int code_louis_function(int argc, char **argv);
void initialise_H_matrix(Matrix<double, 3, 3> &H_matrix, double nu, double E);
void initialisation(double &E,double &nu,double &rho,double &bx,double &by,map<string, pair<int, int>> &groups,vector<size_t> &all_nodeTags,vector<double> &all_nodecoord,vector<double> &all_nodeparametricCoord,vector<string> &keys);
int compute_K_matrix(vector<size_t> &all_nodeTags, map<string, pair<int, int>> &groups, string &integration_rule, double bx, double rho, double by, Matrix<double, 3, 3> &H_matrix, SparseMatrix<double> &full_K_matrix,vector<double> &full_f_vector, string groupname);
int boundary_conditions(vector<string> &keys, string &groupname, double &tx, double &ty, map<string, pair<int, int>> &groups, vector<int> &tags, string &integration_rule, vector<double> &full_f_vector);
int dirichlet(vector<int> &new_indices, vector<double> &dir_BC, vector<string> &keys, double &ux, double &uy, string &groupname, map<string, pair<int, int>> &groups, vector<int> &tags, int &number_removed_lines);
void filling(vector<size_t> &all_nodeTags, int &number_removed_lines, vector<int> &new_indices, SparseMatrix<double> &full_K_matrix, vector<double> &full_f_vector, vector<double> &dir_BC,SparseMatrix<double> &reduced_K_matrix,vector<double> &reduced_f_vector);
void reduce_system_solver(vector<size_t> &all_nodeTags, int &number_removed_lines, vector<double> &reduced_f_vector, SparseMatrix<double> &reduced_K_matrix, VectorXd &final_reduced_d, VectorXd &final_reduced_f);
void nodal_values(vector<double> &full_d_vector, vector<int> &new_indices, vector<double> &dir_BC, VectorXd &final_reduced_d);
void plot_and_save(vector<size_t> &all_nodeTags, vector<double> &full_d_vector, vector<string> &names);
void post_processing(string &integration_rule, vector<double> &full_d_vector, Matrix<double, 3, 3> &H_matrix, double &nu, double &E, vector<string> &names);
//
// main.cpp
// test_bem
//
// Created by Maltez Cavalheiro Kévin on 28/02/2022.
//
#include <iostream>
int main(int argc, const char * argv[]) {
// insert code here...
std::cout << "Hello, World!\n";
#include <gmsh.h> // gmsh main header
#include <iostream> // for cout
#include <map>
#include <sstream> // for stringstream
#include <Eigen/Dense> // Eigen library
#include <Eigen/Sparse> // Eigen library for sparse matrices (QUESTION: OK to use it ?)
#include <Eigen/SparseCholesky> // solving sparse linear systems (QUESTION: OK to use it ?)
#include <cmath>
#include "code_louis.hpp"
#include "code_kevin.hpp"
using namespace std;
using namespace gmsh;
using namespace Eigen;
int main(int argc, char **argv)
{
code_kevin(argc,argv);
return 0;
}
Lx = 5;
Ly = 2;
nx = 50;
ny = 20;
Point(1) = {0, 0, 0, 1.0};
Point(2) = {Lx, 0, 0, 1.0};
Point(3) = {Lx, Ly, 0, 1.0};
Point(4) = {0, Ly, 0, 1.0};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Curve Loop(1) = {4, 1, 2, 3};
Plane Surface(1) = {1};
Transfinite Curve {3, 1} = nx+1 Using Progression 1;
Transfinite Curve {4, 2} = ny+1 Using Progression 1;
Transfinite Surface {1};
Recombine Surface {1}; // quads instead of triangles
Physical Curve("left_edge", 5) = {4};
Physical Surface("domain", 6) = {1};
Physical Curve("top_edge", 7) = {3};
Physical Curve("right_edge", 8) = {2};
// additional parameters given to the solver
SetNumber("Boundary Conditions/left_edge/ux", 0.); // HERE YOU DO NOT HAVE TO IMPOSE BOTH ux and uy simultaneously ! (permet aussi de simuler appuis à roulettes)
//SetNumber("Boundary Conditions/left_edge/uy", 0.);
SetNumber("Materials/domain/Young", 210e3);
SetNumber("Materials/domain/Poisson", 0.3);
SetNumber("Materials/domain/rho",7800); //volumic mass of acier
SetNumber("Boundary Conditions/top_edge/tx", 0.); // ALWAYS NEED TO IMPOSE BOTH tx AND ty ON A GIVEN EDGE (realiste, OK) !
SetNumber("Boundary Conditions/top_edge/ty", 0.); //set to some non-zero value to induce vertical deflection
SetNumber("Boundary Conditions/right_edge/tx", 21e3); // for simple tension conditions
SetNumber("Boundary Conditions/right_edge/ty", 0.);
SetNumber("Volumic Forces/domain/bx",0.);
SetNumber("Volumic Forces/domain/by",0.); //set to -9.81 for gravity
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment