Program used to assemble the rigidity matrix and the vectors of a linear, homogeneous elasticity model with a traction applied to
face.
26 std::vector<double> traction_density(3,0);
27 traction_density[0] = 100.;
30 libMesh::LibMeshInit init(argc, argv);
33 const bool MASTER_bPerfLog_carl_libmesh =
true;
34 libMesh::PerfLog perf_log(
"Main program", MASTER_bPerfLog_carl_libmesh);
37 libMesh::Parallel::Communicator& WorldComm = init.comm();
40 int rank = WorldComm.rank();
41 int nodes = WorldComm.size();
46 GetPot command_line(argc, argv);
52 std::string input_filename;
53 if (command_line.search(2,
"--inputfile",
"-i")) {
54 input_filename = command_line.next(input_filename);
55 field_parser.parse_input_file(input_filename,
"#",
"\n",
" \t\n");
57 field_parser = command_line;
64 const unsigned int dim = 3;
66 libmesh_example_requires(dim == LIBMESH_DIM,
"3D support");
71 perf_log.push(
"Meshes - Parallel",
"Read files:");
72 libMesh::Mesh system_mesh(WorldComm, dim);
74 system_mesh.prepare_for_use();
76 libMesh::Mesh mesh_weight(WorldComm, dim);
77 mesh_weight.allow_renumbering(
false);
79 mesh_weight.prepare_for_use();
81 perf_log.pop(
"Meshes - Parallel",
"Read files:");
84 perf_log.push(
"System setup:");
87 libMesh::EquationSystems equation_systems(system_mesh);
90 libMesh::LinearImplicitSystem& elasticity_system
94 equation_systems.init();
103 perf_log.pop(
"System setup:");
111 #ifdef PRINT_MATLAB_DEBUG
112 elasticity_system.matrix->print_matlab(input_params.
output_base +
"_sys_mat.m");
113 elasticity_system.rhs->print_matlab(input_params.
output_base +
"_sys_rhs_vec.m");
117 libMesh::PetscMatrix<libMesh::Number> * temp_mat_ptr = libMesh::cast_ptr<libMesh::PetscMatrix<libMesh::Number> * >(elasticity_system.matrix);
118 libMesh::PetscVector<libMesh::Number> * temp_vec_ptr = libMesh::cast_ptr<libMesh::PetscVector<libMesh::Number> * >(elasticity_system.rhs);
126 MatNullSpace nullsp_sys;
129 MatNullSpaceDestroy(&nullsp_sys);
133 }
void set_homogeneous_physical_properties(libMesh::EquationSystems &es, std::string &physicalParamsFile)
Set the homogeneous physical properties from a file.
void write_rigid_body_vectors(MatNullSpace &nullsp_sys, const std::string output_base, int rank)
Export the rigid body mode vectors to a folder.
void get_input_params(GetPot &field_parser, feti_iterate_params &input_params)
Parser function for the coupled solver test programs.
void assemble_elasticity_with_weight_and_traction(libMesh::EquationSystems &es, const std::string &system_name, weight_parameter_function &weight_mask, WeightFunctionSystemType system_type, int traction_boundary_id, std::vector< double > traction_density)
Assemble homogeneous elasticity with domain weights and traction.
void write_PETSC_vector(libMesh::PetscVector< libMesh::Number > &input_vec, const std::string &filename, int dim=1)
void build_rigid_body_vectors(libMesh::ImplicitSystem &input_system, MatNullSpace &nullsp_sys)
Build the rigid body modes associated to a given system.
libMesh::ImplicitSystem & add_elasticity(libMesh::EquationSystems &input_systems, libMesh::Order order=libMesh::FIRST, libMesh::FEFamily family=libMesh::LAGRANGE)
Add a linear elasticity libMesh::LinearImplicitSystem to the input libMesh::EquationSystems& input_sy...
void write_PETSC_matrix(Mat input_mat, const std::string &filename, int rank, MPI_Comm comm=PETSC_COMM_WORLD, int dim=1)