Esempio n. 1
0
/** Performs a full initialization of
 *  the Lattice Boltzmann system. All derived parameters
 *  and the fluid are reset to their default values. */
void lb_init_gpu() {

  /** set parameters for transfer to gpu */
  lb_reinit_parameters_gpu();

  lb_realloc_particles_gpu();
	
  lb_realloc_fluid_gpu();

  lb_init_GPU(&lbpar_gpu);

  LB_TRACE (fprintf(stderr,"lb_init_gpu \n"));
}
Esempio n. 2
0
/** Performs a full initialization of
 *  the Lattice Boltzmann system. All derived parameters
 *  and the fluid are reset to their default values. */
void lb_init_gpu() {

  LB_TRACE(printf("Begin initialzing fluid on GPU\n"));
  /** set parameters for transfer to gpu */
  lb_reinit_parameters_gpu();

  lb_realloc_particles_gpu();

  lb_init_GPU(&lbpar_gpu);
  
  gpu_init_particle_comm();
  cuda_bcast_global_part_params();

  LB_TRACE(printf("Initialzing fluid on GPU successful\n"));
}
Esempio n. 3
0
/** (Re-)initializes the fluid according to the given value of rho. */
void lb_reinit_fluid_gpu() {

  //lbpar_gpu.your_seed = (unsigned int)i_random(max_ran);
  lb_reinit_parameters_gpu();
//#ifdef SHANCHEN
//  lb_calc_particle_lattice_ia_gpu();
//  copy_forces_from_GPU();
//#endif 
  if(lbpar_gpu.number_of_nodes != 0){
    lb_reinit_GPU(&lbpar_gpu);
    lbpar_gpu.reinit = 1;
  }

  LB_TRACE (fprintf(stderr,"lb_reinit_fluid_gpu \n"));
}
Esempio n. 4
0
void on_lb_params_change_gpu(int field) {
    EVENT_TRACE(fprintf(stderr, "%d: on_lb_params_change_gpu\n", this_node));

#ifdef LB_GPU
    if (field == LBPAR_AGRID) {
        lb_init_gpu();
#ifdef LB_BOUNDARIES_GPU
        lb_init_boundaries();
#endif
    }
    if (field == LBPAR_DENSITY) {
        lb_reinit_fluid_gpu();
    }

    lb_reinit_parameters_gpu();
#endif
}
Esempio n. 5
0
void on_temperature_change()
{
  EVENT_TRACE(fprintf(stderr, "%d: on_temperature_change\n", this_node));

#ifdef LB
  if (lattice_switch & LATTICE_LB) {
    lb_reinit_parameters();
  }
#endif
#ifdef LB_GPU
  if(this_node == 0) {
    if (lattice_switch & LATTICE_LB_GPU) {
      lb_reinit_parameters_gpu();
    }
  }
#endif
}
Esempio n. 6
0
void on_parameter_change(int field)
{
    EVENT_TRACE(fprintf(stderr, "%d: on_parameter_change %s\n", this_node, fields[field].name));

    switch (field) {
    case FIELD_BOXL:
        grid_changed_box_l();
        /* Electrostatics cutoffs mostly depend on the system size,
           therefore recalculate them. */
        recalc_maximal_cutoff();
        cells_on_geometry_change(0);
        break;
    case FIELD_MIN_GLOBAL_CUT:
        recalc_maximal_cutoff();
        cells_on_geometry_change(0);
        break;
    case FIELD_SKIN:
        cells_on_geometry_change(0);
    case FIELD_PERIODIC:
        cells_on_geometry_change(CELL_FLAG_GRIDCHANGED);
        break;
    case FIELD_NODEGRID:
        grid_changed_n_nodes();
        cells_on_geometry_change(CELL_FLAG_GRIDCHANGED);
        break;
    case FIELD_MINNUMCELLS:
    case FIELD_MAXNUMCELLS:
        cells_re_init(CELL_STRUCTURE_CURRENT);
    case FIELD_TEMPERATURE:
        on_temperature_change();
        reinit_thermo = 1;
        break;
    case FIELD_TIMESTEP:
#ifdef LB_GPU
        if(this_node == 0) {
            if (lattice_switch & LATTICE_LB_GPU) {
                lb_reinit_parameters_gpu();
            }
        }
#endif
#ifdef LB
        if (lattice_switch & LATTICE_LB) {
            lb_reinit_parameters();
        }
#endif
    case FIELD_LANGEVIN_GAMMA:
    case FIELD_DPD_TGAMMA:
    case FIELD_DPD_GAMMA:
    case FIELD_NPTISO_G0:
    case FIELD_NPTISO_GV:
    case FIELD_NPTISO_PISTON:
        reinit_thermo = 1;
        break;
#ifdef NPT
    case FIELD_INTEG_SWITCH:
        if (integ_switch != INTEG_METHOD_NPT_ISO)
            nptiso.invalidate_p_vel = 1;
        break;
#endif
    case FIELD_THERMO_SWITCH:
        /* DPD needs ghost velocities, other thermostats not */
        on_ghost_flags_change();
        break;
#ifdef LB
    case FIELD_LATTICE_SWITCH:
        /* LB needs ghost velocities */
        on_ghost_flags_change();
        break;
#endif
    }
}