Skip to content

Commit

Permalink
Merge pull request #94 from ludwig-cf/ludwig-0.11.0
Browse files Browse the repository at this point in the history
Ludwig 0.11.0
  • Loading branch information
ludwig-cf authored Jul 8, 2020
2 parents e6eb8bb + fc1ae2c commit 2d4b60e
Show file tree
Hide file tree
Showing 85 changed files with 4,669 additions and 458 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# An attempt to prevent mislabeling of .h files as C++
# See https://github.com/github/linguist

*.h linguist-language=C
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@

### Changes


version 0.11.0
- Add external chemical potential gradient in Cahn Hilliard for
free energy symmetric. Thanks to Jurij Sablic (jurij.sablic@gmail.com).
- Add Arrhenius viscosity model for compositional order parameter
- Add the ability to run both subgrid and fully resolved particles at
the same time. Thanks to Qi Kai (kai.qi@epfl.ch) for this.
- Various code quality updates

version 0.10.0
- Added an option to fix colloid position or velocity on a per-direction
basis, e.g.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A lattice Boltzmann code for complex fluids

[![Build Status](https://travis-ci.com/ludwig-cf/ludwig.svg?branch=develop)](https://travis-ci.com/ludwig-cf/ludwig)
[![Build Status](https://travis-ci.com/ludwig-cf/ludwig.svg?branch=master)](https://travis-ci.com/ludwig-cf/ludwig)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1998/badge)](https://bestpractices.coreinfrastructure.org/projects/1998)


Expand Down
22 changes: 12 additions & 10 deletions src/advection.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2010-2018 The University of Edinburgh
* (c) 2010-2020 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford (kevin@epcc.ed.ac.uk)
Expand All @@ -35,7 +35,7 @@
#include "field_s.h"
#include "advection_s.h"
#include "psi_gradients.h"
#include "hydro_s.h"
#include "hydro.h"
#include "timer.h"

__host__
Expand Down Expand Up @@ -158,10 +158,10 @@ __host__ int advflux_create(pe_t * pe, cs_t * cs, lees_edw_t * le, int nf,
obj->nf = nf;
obj->nsite = nsites;

obj->fe = (double *) calloc(nsites*nf, sizeof(double));
obj->fw = (double *) calloc(nsites*nf, sizeof(double));
obj->fy = (double *) calloc(nsites*nf, sizeof(double));
obj->fz = (double *) calloc(nsites*nf, sizeof(double));
obj->fe = (double *) calloc((size_t) nsites*nf, sizeof(double));
obj->fw = (double *) calloc((size_t) nsites*nf, sizeof(double));
obj->fy = (double *) calloc((size_t) nsites*nf, sizeof(double));
obj->fz = (double *) calloc((size_t) nsites*nf, sizeof(double));

if (obj->fe == NULL) pe_fatal(pe, "calloc(advflux->fe) failed\n");
if (obj->fw == NULL) pe_fatal(pe, "calloc(advflux->fw) failed\n");
Expand All @@ -179,19 +179,21 @@ __host__ int advflux_create(pe_t * pe, cs_t * cs, lees_edw_t * le, int nf,
else {
cs_t * cstarget = NULL;
lees_edw_t * letarget = NULL;
size_t nsz = (size_t) nsites*nf*sizeof(double);

tdpMalloc((void **) &obj->target, sizeof(advflux_t));
tdpMemset(obj->target, 0, sizeof(advflux_t));
tdpMalloc((void **) &tmp, nf*nsites*sizeof(double));

tdpMalloc((void **) &tmp, nsz);
tdpMemcpy(&obj->target->fe, &tmp, sizeof(double *), tdpMemcpyHostToDevice);

tdpMalloc((void **) &tmp, nf*nsites*sizeof(double));
tdpMalloc((void **) &tmp, nsz);
tdpMemcpy(&obj->target->fw, &tmp, sizeof(double *), tdpMemcpyHostToDevice);

tdpMalloc((void **) &tmp, nf*nsites*sizeof(double));
tdpMalloc((void **) &tmp, nsz);
tdpMemcpy(&obj->target->fy, &tmp, sizeof(double *), tdpMemcpyHostToDevice);

tdpMalloc((void **) &tmp, nf*nsites*sizeof(double));
tdpMalloc((void **) &tmp, nsz);
tdpMemcpy(&obj->target->fz, &tmp, sizeof(double *), tdpMemcpyHostToDevice);

tdpMemcpy(&obj->target->nf, &obj->nf, sizeof(int), tdpMemcpyHostToDevice);
Expand Down
13 changes: 11 additions & 2 deletions src/bbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2010-2018 The University of Edinburgh
* (c) 2010-2020 The University of Edinburgh
*
* Contributing Authors:
* Kevin Stratford (kevin@epcc.ed.ac.uk)
Expand Down Expand Up @@ -212,6 +212,8 @@ static int bbl_active_conservation(bbl_t * bbl, colloids_info_t * cinfo) {

for ( ; pc; pc = pc->nextall) {

if (pc->s.type != COLLOID_TYPE_ACTIVE) continue;

pc->sump /= pc->sumw;
p_link = pc->lnk;

Expand Down Expand Up @@ -324,7 +326,7 @@ __global__ void bbl_pass0_kernel(kernel_ctxt_t * ktxt, cs_t * cs, lb_t * lb,

pc = cinfo->map_new[index];

if (pc) {
if (pc && pc->s.type != COLLOID_TYPE_SUBGRID) {
cs_nlocal_offset(cs, noffset);
r[X] = 1.0*(noffset[X] + ic);
r[Y] = 1.0*(noffset[Y] + jc);
Expand Down Expand Up @@ -400,6 +402,8 @@ static int bbl_pass1(bbl_t * bbl, lb_t * lb, colloids_info_t * cinfo) {

for ( ; pc; pc = pc->nextall) {

if (pc->s.type == COLLOID_TYPE_SUBGRID) continue;

p_link = pc->lnk;

for (i = 0; i < 21; i++) {
Expand Down Expand Up @@ -603,6 +607,8 @@ static int bbl_pass2(bbl_t * bbl, lb_t * lb, colloids_info_t * cinfo) {

for ( ; pc; pc = pc->nextall) {

if (pc->s.type == COLLOID_TYPE_SUBGRID) continue;

/* Set correction for phi arising from previous step */

dgtm1 = pc->s.deltaphi;
Expand Down Expand Up @@ -716,6 +722,7 @@ static int bbl_pass2(bbl_t * bbl, lb_t * lb, colloids_info_t * cinfo) {
bbl->deltag += pc->s.deltaphi;
}


return 0;
}

Expand Down Expand Up @@ -760,6 +767,8 @@ int bbl_update_colloids(bbl_t * bbl, wall_t * wall, colloids_info_t * cinfo) {

for ( ; pc; pc = pc->nextall) {

if (pc->s.type == COLLOID_TYPE_SUBGRID) continue;

/* Set up the matrix problem and solve it here. */

/* Mass and moment of inertia are those of a hard sphere
Expand Down
8 changes: 4 additions & 4 deletions src/blue_phase_beris_edwards.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2009-2018 The University of Edinburgh
* (c) 2009-2020 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford (kevin@epcc.ed.ac.uk)
Expand All @@ -53,7 +53,6 @@
#include "blue_phase.h"
#include "blue_phase_beris_edwards.h"
#include "advection_s.h"
#include "hydro_s.h"
#include "field_s.h"
#include "field_grad_s.h"
#include "colloids_s.h"
Expand Down Expand Up @@ -234,11 +233,12 @@ __host__ int beris_edw_param_commit(beris_edw_t * be) {
*
*****************************************************************************/

__host__ int beris_edw_param_set(beris_edw_t * be, beris_edw_param_t vals) {
__host__ int beris_edw_param_set(beris_edw_t * be, beris_edw_param_t * vals) {

assert(be);
assert(vals);

*be->param = vals;
*be->param = *vals;

return 0;
}
Expand Down
9 changes: 4 additions & 5 deletions src/blue_phase_beris_edwards.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
*
* blue_phase_beris_edwards.h
*
* $Id$
*
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* Kevin Stratford (kevin@epcc.ed.ac.uk)
*
* (c) 2009-2017 The University of Edinburgh
* (c) 2009-2020 The University of Edinburgh
*
*****************************************************************************/

#ifndef BLUE_PHASE_BERIS_EDWARDS_H
#define BLUE_PHASE_BERIS_EDWARDS_H
#ifndef LUDWIG_BLUE_PHASE_BERIS_EDWARDS_H
#define LUDWIG_BLUE_PHASE_BERIS_EDWARDS_H

#include "coords.h"
#include "leesedwards.h"
Expand All @@ -40,7 +39,7 @@ __host__ int beris_edw_create(pe_t * pe, cs_t * cs, lees_edw_t * le,
beris_edw_t ** pobj);
__host__ int beris_edw_free(beris_edw_t * be);
__host__ int beris_edw_memcpy(beris_edw_t * be, int flag);
__host__ int beris_edw_param_set(beris_edw_t * be, beris_edw_param_t values);
__host__ int beris_edw_param_set(beris_edw_t * be, beris_edw_param_t * values);
__host__ int beris_edw_param_commit(beris_edw_t * be);

__host__ int beris_edw_update(beris_edw_t * be, fe_t * fe, field_t * fq,
Expand Down
4 changes: 2 additions & 2 deletions src/blue_phase_rt.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2009-2018 The University of Edinburgh
* (c) 2009-2020 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford (kevin@epcc.ed.ac.uk)
Expand Down Expand Up @@ -318,7 +318,7 @@ __host__ int blue_phase_init_rt(pe_t * pe, rt_t *rt,
else {
be_param.gamma = gamma;
be_param.xi = fe_param.xi;
beris_edw_param_set(be, be_param);
beris_edw_param_set(be, &be_param);
pe_info(pe, "Rotational diffusion const = %14.7e\n", gamma);
}

Expand Down
5 changes: 3 additions & 2 deletions src/bond_fene.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2014-2017 The University of Edinburgh
* (c) 2014-2020 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford (kevin@epcc.ed.ac.uk)
Expand Down Expand Up @@ -165,6 +165,8 @@ int bond_fene_compute(colloids_info_t * cinfo, void * self) {
obj->bondlocal = 0.0;

for (; pc; pc = pc->nextlocal) {

if (pc->s.nbonds == 0) continue;

for (n = 0; n < pc->s.nbonds; n++) {
assert(pc->bonded[n]);
Expand All @@ -191,7 +193,6 @@ int bond_fene_compute(colloids_info_t * cinfo, void * self) {
pc->bonded[n]->force[Y] += f*r12[Y];
pc->bonded[n]->force[Z] += f*r12[Z];
}

}

obj->rminlocal = sqrt(r2min);
Expand Down
12 changes: 7 additions & 5 deletions src/build.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Edinburgh Soft Matter and Statisitical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2006-2019 The University of Edinburgh
* (c) 2006-2020 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford (kevin@epcc.ed.ac.uk)
Expand Down Expand Up @@ -142,7 +142,9 @@ int build_update_map(cs_t * cs, colloids_info_t * cinfo, map_t * map) {

/* For each colloid in this cell, check solid/fluid status */

while (p_colloid != NULL) {
for ( ; p_colloid; p_colloid = p_colloid->next) {

if (p_colloid->s.type == COLLOID_TYPE_SUBGRID) continue;

/* Set actual position and radius */

Expand Down Expand Up @@ -212,7 +214,6 @@ int build_update_map(cs_t * cs, colloids_info_t * cinfo, map_t * map) {
}

/* Next colloid */
p_colloid = p_colloid->next;
}

/* Next cell */
Expand Down Expand Up @@ -253,7 +254,9 @@ int build_update_links(cs_t * cs, colloids_info_t * cinfo, wall_t * wall,

colloids_info_cell_list_head(cinfo, ic, jc, kc, &pc);

while (pc) {
for (; pc; pc = pc->next) {

if (pc->s.type == COLLOID_TYPE_SUBGRID) continue;

pc->sumw = 0.0;
for (ia = 0; ia < 3; ia++) {
Expand All @@ -276,7 +279,6 @@ int build_update_links(cs_t * cs, colloids_info_t * cinfo, wall_t * wall,
/* Next colloid */

pc->s.rebuild = 0;
pc = pc->next;
}

/* Next cell */
Expand Down
Loading

0 comments on commit 2d4b60e

Please sign in to comment.