Creating MPM Materials

From OSUPDOCS
Revision as of 11:40, 4 December 2013 by Nairnj (talk | contribs) (Created page with "This section explains how to write <tt>C++</tt> code create a new material class for use in NairnMPM. == Getting Started == The first steps are to add a new class to Nai...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This section explains how to write C++ code create a new material class for use in NairnMPM.

Getting Started

The first steps are to add a new class to NairnMPM and to allow input command files to use that material. These steps involve creating the source code and some editing of the core code to add the new material class.

Class Source Code

The best way to create the source code is to duplicate the NewMaterial.cpp and NewMaterial.hpp files, which are templates for a new material class. Edit the files and change NewMaterial to the new material's class name. This template is a subclass of MaterialBase. Normally the new material will be a subclass of another class. If so, change MaterialBase references, as needed, to the actual parent class. These changes are needed whenever a method in the new material class needs to pass control to its immediate super class.

Material Class Hierarchy

The following outline shows all materials in nairn-mpm-fea as a class hierarchy. Materials in UPPERCASE are actual materials. Materials in mixed case are abstract classes. Materials in green are in both FEA and MPM; materials in red are only in FEA; all the rest are only in MPM. The new material should be inserted into this hierarchy and it should define a new, unique constant (in UPPERCASE) for that material. The current materials use numbers low numbers (starting with 1); those working on custom materials should probably use large number (>100). This new constant should replace the NEWMATERIAL constant in the new .hpp.