Fixing compilation errors

This commit is contained in:
jtclemm
2023-04-24 19:46:27 -06:00
parent 35d1178cfa
commit 47b8cdc94f
21 changed files with 379 additions and 346 deletions

View File

@ -20,8 +20,8 @@
#include "atom.h"
#include "comm.h"
#include "compute_rheo_interface.h"
#include "compute_rheo_kernel.h"
#include "compute_rheo_solids.h"
#include "domain.h"
#include "error.h"
#include "fix_rheo.h"
@ -33,18 +33,19 @@
#include "neigh_request.h"
using namespace LAMMPS_NS;
using namespace RHEO_NS;
using namespace FixConst;
using namespace MathExtra;
#define EPSILON 1e-10;
static constexpr double EPSILON = 1e-10;
/* ---------------------------------------------------------------------- */
ComputeRHEOSurface::ComputeRHEOSurface(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_kernel(nullptr), compute_solids(nullptr),
Compute(lmp, narg, arg), fix_rheo(nullptr), list(nullptr), compute_kernel(nullptr), compute_interface(nullptr),
B(nullptr), gradC(nullptr), nsurface(nullptr), divr(nullptr), rsurface(nullptr)
{
if (narg != 3) error->all(FLERR,"Illegal fix RHEO/SURFACE command");
if (narg != 3) error->all(FLERR,"Illegal compute RHEO/SURFACE command");
int dim = domain->dimension;
comm_forward = 2;
@ -75,19 +76,19 @@ ComputeRHEOSurface::~ComputeRHEOSurface()
void ComputeRHEOSurface::init()
{
compute_kernel = fix_rheo->compute_kernel;
compute_solids = fix_rheo->compute_solids;
compute_interface = fix_rheo->compute_interface;
cut = fix_rheo->cut;
rho0 = fix_rheo->rho0;
threshold_style = fix_rheo->surface_style;
threshold_divr = fix_rheo->divrsurface;
threshold_z = fix_rheo->zminsurface;
threshold_divr = fix_rheo->divr_surface;
threshold_z = fix_rheo->zmin_surface;
cutsq = cut * cut;
// Create rsurface, divr, nsurface arrays if they don't already exist
// Create a custom atom property so it works with compute property/atom
// Do not create grow callback as there's no reason to copy/exchange data
// Manually grow if nmax_old exceeded
// Manually grow if nmax_store exceeded
// For B and gradC, create a local array since they are unlikely to be printed
int tmp1, tmp2;
@ -103,12 +104,13 @@ void ComputeRHEOSurface::init()
if (index == -1) index = atom->add_custom("rheo_nsurface", 1, 3);
nsurface = atom->darray[index];
nmax_old = atom->nmax;
memory->create(B, nmax_old, dim * dim, "rheo/surface:B");
memory->create(gradC, nmax_old, dim * dim, "rheo/surface:gradC");
nmax_store = atom->nmax;
int dim = domain->dimension;
memory->create(B, nmax_store, dim * dim, "rheo/surface:B");
memory->create(gradC, nmax_store, dim * dim, "rheo/surface:gradC");
// need an occasional half neighbor list
neighbor->add_request(this, NeighConst::REQ_HALF);
neighbor->add_request(this, NeighConst::REQ_DEFAULT);
}
/* ---------------------------------------------------------------------- */
@ -123,9 +125,8 @@ void ComputeRHEOSurface::init_list(int /*id*/, NeighList *ptr)
void ComputeRHEOSurface::compute_peratom()
{
int i, j, ii, jj, inum, jnum, a, b, itype, jtype, fluidi, fluidj;
double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj;
double *dWij, *dWji;
double dx[3];
double xtmp, ytmp, ztmp, rsq, Voli, Volj, rhoi, rhoj, wp;
double *dWij, *dWji, dx[3];
int *ilist, *jlist, *numneigh, **firstneigh;
int nlocal = atom->nlocal;
@ -146,7 +147,7 @@ void ComputeRHEOSurface::compute_peratom()
firstneigh = list->firstneigh;
int nmax = atom->nmax;
if (nmax_old <= nmax) {
if (nmax_store <= nmax) {
memory->grow(divr, nmax, "atom:rheo_divr");
memory->grow(rsurface, nmax, "atom:rheo_rsurface");
memory->grow(nsurface, nmax, 3, "atom:rheo_nsurface");
@ -154,7 +155,7 @@ void ComputeRHEOSurface::compute_peratom()
memory->grow(B, nmax, dim * dim, "rheo/surface:B");
memory->grow(gradC, nmax, dim * dim, "rheo/surface:gradC");
nmax_old = atom->nmax;
nmax_store = atom->nmax;
}
int nall = nlocal + atom->nghost;
@ -169,7 +170,7 @@ void ComputeRHEOSurface::compute_peratom()
divr[i] = 0.0;
// Remove surface settings
status[i] &= FixRHEO::surfacemask;
status[i] &= SURFACEMASK;
}
// loop over neighbors to calculate the average orientation of neighbors
@ -182,7 +183,7 @@ void ComputeRHEOSurface::compute_peratom()
jlist = firstneigh[i];
jnum = numneigh[i];
itype = type[i];
fluidi = status[i] & FixRHEO::STATUS_FLUID;
fluidi = status[i] & STATUS_FLUID;
for (jj = 0; jj < jnum; jj++) {
j = jlist[jj];
@ -192,19 +193,19 @@ void ComputeRHEOSurface::compute_peratom()
dx[1] = ytmp - x[j][1];
dx[2] = ztmp - x[j][2];
rsq = lensq(dx);
rsq = lensq3(dx);
if (rsq < cutsq) {
jtype = type[j];
fluidj = status[j] & FixRHEO::STATUS_FLUID;
fluidj = status[j] & STATUS_FLUID;
rhoi = rho[i];
rhoj = rho[j];
// Add corrections for walls
if (fluidi && (!fluidj)) {
rhoj = compute_solids->correct_rho(j, i);
rhoj = compute_interface->correct_rho(j, i);
} else if ((!fluidi) && fluidj) {
rhoi = compute_solids->correct_rho(i, j);
rhoi = compute_interface->correct_rho(i, j);
} else if ((!fluidi) && (!fluidj)) {
rhoi = rho0;
rhoj = rho0;
@ -253,29 +254,29 @@ void ComputeRHEOSurface::compute_peratom()
}
// Find the free-surface
if (threshold_style == FixRHEO::DIVR) {
if (threshold_style == DIVR) {
for (i = 0; i < nall; i++) {
if (mask[i] & groupbit) {
status[i] |= FixRHEO::STATUS_BULK;
status[i] |= STATUS_BULK;
rsurface[i] = cut;
if (divr[i] < threshold_divr) {
status[i] |= FixRHEO::STATUS_SURFACE;
status[i] |= STATUS_SURFACE;
rsurface[i] = 0.0;
if (coordination[i] < threshold_z)
status[i] |= FixRHEO::STATUS_SPLASH;
status[i] |= STATUS_SPLASH;
}
}
}
} else {
for (i = 0; i < nall; i++) {
if (mask[i] & groupbit) {
status[i] |= FixRHEO::STATUS_BULK;
status[i] |= STATUS_BULK;
rsurface[i] = cut;
if (coordination[i] < divR_limit) {
status[i] |= FixRHEO::STATUS_SURFACE;
if (coordination[i] < threshold_divr) {
status[i] |= STATUS_SURFACE;
rsurface[i] = 0.0;
if (coordination[i] < threshold_z)
status[i] |= FixRHEO::STATUS_SPLASH;
status[i] |= STATUS_SPLASH;
}
}
}
@ -297,23 +298,23 @@ void ComputeRHEOSurface::compute_peratom()
dx[0] = xtmp - x[j][0];
dx[1] = ytmp - x[j][1];
dx[2] = ztmp - x[j][2];
rsq = lensq(dx);
rsq = lensq3(dx);
if (rsq < cutsq) {
if ((status[i] & FixRHEO::STATUS_BULK) && (status[j] & FixRHEO::STATUS_SURFACE)) {
status[i] &= FixRHEO::surfacemask;
status[i] |= FixRHEO::STATUS_LAYER;
if ((status[i] & STATUS_BULK) && (status[j] & STATUS_SURFACE)) {
status[i] &= SURFACEMASK;
status[i] |= STATUS_LAYER;
}
if (status[j] & FixRHEO::STATUS_SURFACE) rsurface[i] = MIN(rsurface[i], sqrt(rsq));
if (status[j] & STATUS_SURFACE) rsurface[i] = MIN(rsurface[i], sqrt(rsq));
if (j < nlocal || newton) {
if ((status[j] & FixRHEO::STATUS_BULK) && (status[i] & FixRHEO::STATUS_SURFACE)) {
status[j] &= FixRHEO::surfacemask;
status[j] |= FixRHEO::STATUS_LAYER;
if ((status[j] & STATUS_BULK) && (status[i] & STATUS_SURFACE)) {
status[j] &= SURFACEMASK;
status[j] |= STATUS_LAYER;
}
if (status[i] & FixRHEO::STATUS_SURFACE) rsurface[j] = MIN(rsurface[j], sqrt(rsq));
if (status[i] & STATUS_SURFACE) rsurface[j] = MIN(rsurface[j], sqrt(rsq));
}
}
}
@ -371,7 +372,7 @@ void ComputeRHEOSurface::unpack_reverse_comm(int n, int *list, double *buf)
} else if (comm_stage == 1) {
temp = (int) buf[m++];
if ((status[j] & FixRHEO::STATUS_BULK) && (temp & FixRHEO::STATUS_LAYER))
if ((status[j] & STATUS_BULK) && (temp & STATUS_LAYER))
status[j] = temp;
rsurface[j] = MIN(rsurface[j], buf[m++]);