Commit 8f5384bc authored by David Moxey's avatar David Moxey

Merge remote-tracking branch 'upstream/master' into fix/boost-compiler

parents 03fedf35 bfbc57f4
Pipeline #1148 passed with stages
......@@ -57,7 +57,7 @@ v5.0.0
- Fix ability to have periodic boundary conditions that are aligned by a
rotation rather than just a translation (!933)
- Added a coupling interface to exchange data between solvers at run time
and a DummySolver to test the implementations (!853, !931, !950, !973)
and a DummySolver to test the implementations (!853, !931, !950, !973, !1017)
- Fix compilation issue with newer Boost versions and clang (!940)
- If only `NEKTAR_BUILD_LIBRARY` is enabled, only libraries up to and including
`MultiRegions` will be built by default (!945)
......
......@@ -88,6 +88,13 @@ IF (NEKTAR_BUILD_PYTHON)
# If we can't find it, pull it from git and compile it
IF (NOT BOOST_NUMPY_LIB)
INCLUDE(ExternalProject)
IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
SET(WARNING_FLAGS "-Wno-cpp")
ENDIF()
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET(WARNING_FLAGS "-Wno-#warnings")
ENDIF()
EXTERNALPROJECT_ADD(
boost-numpy
PREFIX ${TPSRC}
......@@ -101,7 +108,7 @@ IF (NEKTAR_BUILD_PYTHON)
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX:PATH=${TPDIST}
-DCMAKE_CXX_FLAGS="-Wno-cpp"
-DCMAKE_CXX_FLAGS=${WARNING_FLAGS}
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DLIBRARY_TYPE=STATIC
${TPSRC}/boost-numpy
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
PROJECT(libccmio)
# compile in Release mode by default
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
......
......@@ -1565,7 +1565,7 @@ file:
\begin{itemize}
\item The \inltt{Flowrate} parameter in the parameters section, which defines
the desired value of the volumetric flux $Q(\mathbf{u})$ through the reference
region. To set $Q = 1$ we would therefore define:
region. To set a flux per unit surface of $Q = 1$ we would therefore define:
\begin{lstlisting}[style=XMLStyle]
<PARAMETERS>
<P> Flowrate = 1.0 </P>
......@@ -1603,9 +1603,9 @@ file:
\end{lstlisting}
\end{itemize}
Note that in homogeneous simulations where the forcing is in the $z$-direction,
only the \inltt{Flowrate} parameter is required and the reference area $R$ is
taken to be the homogeneous plane.
Importantly, note that in homogeneous simulations where the forcing is in the
$z$-direction only the \inltt{Flowrate} parameter should be specified, and the
reference area $R$ is taken to be the homogeneous plane.
Optionally, the \inltt{IO\_FlowSteps} parameter can be defined. If set to a
non-zero integer, this produces a file \inltt{session.prs} which records the
......
......@@ -95,7 +95,7 @@ Unlike the File-type coupling, a linear interpolation in time is applied to the
<I PROPERTY="RemoteName" VALUE="Dummy1" />
<I PROPERTY="SendSteps" VALUE="1" />
<I PROPERTY="SendVariables" VALUE="u0S,v0S" />
<I PROPERTY="SendMethod" VALUE="NearestNeighbour" />
<I PROPERTY="SendMethod" VALUE="Evaluate" />
<I PROPERTY="ReceiveSteps" VALUE="1" />
<I PROPERTY="ReceiveVariables" VALUE="u0R,v0R" />
<I PROPERTY="Oversample" VALUE="5" />
......@@ -105,10 +105,8 @@ Unlike the File-type coupling, a linear interpolation in time is applied to the
\end{lstlisting}
Additional options which define the coupling include \inltt{SendMethod}, the method used to retrieve the physical values at the locations requested by the remote application.
Available options are \inltt{NearestNeighbour}, \inltt{Shepard} and \inltt{Evaluate}.
The nearest neighbor interpolation gives the best performance at the cost of accuracy.
The last option directly evaluates the expansions using a backward transform, giving superior accuracy while being the most computationally expensive.
The Shepard interpolation can be a good compromise between computational efficiency and accuracy.
Available options are \inltt{NearestNeighbour}, \inltt{Shepard} and the default \inltt{Evaluate}.
The last option directly evaluates the expansions using a backward transform, giving superior accuracy at acceptable computational cost.
When using non-conforming domains, the current application might request values outside of the computational domain of the remote application.
How to handle these not-located points is specified by the \inltt{NotLocMethod} parameter.
......@@ -125,7 +123,7 @@ Note that this can be very inefficient when using many MPI ranks.
\midrule
\inltt{RemoteName} & \cmark & - &
Name of the remote application.\\
\inltt{SendMethod} & \xmark & \inltt{NearestNeighbour} &
\inltt{SendMethod} & \xmark & \inltt{Evaluate} &
Specifies how to evaluate fields before sending. Available options are \inltt{NearestNeighbour}, \inltt{Shepard} and \inltt{Evaluate}.\\
\inltt{Oversample} & \xmark & 0 &
Receive fields at a higher (or lower) number of quadrature points before filtering to avoid aliasing.\\
......
......@@ -199,11 +199,23 @@ namespace Nektar
UpdateBndCondExpansion(cnt);
}
// Initialise comm for the boundary regions
auto comm = boundaryCondition->GetComm();
int size = boundaryCondition->GetComm()->GetSize();
if(size > 1)
{
// It seems to work either way
// comm->SplitComm(1,size);
comm->SplitComm(m_StripZcomm->GetSize(),
size/m_StripZcomm->GetSize());
}
m_bndCondExpansions[cnt++] =
MemoryManager<ExpList2DHomogeneous1D>::
MemoryManager<MultiRegions::ExpList2DHomogeneous1D>::
AllocateSharedPtr(m_session, HomoBasis, lhom,
m_useFFT, false,
PlanesBndCondExp);
PlanesBndCondExp, comm);
}
EvaluateBoundaryConditions(0.0, variable);
}
......
......@@ -56,12 +56,18 @@ namespace Nektar
const NekDouble lhom,
const bool useFFT,
const bool dealiasing,
const Array<OneD, ExpListSharedPtr> &planes)
const Array<OneD, ExpListSharedPtr> &planes,
const LibUtilities::CommSharedPtr comm)
: ExpListHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing)
{
SetExpType(e2DH1D);
int i, n, cnt, nel;
if (comm)
{
m_comm = comm;
}
ASSERTL1(m_planes.num_elements() == planes.num_elements(),
"Size of basis number of points and number"
"of planes are not the same");
......@@ -492,7 +498,8 @@ namespace Nektar
}
}
NekDouble ExpList2DHomogeneous1D::v_Integral(const Array<OneD, const NekDouble> &inarray)
NekDouble ExpList2DHomogeneous1D::v_Integral(const Array<OneD,
const NekDouble> &inarray)
{
NekDouble val = 0.0;
int i = 0;
......@@ -503,7 +510,7 @@ namespace Nektar
}
val *= m_lhom/m_homogeneousBasis->GetNumModes();
m_comm->GetColumnComm()->AllReduce(val, LibUtilities::ReduceSum);
m_comm->AllReduce(val, LibUtilities::ReduceSum);
return val;
}
......
......@@ -80,7 +80,9 @@ namespace Nektar
const NekDouble lhom,
const bool useFFT,
const bool dealiasing,
const Array<OneD, ExpListSharedPtr> &planes);
const Array<OneD, ExpListSharedPtr> &planes,
const LibUtilities::CommSharedPtr comm =
LibUtilities::CommSharedPtr());
/// Copy constructor.
MULTI_REGIONS_EXPORT ExpList2DHomogeneous1D(
......
......@@ -137,7 +137,7 @@ CouplingCwipi::CouplingCwipi(MultiRegions::ExpListSharedPtr field)
m_config["OVERSAMPLE"] = "0";
m_config["FILTERWIDTH"] = "-1";
m_config["DUMPRAW"] = "0";
m_config["SENDMETHOD"] = "NEARESTNEIGHBOUR";
m_config["SENDMETHOD"] = "EVALUATE";
m_config["NOTLOCMETHOD"] = "KEEP";
}
......
......@@ -421,7 +421,7 @@ std::array<NekDouble, 6> Geometry::GetBoundingBox()
}
// Return bounding box
return { min[0], min[1], min[2], max[0], max[1], max[2] };
return {{ min[0], min[1], min[2], max[0], max[1], max[2] }};
}
/**
......
......@@ -187,7 +187,7 @@ namespace Nektar
// chiRoe and kappaRoe (eq 66)
NekDouble chiRoe, kappaRoe;
NekDouble fac = D - deltaP*deltaRho;
if( abs(fac) > NekConstants::kNekZeroTol)
if( std::abs(fac) > NekConstants::kNekZeroTol)
{
chiRoe = (D*avgChi + s*s*deltaRho*dP) / fac;
kappaRoe = D*avgKappa / fac;
......
......@@ -12,7 +12,7 @@
<I PROPERTY="NotLocMethod" VALUE="Extrapolate" />
<I PROPERTY="SendSteps" VALUE="1" />
<I PROPERTY="SendVariables" VALUE="u0S,v0S,F_0_u0S,F_0_v0S" />
<I PROPERTY="SendMethod" VALUE="NEARESTNEIGHBOUR" />
<I PROPERTY="SendMethod" VALUE="EVALUATE" />
</COUPLING>
<CONDITIONS>
<SOLVERINFO>
......
......@@ -231,10 +231,10 @@ namespace Nektar
// Define flag for case with homogeneous expansion and forcing not in the
// z-direction
m_Hom1DExplicit = false;
m_homd1DFlowinPlane = false;
if (defined && m_HomogeneousType == eHomogeneous1D)
{
m_Hom1DExplicit = true;
m_homd1DFlowinPlane = true;
}
// For 3DH1D simulations, if force isn't defined then assume in
......@@ -266,7 +266,7 @@ namespace Nektar
// For a boundary, extract the boundary itself.
m_flowrateBnd = m_fields[0]->GetBndCondExpansions()[m_flowrateBndID];
}
else if (m_HomogeneousType == eHomogeneous1D && !m_Hom1DExplicit)
else if (m_HomogeneousType == eHomogeneous1D && !m_homd1DFlowinPlane)
{
// For 3DH1D simulations with no force specified, find the mean
// (0th) plane.
......@@ -303,6 +303,36 @@ namespace Nektar
}
m_comm->AllReduce(m_flowrateArea, LibUtilities::ReduceMax);
// In homogeneous case with forcing not aligned to the z-direction,
// redefine m_flowrateBnd so it is a 1D expansion
if (m_HomogeneousType == eHomogeneous1D && m_homd1DFlowinPlane &&
m_flowrateBnd)
{
// For 3DH1D simulations with no force specified, find the mean
// (0th) plane.
Array<OneD, unsigned int> zIDs = m_fields[0]->GetZIDs();
m_planeID = -1;
for (int i = 0; i < zIDs.num_elements(); ++i)
{
if (zIDs[i] == 0)
{
m_planeID = i;
break;
}
}
ASSERTL1(m_planeID <= 0, "Should be either at location 0 or -1 if not "
"found");
if (m_planeID != -1)
{
m_flowrateBnd = m_fields[0]
->GetBndCondExpansions()[m_flowrateBndID]
->GetPlane(m_planeID);
}
}
// Set up some storage for the Stokes solution (to be stored in
// m_flowrateStokes) and its initial condition (inTmp), which holds the
// unit forcing.
......@@ -383,23 +413,42 @@ namespace Nektar
// the boundary.
Array<OneD, Array<OneD, NekDouble> > boundary(m_spacedim);
for (int i = 0; i < m_spacedim; ++i)
if(!m_homd1DFlowinPlane)
{
m_fields[i]->ExtractPhysToBnd(
m_flowrateBndID, inarray[i], boundary[i]);
// General case
for (int i = 0; i < m_spacedim; ++i)
{
m_fields[i]->ExtractPhysToBnd(m_flowrateBndID, inarray[i],
boundary[i]);
}
flowrate = m_flowrateBnd->VectorFlux(boundary);
}
else if(m_planeID == 0)
{
//Homogeneous with forcing in plane. Calculate flux only on
// the meanmode - calculateFlux necessary for hybrid
// parallelisation.
for (int i = 0; i < m_spacedim; ++i)
{
m_fields[i]->GetPlane(m_planeID)->ExtractPhysToBnd(
m_flowrateBndID, inarray[i], boundary[i]);
}
flowrate = m_flowrateBnd->VectorFlux(boundary);
// the flowrate is calculated on the mean mode so it needs to be
// multiplied by LZ to be consistent with the general case.
flowrate = m_flowrateBnd->VectorFlux(boundary) *
m_session->GetParameter("LZ");
}
}
else if (m_flowrateBnd && !m_Hom1DExplicit)
else if (m_flowrateBnd && !m_homd1DFlowinPlane)
{
// 3DH1D case with no Flowrate boundary defined: compute flux through
// the zero-th (mean) plane.
// 3DH1D case with no Flowrate boundary defined: compute flux
// through the zero-th (mean) plane.
flowrate = m_flowrateBnd->Integral(inarray[2]);
}
// Communication to obtain the total flowrate
if(!m_Hom1DExplicit && m_HomogeneousType == eHomogeneous1D)
if(!m_homd1DFlowinPlane && m_HomogeneousType == eHomogeneous1D)
{
m_comm->GetColumnComm()->AllReduce(flowrate, LibUtilities::ReduceSum);
}
......@@ -407,7 +456,6 @@ namespace Nektar
{
m_comm->AllReduce(flowrate, LibUtilities::ReduceSum);
}
return flowrate / m_flowrateArea;
}
......
......@@ -137,13 +137,15 @@ namespace Nektar
/// Area of the boundary through which we are measuring the flowrate
NekDouble m_flowrateArea;
// Bool to identify 3D1HD with forcing explicitly defined
bool m_Hom1DExplicit;
bool m_homd1DFlowinPlane;
/// Flux of the Stokes function solution
NekDouble m_greenFlux;
/// Current flowrate correction
NekDouble m_alpha;
/// Boundary ID of the flowrate reference surface
int m_flowrateBndID;
/// Plane ID for cases with homogeneous expansion
int m_planeID;
/// Flowrate reference surface
MultiRegions::ExpListSharedPtr m_flowrateBnd;
/// Stokes solution used to impose flowrate
......
......@@ -48,13 +48,13 @@ ADD_DEPENDENCIES(Tester boost tinyxml-2.6.2)
IF( ${CMAKE_SYSTEM} MATCHES "Linux.*")
TARGET_LINK_LIBRARIES(Tester optimized rt debug rt)
SET_PROPERTY(TARGET Tester APPEND_STRING PROPERTY COMPILE_FLAGS " -pthread")
SET_PROPERTY(TARGET Tester APPEND_STRING PROPERTY LINK_FLAGS " -pthread")
ENDIF()
IF( ${CMAKE_SYSTEM} MATCHES "Darwin-*")
SET_TARGET_PROPERTIES(Tester
PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup -Wl,-rpath,${Boost_LIBRARY_DIRS}")
SET_PROPERTY(TARGET Tester APPEND_STRING PROPERTY COMPILE_FLAGS " -pthread")
SET_PROPERTY(TARGET Tester APPEND_STRING PROPERTY LINK_FLAGS " -pthread")
ENDIF( ${CMAKE_SYSTEM} MATCHES "Darwin-*")
SET_TARGET_PROPERTIES(Tester
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment