Add new property to normal_model_hertz.h

Submitted by hrvig on Tue, 11/08/2016 - 09:40

Hello,

I am trying to modify the hertz contact model to include an adhesive force. So far I have hard-coded the modifications into the normal_model_hertz.h, which works fine. Now I want to do some parameter analysis and it would therefore be more convenient to define the relevant parameters in the LIGGGHTS script.

Let's say I want to define a matrix property, surfaceEnergyDensity, to be used. Below I included the modifications I did to normal_hertz_model.h and global_properties.cpp. I attached the log file.

---------------------------------------

In the normal_model_hertz.h I added:

NormalModel(LAMMPS * lmp, IContactHistorySetup*,class ContactModelBase *c) : Pointers(lmp),
surfaceEnergyDensity(NULL),

AND

void connectToProperties(PropertyRegistry & registry)
{
registry.registerProperty("surfaceEnergyDensity", &MODEL_PARAMS::createSurfaceEnergyDensity);
registry.connect("surfaceEnergyDensity", surfaceEnergyDensity,"model hertz");
}

---------------------------------------

and in global_properties.h I added:

namespace MODEL_PARAMS
{
static const char * SURFACE_ENERGY_DENSITY = "surfaceEnergyDensity";

AND

MatrixProperty * createSurfaceEnergyDensity(PropertyRegistry & registry, const char * caller, bool sanity_checks)
{
LAMMPS * lmp = registry.getLAMMPS();
const int max_type = registry.max_type();

MatrixProperty * matrix = new MatrixProperty(max_type+1, max_type+1);
FixPropertyGlobal * surfaceEnergyDensity = registry.getGlobalProperty(SURFACE_ENERGY_DENSITY,"property/global","peratomtypepair",max_type,max_type,caller);

for(int i=1;i< max_type+1; i++)
{
for(int j=1;jcompute_array(i-1,j-1);
matrix->data[i][j] = gamma;
}
}

AttachmentSize
Plain text icon compilation log2.96 KB

hrvig | Tue, 11/08/2016 - 13:04

Add it as protected in the bottom of normal_model_hertz.h and it works just as expected