Skip to content

Commit

Permalink
Merged in bopkth/ipic3d-klm (pull request #3)
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
bopkth committed Jul 4, 2016
2 parents 8e11dd4 + d91f8f7 commit 8206bb5
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 19 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") ## Xeon
set(CMAKE_CXX_COMPILER "icpc")
endif()
#set(CMAKE_CXX_FLAGS "-O3 -openmp -g -xHost -fno-exceptions -vec-report")
set(CMAKE_CXX_FLAGS "-O3 ") # -DPRINTPCL for printing particle subcycles -DNO_HDF5 to disable output
set(CMAKE_CXX_FLAGS "-O3 -DNO_HDF5 -DPRINTPCL") # -DPRINTPCL for printing particle subcycles -DNO_HDF5 to disable output
else()
set(CMAKE_CXX_FLAGS "-O3")
endif()
Expand All @@ -52,13 +52,13 @@ endif()
SITE_NAME(myhostname)
if (${myhostname} MATCHES "(.*)pdc(.*)")
set(HDF5_INCLUDE_DIRS /opt/cray/hdf5/1.8.7/cray/73/include)
elseif(${myhostname} MATCHES "localhost")
set(CMAKE_CXX_COMPILER mpicc)
set(CMAKE_CXX_FLAGS "-O2")
set(CMAKE_PREFIX_PATH /Users/Ivy/Software/install/hdf5-1.8.14/)
find_package(HDF5 COMPONENTS HL C )
else()
find_package(HDF5 COMPONENTS HL C )
#elseif(${myhostname} MATCHES "localhost")
# set(CMAKE_CXX_COMPILER mpicc)
# set(CMAKE_CXX_FLAGS "-O2")
# set(CMAKE_PREFIX_PATH /Users/Ivy/Software/install/hdf5-1.8.14/)
# find_package(HDF5 COMPONENTS HL C )
#else()
# find_package(HDF5 COMPONENTS HL C )
endif()


Expand Down
152 changes: 152 additions & 0 deletions inputfiles/testGEM2D_NoHDF5.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Publications that use results from iPIC3D need to properly cite
# 'S. Markidis, G. Lapenta, and Rizwan-uddin. "Multi-scale simulations of
# plasma with iPIC3D." Mathematics and Computers in Simulation 80.7 (2010): 1509-1519.'
#
# Copyright 2015 KTH Royal Institute of Technology
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

SaveDirName = data
RestartDirName = data

# New flags:
Case = GEM # Select the case
PoissonCorrection = no # Poisson correction
WriteMethod = pvtk
SimulationName = testGEM8p # Simulation name for the output

# %%%%%%%%%%%%%%%%%%% Magnetic Reconnection %%%%%%%%%%%%%%%%%%
B0x = 0.0195
B0y = 0.0
B0z = 0.0
delta = 0.5


# %%%%%%%%%%%%%%%%%%% TIME %%%%%%%%%%%%%%%%%%
dt = 0.15 # dt = time step
ncycles = 201 # cycles
th = 1.0 # th = decentering parameter
c = 1.0

# %%%%%%%%%%%%%%%%%%% SMOOTH %%%%%%%%%%%%%%%%%%
Smooth = 0.2 # Smoothing value (5-points stencil)

Lx = 20 # Lx = simulation box length - x direction
Ly = 10 # Ly = simulation box length - y direction
Lz = 10 # Lz = simulation box length - z direction
nxc = 240 # nxc = number of cells - x direction
nyc = 120 # nyc = number of cells - y direction
nzc = 1 # nzc = number of cells - z direction

# %%%%%%%%%%%%%% MPI TOPOLOGY %%%%%%%%%%%%%%
# number of MPI subdomains in each direction
XLEN = 6
YLEN = 3
ZLEN = 1
# topology of subdomains in each dimension (1=true, 0=false)
PERIODICX = 1
PERIODICY = 0
PERIODICZ = 1


# %%%%%%%%%%%%%% PARTICLES %%%%%%%%%%%%%%%%%
# ns = number of species
# 0 = electrons
# 1 = protons
# ...
ns = 4

# qom = charge to mass ratio for different species */
qom = -64.0 1.0 -64 1.0

# Initial density (make sure that plasma is neutral)
rhoINIT = 1.0 1.0 0.1 0.1
rhoINJECT = 0.0 0.0 0.0 0.0

# TrackParticleID[species] = 1=true, 0=false --> Assign ID to particles
TrackParticleID= 1 1 1 1

# uth = thermal velocity for different species - Direction X */
uth = 0.045 0.0126 0.045 0.0126
# vth = thermal velocity for different species - Direction Y */
vth = 0.045 0.0126 0.045 0.0126
# wth = thermal velocity for different species - Direction Z */
wth = 0.045 0.0126 0.045 0.0126
# u0 = drift velocity - Direction X */
u0 = 0.0 0.0 0.0 0.0
# v0 = drift velocity - Direction Y */
v0 = 0.0 0.0 0.0 0.0
# w0 = drift velocity - Direction Z */
w0 = 0.0065 -0.0325 0.0 0.0

# npcelx = number of particles per cell - Direction X
npcelx = 3 3 3 3
# npcely = number of particles per cell - Direction Y */
npcely = 3 3 3 3
# npcelz = number of particles per cell - Direction Z */
npcelz = 3 3 3 3

# &&&&&&&&&&&& boundary conditions &&&&&&&&&&&&&&&
# PHI Electrostatic Potential
# 0,1 = Dirichilet boundary condition
# 2 = Neumann boundary condition
bcPHIfaceXright = 1
bcPHIfaceXleft = 1
bcPHIfaceYright = 1
bcPHIfaceYleft = 1
bcPHIfaceZright = 1
bcPHIfaceZleft = 1

# EM field boundary condition
# 0 = perfect conductor
# 1 = magnetic mirror

bcEMfaceXright = 0
bcEMfaceXleft = 0
bcEMfaceYright = 0
bcEMfaceYleft = 0
bcEMfaceZright = 0
bcEMfaceZleft = 0
# Particles Boundary condition
# 0 = exit
# 1 = perfect mirror
# 2 = riemission
# Caveat: if your processor topology is set to be periodic in a direction automatically the boundary condition in that direction will be periodic*/
bcPfaceXright = 1
bcPfaceXleft = 1
bcPfaceYright = 1
bcPfaceYleft = 1
bcPfaceZright = 1
bcPfaceZleft = 1

# print to video results */
verbose = 1

# velocity of the injection from the wall
Vinj= 0.0

# CG solver stopping criterium tolerance
CGtol = 1E-3
# GMRES solver stopping criterium tolerance
GMREStol = 1E-3
# mover predictor corrector iteration
NiterMover = 5
# Output for field
FieldOutputCycle = 5
FieldOutputTag = B+E+Je+Ji
MomentsOutputTag = rho+PXX+PXY+PXZ+PYY+PYZ+PZZ
# Output for particles if 0 it doesnt save particles data
ParticlesOutputCycle = 0
ParticlesOutputTag = position+velocity+q
# restart cycle
RestartOutputCycle = 0
CallFinalize=0
17 changes: 10 additions & 7 deletions particles/Particles3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,15 @@ void Particles3D::mover_PC_AoS(Field * EMf)
{
convertParticlesToAoS();

/*
#ifdef PRINTPCL
#pragma omp master
if (vct->getCartesian_rank() == 0) {
cout << "***AoS MOVER species " << ns << " *** Max." << NiterMover << " ITERATIONS ****" << endl;
}*/

}
int sum_innter = 0;
#endif
const_arr4_pfloat fieldForPcls = EMf->get_fieldForPcls();
//int sum_innter = 0;


const double dto2 = .5 * dt, qdto2mc = qom * dto2 / c;
#pragma omp for schedule(static)
Expand Down Expand Up @@ -758,7 +759,7 @@ void Particles3D::mover_PC_AoS(Field * EMf)

}// end of iteration

