Package: pyconmech
conmechconmechis a stiffness checker that performs elastic deformation analysis for 3D frame structures.
It is designed for construction sequencing applications, which involves testing
the partially assembled structure (subset of the element permutation) many times.For now,conmechonly supports first-order linear FEM simulations of 2D/3D frame structures
(similar to theAnalyzecomponent in Karamba),
but stay tune for a shell analysis backend coming soon ☕!conmechhas a high-performingC++backend (written in C++11 and wrapped friendly with Python viapybind11) and
a flexible, but less performativenumpybackend.🚧 TheC++backend is under development to keep up with the latest feature
implemented in thenumpybackend. Please use thenumpybackend until the next release.UsageInput modelThere are two ways to specify and input a structural model (geometry, material, cross sections, joint releases, support conditions, and loads)
to conmech:directly input data following class structures specified inpyconmech.frame_analysis.io_basewrite your data in aJSONformat and input the file path to conmech (Seefile examples here.The easiest way to generate the model JSON file by exporting from aKaramba3Dmodel inRhino-Grasshopper.
Aexample GH export fileis provided:You can also parse your model JSON file back to Rhino/GH for visualization/debugging by using theparse GH example file.AnalysisAfter you have the input model ready, analysis is straight-forward:frompyconmechimportStiffnessCheckersc=StiffnessChecker.from_json(json_file_path=frame_file_path,checker_engine="numpy",verbose=True)gravity_load=GravityLoad([0,0,-1])sc.set_loads(gravity_load=gravity_load)# if the structure's nodal deformation exceeds 1e-3 meter,# we want the checker to return `sol_success = False`trans_tol=1e-3sc.set_nodal_displacement_tol(trans_tol=trans_tol)# existing elements' indicesexisting_ids=[0,4,88,6]# False if the analysis resultsol_success=sc.solve(existing_ids)# Get all the analysis information:# nodal deformation, fixity reactions, element reactionssuccess,nD,fR,eR=sc.get_solved_results()Seepython unit testsfor more examples.Installationpython -m pip install pyconmech --user
# or python3 if default python is 2.x (OSX or Linux)
# try the following flags when updating: --user --upgrade --forceBuild from sourceBuild python bindingsPrerequisitesThe following dependencies come from pybind11 for building the python wrappers.On Unix (Linux, OS X)A compiler with C++11 supportCMake >= 3.1On WindowsVisual Studio 2015 (required for all Python versions, see notes below)CMake >= 3.1Then, clone this repository and pip install.cd conmech
python -m pip install .
# or python3 if default python is 2.x (OSX or Linux)
# try the following flags when updating: --user --upgrade --forceWith thesetup.pyfile included in the base folder, the pip install command will invoke CMake and build the pybind11 module as specified in CMakeLists.txt.Note:conmech’s python bindings are built with a CMake-based build system via pybind11.
Take a look atcmake_example for pybind11if you want to learn more about this.conmechdepends onEigenfor linear algebra
andnlohmann::jsonfor json (de-)serialization, both of which are handled automatically by cmake for downloading.Build C++ codemkdir build
cd build
cmake ..
make -j2 # UnixOr on Windows, replace the last line withcmake --build .ReferencesCreditsYijiang Huang. Conmech.https://pypi.org/project/pyconmech/. 2020.This package was initiated and maintained by Yijiang Huang@yijianghand othercontributors.ReferencesThe following textbook is an excellent resource for learning 2D/3D truss/frame analysis, many ofconmech’s unit tests are using examples in this textbook as analytical benchmarks:McGuire, W., R. H. Gallagher, and R. D. Ziemian. “Structural Analysis, Title: Matrix Structural Analysis.” (2015).Related reposFrame3dd: A static and dynamic structural analysis software of 2D and 3D frames and trusses with elastic and geometric stiffness written inC.ChangelogAll notable changes to this project will be documented in this file.The format is based onKeep a Changelogand this project adheres toSemantic Versioning.0.6.0addedAddedkaramba_iomodule to facilitateKaramba3d-JSONtwo way conversion.AddedModelandLoadCaseclassesAdded element information toValueErrorwhen encountering zero-length line elementAdded print out attributes toNodeandElementchangedChangedStiffnessBase’s__init__from inputtingnodes, elements, …toModelMovedget_element_crossecandget_element_materialfromNumpyStiffnesstoStiffnessBaseChangedStiffnessChecker’sset_loadsto takeLoadCaseobjectChangedJoint’sc_conditionsattribute to a 12-entry list instead of a dictionary with two six-entry listsKaramba conversion is now done more formally withkaram_iomodules, without using an ad-hoc C# component.removedfixed0.5.0addedadded thenumpyengineadded removing loads functionality by passing innoneadded base classes for input data:io_base.node, element, support, joint, material, crosssec, pointload, etc.changedchanged frame data format, use karamba exported formatchangedstiffnesschecker’s__init__function’s arguments to takeio_base.*datachangedstiffnesschecker’s default behavior: not applying gravity load by defaultchanged-dconmech_build_tests=offinsetup_cmake_utils.pyto disable cpp test building inpython setup.py buildremovedfixedchanged0.4.0AddedAddedStiffnessCheckerclass method, directly construct from frame data, without saving data to a temp jsonAdded some initial cpp unit tests, test data fed in by CMake and tests organized byCatch2ChangedChangedrapidjsontonlohmann::jsonRemovedRemoved theFramedata structure in Stiffness checker’s cpp backendRemoved all the git submodule and used CMake download external insteadFixedFixed the memory leak caused by the smart pointer cycle dependency inFrame0.3.1AddedAdded unit tests forstd::throwin parsing material properties0.3.0ChangedChangedtry/catchin the C++ file parsing tostd::throw0.2.0ChangedThe originalstiffness_checkerextension module is wrapper as_stiffness_checker.
All the cpp modules are wrapper under a top-level python classes/functions, to give more
flexibility.API change:stiffness_checkerclass is renamed toStiffnessCheckerto conformto the class naming convention. All other APIs within this class are left unchanged.Deleteradiusentry frommaterial_properties.Addeddocumentation is hosted on readthedocs!add grasshopper examples - parse/save files, karamba comparsion, solve/get result in GH via ghpython-remotesupports material / cross sectional properties for each element.supports uniformly distributed loadadd gravity magnitude and direction0.1.0Initial version