diff --git a/doc/Manual.pdf b/doc/Manual.pdf index 3ea771f35e1c509f0e58b257f39b14664fbb9550..b474f1512b65e53e932f0c697d8a5aa3157b8733 100644 Binary files a/doc/Manual.pdf and b/doc/Manual.pdf differ diff --git a/src/cfd_datacoupling.cpp b/src/cfd_datacoupling.cpp index a1c6a29301804fd6c02bd7f83c72278c52faf703..f3f4a91dcd1d490854dc0773474b170d56c54c57 100644 --- a/src/cfd_datacoupling.cpp +++ b/src/cfd_datacoupling.cpp @@ -57,6 +57,10 @@ CfdDatacoupling::CfdDatacoupling(class LAMMPS *lmp, int jarg,int narg, char **ar pushtypes_ = NULL; pushinvoked_ = NULL; pullinvoked_ = NULL; + + ms_ = NULL; + ms_data_ = NULL; + grow_(); } @@ -76,12 +80,9 @@ void CfdDatacoupling::init() { // multisphere - can be NULL FixMultisphere *fix_multisphere; - fix_multisphere = static_cast<FixMultisphere*>(modify->find_fix_style_strict("multisphere",0)); + ms_ = static_cast<FixMultisphere*>(modify->find_fix_style_strict("multisphere",0)); - if(!fix_multisphere) - ms_data_ = NULL; - else - ms_data_ = &fix_multisphere->data(); + if(ms_) ms_data_ = &ms_->data(); // empty list of requested properties // models do their init afterwards so list will be filled @@ -207,6 +208,7 @@ void CfdDatacoupling::check_datatransfer() void CfdDatacoupling::add_pull_property(char *name,char *type) { + if(strlen(name) >= MAXLENGTH) error->all(FLERR,"Fix couple/cfd: Maximum string length for a variable exceeded"); if(npull_ >= nvalues_max_) grow_(); @@ -218,6 +220,16 @@ void CfdDatacoupling::add_pull_property(char *name,char *type) error->all(FLERR,"Properties added via CfdDatacoupling::add_pull_property are inconsistent"); } + // test if property is available + + int len1,len2; + void *ptr = find_pull_property(name,type,len1,len2); + if (atom->nlocal && (!ptr || len1 < 0 || len2 < 0)) + { + if(screen) fprintf(screen,"Property %s added via CfdDatacoupling::add_pull_property not found.\n",name); + error->one(FLERR,"This is fatal"); + } + strcpy(pullnames_[npull_],name); strcpy(pulltypes_[npull_],type); npull_++; @@ -229,6 +241,7 @@ void CfdDatacoupling::add_pull_property(char *name,char *type) void CfdDatacoupling::add_push_property(char *name,char *type) { + if(strlen(name) >= MAXLENGTH) error->all(FLERR,"Fix couple/cfd: Maximum string length for a variable exceeded"); if(npush_ >= nvalues_max_) grow_(); @@ -241,6 +254,16 @@ void CfdDatacoupling::add_push_property(char *name,char *type) error->all(FLERR,"Properties added via CfdDatacoupling::add_push_property are inconsistent"); } + // test if property is available + + int len1,len2; + void *ptr = find_push_property(name,type,len1,len2); + if (atom->nlocal && (!ptr || len1 < 0 || len2 < 0)) + { + if(screen) fprintf(screen,"Property %s added via CfdDatacoupling::add_push_property not found.\n",name); + error->one(FLERR,"This is fatal"); + } + strcpy(pushnames_[npush_],name); strcpy(pushtypes_[npush_],type); npush_++; @@ -287,13 +310,12 @@ void* CfdDatacoupling::find_property(int push,char *name,char *type,int &len1,in } // possiblility 2 - // may come from a fix rigid/multisphere + // may come from a fix multisphere // also handles scalar-multisphere and vector-multisphere - if(ms_data_) + if(ms_) { - ptr = ms_data_->extract(name,len1,len2); - + ptr = ms_->extract(name,len1,len2); if((strcmp(type,"scalar-multisphere") == 0) && (len2 != 1) || (strcmp(type,"vector-multisphere") == 0) && (len2 != 3)) return NULL; diff --git a/src/cfd_datacoupling.h b/src/cfd_datacoupling.h index 52ee7a193a88706d862bd0c09a503224c15e5b11..7a816abd04e4d8c8649466292471f2fc3f4bb3fc 100644 --- a/src/cfd_datacoupling.h +++ b/src/cfd_datacoupling.h @@ -100,6 +100,7 @@ class CfdDatacoupling : protected Pointers { class FixCfdCoupling *fc_; // multisphere + class FixMultisphere *ms_; class MultisphereParallel *ms_data_; }; diff --git a/src/cfd_datacoupling_mpi.h b/src/cfd_datacoupling_mpi.h index 8baab0d8a18a4f585bafbc24f4502e93421e187f..9f733e3ddecc3faaed5a27840d93848e0ae0ad49 100644 --- a/src/cfd_datacoupling_mpi.h +++ b/src/cfd_datacoupling_mpi.h @@ -116,7 +116,7 @@ void CfdDatacouplingMPI::pull_mpi(char *name,char *type,void *&from) if(!ms_data_) error->one(FLERR,"Transferring a multisphere property from/to LIGGGHTS requires a fix rigid/multisphere"); for (int i = 0; i < len1; i++) - if ((m = ms_data_->map(i)) >= 0) + if ((m = ms_data_->map(i+1)) >= 0) to_t[m] = allred[i]; } else if(strcmp(type,"vector-multisphere") == 0) @@ -125,7 +125,7 @@ void CfdDatacouplingMPI::pull_mpi(char *name,char *type,void *&from) if(!ms_data_) error->one(FLERR,"Transferring a multisphere property from/to LIGGGHTS requires a fix rigid/multisphere"); for (int i = 0; i < len1; i++) - if ((m = ms_data_->map(i)) >= 0) + if ((m = ms_data_->map(i+1)) >= 0) for (int j = 0; j < len2; j++) to_t[m][j] = allred[i*len2 + j]; } @@ -156,6 +156,7 @@ void CfdDatacouplingMPI::push_mpi(char *name,char *type,void *&to) if (atom->nlocal && (!from || len1 < 0 || len2 < 0)) { + if(screen) fprintf(screen,"LIGGGHTS could not find property %s to write data from calling program to.\n",name); lmp->error->one(FLERR,"This is fatal"); } @@ -197,7 +198,7 @@ void CfdDatacouplingMPI::push_mpi(char *name,char *type,void *&to) for (int i = 0; i < nbodies; i++) // loops over # local bodies { id = ms_data_->tag(i); - allred[id] = from_t[i]; + allred[id-1] = from_t[i]; } } else if(strcmp(type,"vector-multisphere") == 0) @@ -209,8 +210,12 @@ void CfdDatacouplingMPI::push_mpi(char *name,char *type,void *&to) { id = ms_data_->tag(i); for (int j = 0; j < len2; j++) - allred[id*len2 + j] = from_t[i][j]; + { + allred[(id-1)*len2 + j] = from_t[i][j]; + + } } + } else if(strcmp(type,"scalar-global") == 0 || strcmp(type,"vector-global") == 0 || strcmp(type,"matrix-global") == 0) { diff --git a/src/fix_dummy.h b/src/fix_dummy.h index 6a97a2ca3682c8b93fb47e179b673729b8fd9889..86e56291b549173530c839bb368ad076cddc0d7f 100644 --- a/src/fix_dummy.h +++ b/src/fix_dummy.h @@ -45,6 +45,8 @@ class FixMultisphere : public Fix { void set_v_integrate(double *v) {} int belongs_to(int i) {return -1;} + void* extract(char*& a, int& b, int& c) {return NULL;} + int calc_n_steps(int iatom,double *p_ref,double *normalvec,double *v_normal) { return 0; } diff --git a/src/fix_wall_gran.cpp b/src/fix_wall_gran.cpp index d1ff340305f7f1618d6c8bf914c9c665aa0175b5..c3c22d255973fc53c671f72d6d288a873d970f2f 100644 --- a/src/fix_wall_gran.cpp +++ b/src/fix_wall_gran.cpp @@ -670,7 +670,7 @@ void FixWallGran::post_force_primitive(int vflag) if(deltan > 0.) { - vectorZeroizeN(c_history[iPart],dnum_); + if(c_history) vectorZeroizeN(c_history[iPart],dnum_); } else { @@ -680,7 +680,7 @@ void FixWallGran::post_force_primitive(int vflag) vectorCross3D(shearAxisVec_,rdist,v_wall); } - post_force_eval_contact(iPart,deltan,delta,v_wall,c_history[iPart],NULL); + post_force_eval_contact(iPart,deltan,delta,v_wall,c_history?c_history[iPart]:0,NULL); } } } diff --git a/src/vector_liggghts.h b/src/vector_liggghts.h index 43d2133a3aec2cfb19942bd3405567df41634dd1..22d536e56c494beff322d22671fed21350935f81 100644 --- a/src/vector_liggghts.h +++ b/src/vector_liggghts.h @@ -419,7 +419,7 @@ inline void printVecN(FILE *out,char *name, int *vec, int n) { fprintf(out," vector %s:\n",name); for(int i = 0; i < n; i++) - fprintf(out,"%d \n",vec[i]); + fprintf(out,"%d ",vec[i]); fprintf(out,"\n"); } diff --git a/src/version_liggghts.h b/src/version_liggghts.h index 7d7d3a294c6828047c393ef39edced8663f66875..e1a70f113f92d95deed711b4d6b0c33d468fb1a2 100644 --- a/src/version_liggghts.h +++ b/src/version_liggghts.h @@ -1 +1 @@ -#define LIGGGHTS_VERSION "LIGGGHTS-PUBLIC 2.3.1, compiled 2013-03-28-21:52:06 by ckloss" +#define LIGGGHTS_VERSION "LIGGGHTS-PUBLIC 2.3.2, compiled 2013-03-29-16:39:37 by ckloss" diff --git a/src/version_liggghts.txt b/src/version_liggghts.txt index 2bf1c1ccf363acd53eaf92ef33a7f11f5f4557c2..f90b1afc082fd7893e2baff542cf85cfb803c551 100644 --- a/src/version_liggghts.txt +++ b/src/version_liggghts.txt @@ -1 +1 @@ -2.3.1 +2.3.2