Set conductivity

Riccardo Maione's picture
Submitted by Riccardo Maione on Fri, 05/16/2014 - 18:34

Hi all,
is it possible to set conductivity through a set property/atom? if not, where should I start coding? is it difficult?

thanks for your attention

Riccardo Maione's picture

Riccardo Maione | Thu, 05/22/2014 - 15:04

I know I can insert all conductivities with a fix property global but i have too many particle types so the input line for the fix property global is too long.
so i was asking if it is possible to do so with a set command

ckloss's picture

ckloss | Fri, 06/06/2014 - 16:37

Hi Riccardo,

per default conductivity is a per-type property. However, it would be possible to replace it with a per-atom property (fix property/atom)
This would require some coding however (fix transportequation/scalar, fix heat/gran, fix heat/gran/conduction)

best wishes
Christoph

Riccardo Maione's picture

Riccardo Maione | Thu, 06/12/2014 - 15:28

Thanks Christoph,

I hope it is not asking too much, but could you tell me which parts of these files I have to modify? I am not an expert of programming so any help will be appriciated

Riccardo Maione's picture

Riccardo Maione | Thu, 06/12/2014 - 16:23

the real problem is that when I have to set coefficients of restitution there are so many atom types that liggghts crushes,
a good way to go would be to be capable of setting the restitution par atom type (it is not correct but for me would be perfect)

Riccardo Maione's picture

Riccardo Maione | Wed, 06/18/2014 - 17:58

i have attached my modified files to the post, I am sure they miss something, because even if they compile correctly, it doesn't work as I would expected (the modified property are thermal capacity and thermal conductivity)

thanks for the attention and the help

Riccardo Maione's picture

Riccardo Maione | Tue, 06/24/2014 - 10:03

Hello Christoph,

I have a question regarding the possibility to program the conductivity and the thermal capacity as property/atom fixes and to set an additional conductivity for the anisotropic heat transport, what I did untill now was change the
fix_heat_gran_conduction.cpp:

1. first I define them in the function:

FixHeatGranCond::FixHeatGranCond(class LAMMPS *lmp, int narg, char **arg) :
FixHeatGran(lmp, narg, arg)
{
iarg_ = 5;

area_correction_flag = 0;

bool hasargs = true;
while(iarg_ < narg && hasargs)
{
hasargs = false;
if(strcmp(arg[iarg_],"area_correction") == 0) {
if (iarg_+2 > narg) error->fix_error(FLERR,this,"not enough arguments for keyword 'area_correction'");
if(strcmp(arg[iarg_+1],"yes") == 0)
area_correction_flag = 1;
else if(strcmp(arg[iarg_+1],"no") == 0)
area_correction_flag = 0;
else error->fix_error(FLERR,this,"expecting 'yes' otr 'no' after 'area_correction'");
iarg_ += 2;
hasargs = true;
} else if(strcmp(style,"heat/gran/conduction") == 0)
error->fix_error(FLERR,this,"unknown keyword");
}

fix_conductivityx = NULL;
conductivityx = NULL;
fix_conductivityz = NULL;
conductivityz = NULL;

}

2. after I tell in the programm to search for the two fix property/atom in the command line:

void FixHeatGranCond::init()
{
// initialize base class
FixHeatGran::init();

const double *Y, *nu, *Y_orig;
double expo, Yeff_ij, Yeff_orig_ij, ratio;
int max_type = pair_gran->mpg->max_type();

if (conductivityx) delete []conductivityx;

fix_conductivityx=static_cast(modify->find_fix_property("thermalConductivityx","property/atom","scalar",0,0,style));

if (conductivityz) delete []conductivityz;

fix_conductivityz=static_cast(modify->find_fix_property("thermalConductivityz","property/atom","scalar",0,0,style));

3. then

void FixHeatGranCond::updatePtrs()
{
conductivityx = fix_conductivityx->vector_atom;
conductivityz = fix_conductivityz->vector_atom;

}

4. and for last I set the thermal flux equation:

tcoix = conductivityx[i];
tcojx = conductivityx[j];
tcoiz = conductivityz[i];
tcojz = conductivityz[j];
if (tcoiz < SMALL || tcojz < SMALL) hc = 0.;
else if (x[i][2] = x[j][2]) hc =
4.*tcoiz*tcojz/(tcoiz+tcojz)*sqrt(contactArea); //this condition could be
better, but for now is all I need)
else hc = 4.*tcoix*tcojx/(tcoix+tcojx)*sqrt(contactArea);

as for the thermal capacity part:

I added these lines in fix_scalar_ transport_equation.cpp:

1.
if (fix_source==NULL){

fixarg[0]=capacity_name;
fixarg[1]="all";
fixarg[2]="property/atom";
fixarg[3]= "thermalCapacity"
fixarg[4]="scalar";
fixarg[5]="yes";
fixarg[6]="yes";
fixarg[7]="yes";
fixarg[8]="0.";
modify->add_fix(9,const_cast(fixarg));

fix_capacity=static_cast(modify->find_fix_property(capacity_name,"property/atom","scalar",0,0,style));

2. I have deleted these lines in FixScalarTransportEquation::init()

int max_type = pair_gran->mpg->max_type();

if(capacity) delete []capacity;
capacity = new double[max_type+1];

fix_capacity =
static_cast(modify->find_fix_property(capacity_name,"property/global","peratomtype",max_type,0,style));

//pre-calculate parameters for possible contact material combinations
for(int i=1;i< max_type+1; i++)
for(int j=1;jcompute_vector(i-1);
}

replaced by

fix_capacity=static_cast(modify->find_fix_property(capacity_name,"property/atom","scalar",0,0,style));
capacity = fix_capacity->vector_atom;

3. and in the end i have replaced
if(fabs(capacity) > SMALL) quantity[i] += (flux[i] + source[i]) * dt / (rmass[i]*capacity); with

if(fabs(capacity) > SMALL) quantity[i] += (flux[i] + source[i]) * dt / (rmass[i]*capacity[i]);

but it doesn't seem to work, it compiles correctly but when i try to use "fix heat/gran/conduction" it gives me a segmentation fault, any help you could give me?

ckloss's picture

ckloss | Thu, 06/26/2014 - 12:12

Hi Riccardo,

unfortunately it's not possible to debug other people's code on a courtesy basis. You might get yourself help from a C++ expert, or you can also contact DCS Computing for commercial support

Christoph