Material initialization

This function is called during the initialization phase of the simulation. You can use it to set up any necessary data structures or perform other initialization tasks, such as the inital state of the material and, if required, calculate material parameters.

This intialization function is called for both CPU and GPU implementations. Future implementations will enable the runInitGPU function when utilizing GPU acceleration.

runInit()

void runInit(UserMatInitCPU data) const

data

Example

void MatMetal::runInit(UserMatInitCPU data) const
{
    double young = data.p_cmat[1];
    double pr    = data.p_cmat[2];
    double bulk  = young / (3.0 * (1.0 - 2.0 * pr));
    double G     = young / (2.0 * (1.0 + pr));

    // Set material properties
    data.p_cmat[43] = bulk;

    // Stress-strain curve
    int idlc = static_cast<int>(round(data.p_cmat[6]));

    // Yield stress
    double sigy0 = data.p_history[3];

    // Set initial yield stress (if not already defined)
    if (sigy0 == 0.0) {
        // load material properties from database
        sigy0 = mat::load_curve(data.p_curve_data, data.p_curve_val, idlc, 0.0);
        data.p_history[3] = sigy0;
    }

    // Stiffness matrix
    data.p_stiffness[0] = G;
    data.p_stiffness[1] = bulk;
}