//sum_innter +=innter;
sum_innter +=innter;

// update the final position and velocity
if(cap_velocity())
Expand All @@ -785,10 +786,12 @@ void Particles3D::mover_PC_AoS(Field * EMf)
pcl->set_v(2.0 * vavg - vorig);
pcl->set_w(2.0 * wavg - worig);
}// END OF ALL THE PARTICLES
/*

#ifdef PRINTPCL
if (vct->getCartesian_rank() == 0) {
cout << "***AoS MOVER species " << ns << " *** Avg." << (double)sum_innter/((double)getNOP()) << " ITERATIONS ****" << endl;
}*/
}
#endif
}
}

Expand Down
8 changes: 4 additions & 4 deletions performances/Timing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/**
*
* series of methods for timing and profiling PARSEK
* series of methods for timing and profiling
* @date Fri Jun 4 2007
* @author Stefano Markidis, Giovanni Lapenta
* @version 2.0
Expand Down Expand Up @@ -76,17 +76,17 @@ void Timing::stopTiming() {
if (rank_id == 0) {
// replace %g with %11.3e?
printf( "\n\n*** SIMULATION ENDED SUCESSFULLY ***\n"
" PARSEK Simulation Time: %g sec (%g hours)\n***\n\n",
" Simulation Time: %g sec (%g hours)\n***\n\n",
texecution, texecution / 3600);
//cout << endl;
//cout << endl;
//cout << "*** SIMULATION ENDED SUCESSFULLY ***" << endl;
//cout << " PARSEK Simulation Time: " << texecution << " sec" << " (" << texecution / 3600 << " hours)" << endl;
//cout << " Simulation Time: " << texecution << " sec" << " (" << texecution / 3600 << " hours)" << endl;
//cout << "***" << endl;
//cout << endl;
}
// close the log file
// MPE_Finish_log("PARSEK_LOG");
// MPE_Finish_log("iPIC3D_LOG");
}

/** start timing the mover */
Expand Down

0 comments on commit 8206bb5

Please sign in to comment.