Skip to content

Commit

Permalink
Merge, but also fix some things (mainly that the geometry reader had …
Browse files Browse the repository at this point in the history
…the wrong premable length)
  • Loading branch information
hcarver committed Jan 9, 2012
2 parents fa101ec + 6236f6b commit 9cb6a1f
Show file tree
Hide file tree
Showing 59 changed files with 685 additions and 500 deletions.
2 changes: 1 addition & 1 deletion .hgsubstate
Original file line number Diff line number Diff line change
@@ -1 +1 @@
84e30137ca192ffd22b2426bc473e547c628311f RegressionTests
17380f5a9c3c63bf4627e8d86f49232e18e2ead8 RegressionTests
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ option(HEMELB_USE_STREAKLINES "Calculate streakline images" ON)
option(HEMELB_USE_ALL_WARNINGS_GNU "Show all compiler warnings on development builds (gnu-style-compilers)" ON)
option(HEMELB_USE_BOOST "Use Boost" OFF)
set(HEMELB_OPTIMISATION "-O4" CACHE STRING "Optimisation level (can be blank or -O1 to -O4)")

set(HEMELB_STEERING_HOST "CCS" CACHE STRING "Use a default host suffix for steering? (CCS, NGS2Leeds, NGS2Manchester, LONI, NCSA or blank)")
option(HEMELB_DEPENDENCIES_SET_RPATH "Set runtime RPATH" ON)
#------- Dependencies -----------

add_subdirectory(dependencies)
Expand Down Expand Up @@ -50,6 +51,10 @@ ExternalProject_Add(
-DMPI_CXX_NO_INTERROGATE=${MPI_CXX_NO_INTERROGATE}
-DHEMELB_USE_ALL_WARNINGS_GNU=${HEMELB_USE_ALL_WARNINGS_GNU}
-DHEMELB_USE_BOOST=${HEMELB_USE_BOOST}
-DHEMELB_STEERING_HOST=${HEMELB_STEERING_HOST}
-DCTEMPLATE_USE_STATIC=${CTEMPLATE_USE_STATIC}
-DCPPUNIT_USE_STATIC=${CPPUNIT_USE_STATIC}
-DHEMELB_DEPENDENCIES_SET_RPATH=${HEMELB_DEPENDENCIES_SET_RPATH}
)
ExternalProject_Get_Property(hemelb install_dir)

Expand Down
12 changes: 8 additions & 4 deletions Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ option(HEMELB_BUILD_UNITTESTS "Build the unit-tests" ON)
option(HEMELB_USE_ALL_WARNINGS_GNU "Show all compiler warnings on development builds (gnu-style-compilers)" ON)
option(HEMELB_USE_STREAKLINES "Calculate streakline images" ON)
option(HEMELB_USE_BOOST "Use Boost" OFF)
option(HEMELB_DEPENDENCIES_SET_RPATH "Set runtime RPATH" ON)

set(HEMELB_LOG_LEVEL info
CACHE STRING "Log level, choose 'debug', 'warning', or 'info'" )
set(HEMELB_STEERING_LIB basic
Expand Down Expand Up @@ -42,9 +44,10 @@ list(APPEND CMAKE_INCLUDE_PATH ${HEMELB_DEPENDENCIES_INSTALL_PATH}/include)
list(APPEND CMAKE_LIBRARY_PATH ${HEMELB_DEPENDENCIES_INSTALL_PATH}/lib)

#--- Set up runtime search path for DLLs -----

SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_RPATH "${HEMELB_DEPENDENCIES_PATH}/lib")
if(HEMELB_DEPENDENCIES_SET_RPATH)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_RPATH "${HEMELB_DEPENDENCIES_PATH}/lib")
endif()

#-------Check for platform dependent features ----

Expand Down Expand Up @@ -162,7 +165,8 @@ if(HEMELB_BUILD_UNITTESTS)
${TINYXML_LIBRARIES}
${CPPUNIT_LIBRARY}
${Boost_LIBRARIES}
${CTEMPLATE_LIBRARIES})
${CTEMPLATE_LIBRARIES}
${CMAKE_DL_LIBS}) #Because on some systems CPPUNIT needs to be linked to libdl
INSTALL(TARGETS unittests_hemelb RUNTIME DESTINATION bin)
list(APPEND RESOURCES unittests/resources/four_cube.dat unittests/resources/four_cube.xml unittests/resources/config.xml)
endif()
Expand Down
38 changes: 38 additions & 0 deletions Code/D3Q15.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,42 @@ namespace hemelb
1.0 / 72.0 };

const int D3Q15::INVERSEDIRECTIONS[] = { 0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13 };

/*
* Kinetic moments defined in d'Humieres 2002. To get the matrix below, columns 8 and 9 are respectively permuted
* with columns 14 and 11 to match HemeLB's lattice velocitiy ordering.
*
* See publication for meaning of e, epsilon, etc. Other moments definitions are possible.
*/
const distribn_t D3Q15::REDUCED_MOMENT_BASIS[NUM_KINETIC_MOMENTS][NUMVECTORS] = {{ -2, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1}, // e
{ 16, -4, -4, -4, -4, -4, -4, 1, 1, 1, 1, 1, 1, 1, 1}, // epsilon
{ 0, -4, 4, 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 1, -1}, // q_x
{ 0, 0, 0, -4, 4, 0, 0, 1, -1, 1, -1, -1, 1, -1, 1}, // q_y
{ 0, 0, 0, 0, 0, -4, 4, 1, -1, -1, 1, 1, -1, -1, 1}, // q_z
{ 0, 2, 2, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0}, // 3*p_xx
{ 0, 0, 0, 1, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0}, // p_ww = p_yy - p_zz
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, -1, -1, -1, -1}, // p_xy
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, -1, -1, -1, -1, 1, 1}, // p_yz
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, -1, -1, 1, 1, -1, -1}, // p_zx
{ 0, 0, 0, 0, 0, 0, 0, 1, -1, -1, 1, -1, 1, 1, -1} // m_xyz
};

