Getting Started¶
The following is simple example, broken down step-by-step, of running a structural simulation. The entire source file and the three required geometry files are available: beam geometry, restraint geometry, load geometry.
Include the Intact header¶
#include "Intact.hpp"
Create geometry¶
auto beam_geometry = Intact::MeshModel("beam.stl");
beam_geometry.instance_id = "simple_cantilever";
beam_geometry.refine(0.02); // refine stl for smoother visualization
Create material (material properties are in MKS unit system)¶
// Create steel material
auto material = std::make_shared<Intact::IsotropicMaterialDescriptor>();
material->density = 7800.0; // kg/m^3
material->poisson_ratio = 0.3;
material->youngs_modulus = 2.1e11; // Pa
Create restraints and loads¶
// Create a fixed boundary condition at one end of the beam
auto fixed_boundary = std::make_shared<FixedBoundaryDescriptor>();
fixed_boundary->boundary = Intact::MeshModel("restraint.stl");
// Create a pressure load at the free end of the beam
auto pressure_load = std::make_shared<PressureForceDescriptor>();
pressure_load->units = Intact::UnitSystem::MeterKilogramSecond;
pressure_load->magnitude = 1000; // Applying pressure in Pascals
pressure_load->boundary = Intact::MeshModel("load.stl");
Setup simulation and solve¶
// Setup the simulation scenario descriptor
Intact::LinearElasticScenarioDescriptor scenario;
scenario.boundary_conditions = {fixed_boundary, pressure_load};
scenario.metadata.resolution = 10000;
scenario.metadata.units = Intact::UnitSystem::MeterKilogramSecond;
scenario.materials = {{"Steel", material}};
// Associate the material with the model
auto component = Intact::MaterialDomain(beam_geometry, "Steel", scenario);
Intact::Assembly assembly = {component};
// Create the simulator and solve
Intact::StressSimulator simulator(assembly, scenario);
simulator.solve();
Query result and create output file to visualize¶
// Query results for stress distribution
Intact::QueryResult results(component);
Intact::FieldQuery stress_query(Intact::FieldType::VonMisesStress);
simulator.sample(stress_query, results);
// Write results to a file (unit system is saved as a metadata in the vtu file)
results.writeVTK("cantilever_beam_results.vtu", Intact::UnitSystem::MeterKilogramSecond);
For more detailed information, see the User Guide.