Skip to content

Commit

Permalink
Merge pull request #308 from ludwig-cf/fix-issue-284
Browse files Browse the repository at this point in the history
Removal of old i/o routines
  • Loading branch information
kevinstratford authored Jul 25, 2024
2 parents 614ec19 + 3fab9fb commit 61c3723
Show file tree
Hide file tree
Showing 162 changed files with 4,122 additions and 4,438 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@

### Changes

version 0.22.0

- Removal of original "ansi" I/O (Issue 284).
The "ansi" parallel i/o has been removed in favour of mpi/io
for lattice quantities. This change should be transparent in most
cases. Old "ansi" parallel i/o restart files will no longer work
if the there was more than one output file per step.

- Please use "lb_fluctuations" instead of "isothermal_fluctuations"
in the input if you need fluctuations in Navier-Stokes.

- Various code imporvements.


version 0.21.0

Expand Down
12 changes: 9 additions & 3 deletions mpi_s/mpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* From an idea appearing in LAMMPS.
*
* (c) 2022 The University of Edinburgh
* (c) 2022-2024 The University of Edinburgh
*
* Kevin Stratford ([email protected])
*
Expand Down Expand Up @@ -53,9 +53,14 @@ typedef intmax_t MPI_Offset;

/* Defined constants (see Annex A.2) */

/* Return codes */
/* Return codes (add as required) */

enum return_codes {MPI_SUCCESS};
enum return_codes {
MPI_SUCCESS = 0, /* Success */
MPI_ERR_FILE, /* Bad file handle */
MPI_ERR_NO_SUCH_FILE, /* File does not exist */
MPI_ERR_LASTCODE /* Must be last */
};

/* Assorted constants */

Expand Down Expand Up @@ -152,6 +157,7 @@ enum mpi_order_enum {MPI_ORDER_C, MPI_ORDER_FORTRAN};

#define MPI_MAX_DATAREP_STRING 128 /* E.g., "native" */


/* Interface */

int MPI_Barrier(MPI_Comm comm);
Expand Down
6 changes: 3 additions & 3 deletions mpi_s/mpi_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Edinburgh Soft Matter and Statistical Physics Group and
* Edinburgh Parallel Computing Centre
*
* (c) 2021-2022 The University of Edinburgh
* (c) 2021-2024 The University of Edinburgh
*
* Kevin Stratford ([email protected])
*
Expand Down Expand Up @@ -1400,7 +1400,7 @@ int MPI_File_open(MPI_Comm comm, const char * filename, int amode,
if (fp == NULL) {
printf("MPI_File_open: attempt to open %s mode %s failed\n", filename,
fdmode);
exit(0);
return MPI_ERR_NO_SUCH_FILE;
}

*fh = mpi_file_handle_retain(mpi_info, fp);
Expand All @@ -1424,7 +1424,7 @@ int MPI_File_close(MPI_File * fh) {

if (fp == NULL) {
printf("MPI_File_close: invalid file handle\n");
exit(0);
return MPI_ERR_FILE;
}
else {
fclose(fp);
Expand Down
8 changes: 3 additions & 5 deletions src/blue_phase.h
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-2023 The University of Edinburgh
* (c) 2010-2024 The University of Edinburgh
*
* Contributing authors:
* Kevin Stratford ([email protected])
Expand All @@ -26,7 +26,6 @@
#include "free_energy.h"
#include "field.h"
#include "field_grad.h"
#include "io_harness.h"

#include "lc_anchoring.h"

Expand Down Expand Up @@ -153,9 +152,9 @@ void fe_lc_str_anti_v(fe_lc_t * fe, int index, double s[3][3][NSIMDVL]);

__host__ __device__
void fe_lc_compute_h_v(fe_lc_t * fe,
double q[3][3][NSIMDVL],
double q[3][3][NSIMDVL],
double dq[3][3][3][NSIMDVL],
double dsq[3][3][NSIMDVL],
double dsq[3][3][NSIMDVL],
double h[3][3][NSIMDVL]);
__host__ __device__
void fe_lc_compute_stress_v(fe_lc_t * fe,
Expand Down Expand Up @@ -185,4 +184,3 @@ __host__ int fe_lc_scalar_ops(double q[3][3], double qs[NQAB]);


#endif

14 changes: 4 additions & 10 deletions src/blue_phase_beris_edwards.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ __host__ int beris_edw_update_host(beris_edw_t * be, fe_t * fe, field_t * fq,
int index, indexj, indexk;
int nlocal[3];
int status;
int noise_on = 0;

double q[3][3];
double w[3][3];
Expand Down Expand Up @@ -354,8 +353,7 @@ __host__ int beris_edw_update_host(beris_edw_t * be, fe_t * fe, field_t * fq,
/* Get kBT, variance of noise and set basis of traceless,
* symmetric matrices for contraction */

if (noise) noise_present(noise, NOISE_QAB, &noise_on);
if (noise_on) {
if (be->param->noise) {
assert(0); /* check noise kt */
beris_edw_tmatrix(tmatrix);
}
Expand Down Expand Up @@ -404,7 +402,7 @@ __host__ int beris_edw_update_host(beris_edw_t * be, fe_t * fe, field_t * fq,

/* Fluctuating tensor order parameter */

if (noise_on) {
if (be->param->noise) {
noise_reap_n(noise, index, NQAB, chi);
for (id = 0; id < NQAB; id++) {
chi[id] = var*chi[id];
Expand Down Expand Up @@ -493,7 +491,6 @@ __host__ int beris_edw_update_driver(beris_edw_t * be,
hydro_t * hydro,
map_t * map,
noise_t * noise) {
int ison;
int nlocal[3];

hydro_t * hydrotarget = NULL;
Expand All @@ -515,10 +512,7 @@ __host__ int beris_edw_update_driver(beris_edw_t * be,

beris_edw_param_commit(be);
if (hydro) hydrotarget = hydro->target;

ison = 0;
if (noise) noise_present(noise, NOISE_QAB, &ison);
if (ison) noisetarget = noise;
if (noise) noisetarget = noise->target;

TIMER_start(BP_BE_UPDATE_KERNEL);

Expand Down Expand Up @@ -726,7 +720,7 @@ __global__ void beris_edw_kernel_v(kernel_3d_v_t k3v, beris_edw_t * be,

/* Fluctuating tensor order parameter */

if (noise) {
if (be->param->noise) {

for_simd_v(iv, NSIMDVL) {

Expand Down
3 changes: 2 additions & 1 deletion src/blue_phase_beris_edwards.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Kevin Stratford ([email protected])
*
* (c) 2009-2020 The University of Edinburgh
* (c) 2009-2024 The University of Edinburgh
*
*****************************************************************************/

Expand All @@ -30,6 +30,7 @@ typedef struct beris_edw_param_s beris_edw_param_t;
struct beris_edw_param_s {
double xi; /* Effective aspect ratio (from relevant free energy) */
double gamma; /* Rotational diffusion constant */
int noise; /* Noise switch */
double var; /* Noise variance */

double tmatrix[3][3][NQAB]; /* Constant noise tensor */
Expand Down
Loading

0 comments on commit 61c3723

Please sign in to comment.