1 /* -*- c++ -*- ----------------------------------------------------------- 2 LAMMPS 2003 (July 31) - Molecular Dynamics Simulator 3 Sandia National Laboratories, www.cs.sandia.gov/~sjplimp/lammps.html 4 Steve Plimpton, sjplimp@sandia.gov 5 6 Copyright (2003) Sandia Corporation. Under the terms of Contract 7 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 8 certain rights in this software. This software is distributed under 9 the GNU General Public License. 10 11 For more info, see the README file in the top-level LAMMPS directory. 12 ------------------------------------------------------------------------ */ 13 14 #ifdef FIX_CLASS 15 // clang-format off 16 FixStyle(lb/fluid,FixLbFluid); 17 // clang-format on 18 #else 19 20 #ifndef LMP_FIX_LB_FLUID_H 21 #define LMP_FIX_LB_FLUID_H 22 23 #include "fix.h" 24 25 #if defined(MPI_STUBS) 26 #error "The LATBOLTZ package cannot be compiled in serial with MPI STUBS" 27 #endif 28 29 namespace LAMMPS_NS { 30 31 class FixLbFluid : public Fix { 32 friend class FixLbMomentum; 33 friend class FixLbRigidPCSphere; 34 friend class FixLbPC; 35 friend class FixLbViscous; 36 37 public: 38 FixLbFluid(class LAMMPS *, int, char **); 39 ~FixLbFluid(); 40 int setmask(); 41 void init(); 42 void initial_integrate(int); 43 void setup(int); 44 void post_force(int); 45 void end_of_step(); 46 47 void grow_arrays(int); 48 void copy_arrays(int, int, int); 49 int pack_exchange(int, double *); 50 int unpack_exchange(int, double *); 51 52 private: 53 double viscosity, densityinit_real, a_0_real, T; 54 int setdx, seta0; 55 int numvel; 56 57 double dm_lb, dx_lb, dt_lb; // Lattice units for mass, distance, time. 58 59 int Nbx, Nby, Nbz; // Total # of x,y,z grid points. 60 int subNbx, subNby, subNbz; // # of x,y,z, grid points (including buffer) 61 // on local processor. 62 int me, nprocs; // MPI variables: processor ID, # of processors 63 MPI_Datatype oneslice; // MPI datatypes to pass arrays. 64 MPI_Datatype passxu, passyu, passzu; 65 MPI_Datatype passxf, passyf, passzf; 66 MPI_Datatype passxrho, passyrho, passzrho; 67 MPI_Datatype passxtemp, passytemp, passztemp; 68 69 double kB, densityinit, a_0; // Boltzmann constant, initial density, 70 // and a_0 all in lattice units. 71 double *Gamma; 72 double *NodeArea; 73 int setGamma, setArea; 74 double **hydroF; 75 76 int groupbit_viscouslb, groupbit_pc, groupbit_rigid_pc_sphere; 77 78 double ***density_lb; // fluid density 79 double ****u_lb; // fluid velocity 80 double ****f_lb; // distributions 81 double ****fnew; // used in the calculation of the new 82 // distributions. 83 double ****feq; // equilibrium distributions 84 double ****feqold; // equilibrium distributions from previous 85 // timestep 86 87 double ****feqn; // equilibrium distributions without noise. 88 double ****feqoldn; // equilibrium distributions from previous 89 // timestep without noise. 90 double ****Ff; // Force from the MD particles on the fluid. 91 double ****Fftempx; 92 double ****Fftempy; 93 double ****Fftempz; 94 95 double *Ng_lb; // Lattice Boltzmann variables. 96 double *w_lb; 97 double **mg_lb; 98 int **e; 99 double tau; 100 double expminusdtovertau; 101 double Dcoeff; 102 double K_0; 103 double dtoverdtcollision; 104 105 int step; 106 107 double ****buf; // arrays used to output data. 108 double ****buf2; 109 double ****altogether; 110 double ****altogether2; 111 112 double bodyforcex, bodyforcey, bodyforcez; // Body Forces acting on the fluid (default=0) 113 double vwtp, vwbt; // Velocities of the z walls in the y 114 // direction. (must have fixed boundary 115 // conditions in z) 116 117 int noisestress; // 1 to include noise in the system, 118 // 0 otherwise. 119 double namp, noisefactor; 120 int seed; 121 class RanMars *random; 122 123 int force_diagnostic; // 1 to print out the force action on a group 124 // of particles, 0 otherwise. 125 int igroupforce; // the group for which the force is to be 126 // printed. 127 128 int typeLB; 129 130 int trilinear_stencil; // 1 to use the trilinear stencil, 0 to use the 131 // peskin stencil. 132 133 int readrestart; // 1 to read in data from a restart file. 134 MPI_File pFileRead; 135 136 int printrestart; // 1 to write data to a restart file. 137 MPI_File pFileWrite; 138 139 int printfluid; 140 int fixviscouslb; 141 142 void rescale(void); 143 void (FixLbFluid::*initializeLB)(void); 144 void initializeLB15(void); 145 void initializeLB19(void); 146 void initialize_feq(void); 147 void (FixLbFluid::*equilibriumdist)(int, int, int, int, int, int); 148 void equilibriumdist15(int, int, int, int, int, int); 149 void equilibriumdist19(int, int, int, int, int, int); 150 void parametercalc_part(int, int, int, int, int, int); 151 void parametercalc_full(void); 152 void update_periodic(int, int, int, int, int, int); 153 void (FixLbFluid::*update_full)(void); 154 void update_full15(void); 155 void update_full19(void); 156 void streamout(void); 157 void read_restartfile(void); 158 void write_restartfile(void); 159 void peskin_interpolation(int); 160 void trilinear_interpolation(int); 161 void calc_fluidforce(void); 162 }; 163 } // namespace LAMMPS_NS 164 #endif 165 #endif 166