Material model interface
The material model interface is a set of C functions that are used to configure, initialize and run a material model.
These functions are implemented in interface.cpp.
Overview of interface functions
Each user material consists of five functions, which are all called by IMPETUS Solver:
mat_user_X_config: Get the configuration parameters required for the material model.init_mat_user_X: Initializes the material state.mat_user_X: Evaluates the material response.init_mat_user_X_gpu: Currently not being used, but reserved for future GPU implementation.mat_user_X_gpu: Evaluates the material behavior on a GPU device.
Implementing Your Own User Material
- Create an instance of your derived
MatUserclass. - Choose an available slot (e.g.,
mat_user_1). - Link the the following functions with your material model's corresponding functions:
mat_user_X_configinit_mat_user_Xmat_user_Xinit_mat_user_X_gpumat_user_X_gpu
Example Use Case
Suppose you want to link your user material (e.g. MatMetal). You would:
- Create an instance of
MatMetalclass (don't forget the namespace). - Choose slot
mat_user_1. - Link each of the functions for this material ID with its corresponding class functions:
static user_metal::MatMetal metal;
void mat_user_1_config(UserMatConfig* config, UserMatProp* properties)
{
metal.getConfig(config, properties);
}
void init_mat_user_1(UserMatInitCPU data)
{
metal.runInit(data);
}
void mat_user_1(UserMatCPU data)
{
metal.runMat(data);
}
void init_mat_user_1_gpu(UserMatHost host, UserMatDevice device, cudaStream_t stream)
{
metal.runInitGPU(host, device, stream);
}
void mat_user_1_gpu(UserMatHost host, UserMatDevice device, cudaStream_t stream)
{
metal.runMatGPU(host, device, stream);
}