const distribn_t D3Q15::BASIS_TIMES_BASIS_TRANSPOSED[NUM_KINETIC_MOMENTS] = {18., 360., 40., 40., 40., 12., 4., 8., 8., 8., 8.};



void D3Q15::ProjectVelsIntoMomentSpace(const distribn_t * const velDistributions,
distribn_t * const moments)
{
for (unsigned momentIndex = 0; momentIndex < NUM_KINETIC_MOMENTS; momentIndex++)
{
moments[momentIndex] = 0.;
for (unsigned velocityIndex = 0; velocityIndex < NUMVECTORS; velocityIndex++)
{
moments[momentIndex] += REDUCED_MOMENT_BASIS[momentIndex][velocityIndex]
* velDistributions[velocityIndex];
}
}
}

}
18 changes: 18 additions & 0 deletions Code/D3Q15.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ namespace hemelb

// The index of the inverse direction of each discrete velocity vector
static const int INVERSEDIRECTIONS[NUMVECTORS];

/** Moments can be separated into two groups: a) hydrodynamic (conserved) and b) kinetic (non-conserved). */
static const unsigned NUM_KINETIC_MOMENTS = 11;

/** Matrix used to convert from the velocities space to the reduced moment space containing only kinetic moments. */
static const double REDUCED_MOMENT_BASIS[NUM_KINETIC_MOMENTS][NUMVECTORS];

/** Diagonal matrix REDUCED_MOMENT_BASIS * REDUCED_MOMENT_BASIS'. See #61 for the MATLAB code used to compute it (in case REDUCED_MOMENT_BASIS is modified). */
static const double BASIS_TIMES_BASIS_TRANSPOSED[NUM_KINETIC_MOMENTS];

/**
* Projects a velocity distributions vector into the (reduced) MRT moment space.
*
* @param velDistributions velocity distributions vector
* @param moments equivalent vector in the moment space
*/
static void ProjectVelsIntoMomentSpace(const distribn_t * const velDistributions,
distribn_t * const moments);
};
}
#endif /* HEMELB_D3Q15_H */
6 changes: 0 additions & 6 deletions Code/SimulationMaster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,12 @@ void SimulationMaster::Initialise()

simulationState = new hemelb::lb::SimulationState(simConfig->StepsPerCycle, simConfig->NumCycles);

// TODO The way we initialise LbmParameters is not great.
hemelb::lb::LbmParameters params(1000, 0.1);

hemelb::log::Logger::Log<hemelb::log::Warning, hemelb::log::Singleton>("Initialising LatticeData.");

timings[hemelb::reporting::Timers::netInitialise].Start();
latticeData
= hemelb::geometry::LatticeData::Load(hemelb::steering::SteeringComponent::RequiresSeparateSteeringCore(),
simConfig->DataFilePath,
&params,
timings);
timings[hemelb::reporting::Timers::netInitialise].Stop();

Expand All @@ -145,8 +141,6 @@ void SimulationMaster::Initialise()
simulationState,
timings[hemelb::reporting::Timers::lb]);

latticeBoltzmannModel->GetLbmParams()->StressType = params.StressType;

// Initialise and begin the steering.
if (hemelb::topology::NetworkTopology::Instance()->IsCurrentProcTheIOProc())
{
Expand Down
3 changes: 3 additions & 0 deletions Code/configuration/SimConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ namespace hemelb
TiXmlElement* lSimulationElement = GetChild(iTopNode, "simulation", iIsLoading);
DoIO(lSimulationElement, "cycles", iIsLoading, NumCycles);
DoIO(lSimulationElement, "cyclesteps", iIsLoading, StepsPerCycle);
long dummyStress = -1;
DoIO(lSimulationElement, "stresstype", iIsLoading, dummyStress);
StressType = (lb::StressTypes) dummyStress;

TiXmlElement* lGeometryElement = GetChild(iTopNode, "geometry", iIsLoading);

Expand Down
1 change: 1 addition & 0 deletions Code/configuration/SimConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace hemelb
float MaxStress;
unsigned long NumCycles;
long StepsPerCycle;
lb::StressTypes StressType;

void DoIO(TiXmlElement *iXmlNode,
bool iIsLoading,
Expand Down
2 changes: 1 addition & 1 deletion Code/debug/common/ActiveDebugger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace hemelb
if (mAmAttached)
return;

int amWaiting = 1;
volatile int amWaiting = 1;
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int nProcs;
Expand Down
2 changes: 1 addition & 1 deletion Code/debug/linux/resume.gdb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Get out of sleep and disable the waiting flag
up
up
set var amWaiting = 0
set amWaiting = 0

# Set up a breakpoint for our break function and a command to finish
# it automatically
Expand Down
Loading

0 comments on commit 9cb6a1f

Please sign in to comment.