Closed MJDHD closed 5 months ago
Hello,
Thank you for your interest in using this code. Have you tried to run the simple tension test using the .msh and input files provided in this repository? Best,
Tao
Also, the lower left corner should be (0, 0), the right upper corner should be (1, 1), the tip of the preexisting crack should be (0.5, 0.5). Another thing that I could think of is related to the function make_grid_case_3() in the code: """ if (m_parameters.m_refinement_strategy == "pre-refine") { unsigned int material_id; double length_scale; for (unsigned int i = 0; i < m_parameters.m_local_prerefine_times; i++) { for (const auto &cell : m_triangulation.active_cell_iterators()) { if ( (std::fabs(cell->center()[1] - 0.5) < 0.025) && (cell->center()[0] > 0.475) ) { material_id = cell->material_id(); length_scale = m_material_data[material_id][2]; if ( std::sqrt(cell->measure())
length_scale * m_parameters.m_allowed_max_h_l_ratio ) cell->set_refine_flag(); } } m_triangulation.execute_coarsening_and_refinement(); } } """ You might want to adjust the two numbers "0.025" and "0.475" to make sure that the mesh around the preexisting crack tip is refined, particularly if your initial mesh is relatively coarse. Best,
Tao
Dear Mr. Tao: Thank you so much for your kind reply. Finally I successfully ran the code with my own .msh file. I've checked many aspects and I'm not sure which made the crucial effect so I just list them here as a reminder if anybody is faced with the same error like me.
chmod 766 your_file_name
beacuse the initial .msh file from Gmsh seems to be '-rw-rw-r--', which means I have no permission to execute it.Hello,
Thanks for providing the information.
Regarding the second point: "When using Gmsh and in the Geometry module, users are supposed to add physical groups to surfaces with tag 1. I don't why it should be done like this but it surprisingly worked after I did this. This step will make sure the .msh file only contain surface elements." Yes, we need to define the whole region as a "Physical Surface" in gmsh and assign it with tag "1". For instance, in the *.geo file, include the following line """ Physical Surface(1) = {4, 3, 2, 1}; """ This is because the main.cc contains the function "read_material_data()". This function will read the material data from the file "materialDataFile" and assign the material data to the domain. For instance, the "materialDataFile" contains the following line: 1 121.15 80.77 0.0075 2.7e-3 0.0e-6 0.0e-9 The first number 1 represents the region number "1", which should be consistent with tag number in the gmsh "Physical Surface".
If you have two different material regions, what you can do is to have two separate lines in "materialDataFile", such as, 1 121.15 80.77 0.0075 2.7e-3 0.0e-6 0.0e-9 2 121.15 80.77 0.0075 2.7e-3 0.0e-6 0.0e-9
Then, in your gmsh file, you should define two "Physical Surface" and give them the tags 1 and 2.
Best,
Tao
In the read_material_data() function: """ if (myfile.is_open()) { m_logfile << "Reading material data file ..." << std::endl;
while ( myfile >> material_region
>> lame_lambda
>> lame_mu
>> length_scale
>> gc
>> viscosity
>> residual_k)
{
m_material_data[material_region] = {lame_lambda,
lame_mu,
length_scale,
gc,
viscosity,
residual_k};
""" It tells you the meaning of each parameter in the "materialDataFile".
Best,
Tao
Dear Mr. Tao: Thank you so much for your warm and clear explanation. Now I figure out the reason.
You are welcome.
Dear Mr. Tao Jin: I'm trying to running the code with my own .msh file. I totally drew the geometrically identical graph with pre-existing crack by using built-in kernal Gmsh 4.12.2, and divided it into a 24*24 grid, but it didn't work for me when trying to run the code with my own .msh file.The terminal either reported an error or displayed "Segmentation fault (core dumped)". I just want to know if there's anything need to be noticed when exporting the .msh file from Gmsh. By the way I could provide my .geo file and .msh file if necessary. Thanks in advance if you could kindly answer my question.