Skip to content
Snippets Groups Projects
Commit 9e424bc5 authored by Michael Zikeli's avatar Michael Zikeli
Browse files

tidy up the by removing all functionallity that does not need acces to...

tidy up the  by removing all functionallity that does not need acces to members from the function and utilize them as global functions in a sperate namespace.
parent 4143346a
No related merge requests found
......@@ -72,10 +72,10 @@ namespace free_surface
* compare the apply(Linear/Quadratic)Extrapolation functions.
* Defaults to EquilibriumAndNonEquilibriumReconstructor if not enough cells in extrapolation direction are available.
*
* //TODO +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* //FIXME change the description if necessary +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* - GradsMomentReconstructor:
* Uses Grad's moment approximation, i.e. equilibrium distribution function extended by pressure gradient information.
* //TODO + END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* //FIXME + END +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* For convenient construction, use the provided makeXReinitializer functions.
*
......@@ -84,14 +84,12 @@ namespace free_surface
// === forward declaration to access the members of (befriended) `SurfaceGeometryHandler` ================================================
template< typename LatticeModel_T, typename FlagField_T, typename ScalarField_T, typename VectorField_T >
class SurfaceGeometryHandler;
// === global helper functions ===========================================================================================================
// === END - forward declaration to access the members of (befriended) `SurfaceGeometryHandler` ==========================================
// === class declaration =================================================================================================================
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers = true >
class PdfReinitializationSweep
{
//TODO try to scope the helper functions for a specific reinitializer in a seperate namespace.
public:
using FlagField_T = typename BoundaryHandling_T::FlagField;
using ScalarField_T = GhostLayerField< real_t, 1 >;
......@@ -147,6 +145,7 @@ public:
void equilibriumAndNonEquilibriumReinitializer ( Cell const & cell, FlagField_T const & flagField, PdfField_T & pdfField, ScalarField_T const & fillField );
// Diss. Rettinger eq. 2.9 (Note, that his reference might be outdated!)
void extrapolationReinitializer ( Cell const & cell, FlagField_T const & flagField, PdfField_T & pdfField, ScalarField_T const & fillField );
//FIXME change the parameter of this function if necessary
// Diss. Rettinger eq. 2.8 (Note, that his reference might be outdated!)
void GrandMomentReinitializer ( Cell const & cell, FlagField_T const & flagField, PdfField_T & pdfField );
//@}
......@@ -167,47 +166,6 @@ public:
* If useDataFromGhostLayers = false, cells inside the ghostlayer are NOT considered.
**********************************************************************************************************************/
uint_t getNumberOfExtrapolationCells( Cell const & cell, FlagField_T const & flagField, PdfField_T const & pdfField, Vector3<cell_idx_t> const & extrapolationDirection ) const;
/*! ******************************************************************************************************************
* \brief converts a `Vector3< cell_idx_t` to a Cell, e.g. to allow Cell operations for a Vector.
**********************************************************************************************************************/
Cell makeCell( Vector3< cell_idx_t > const & vector ) const { return Cell( vector[0], vector[1], vector[2]); }
//@}
/*! \name Helper functions for the reinitializers that use extrapolation part */
//@{
/*! ******************************************************************************************************************
* \brief Calculates the difference of the PDFs in `cell` compared to the equilibrium distribution
* and returns a vector of those differences.
**********************************************************************************************************************/
std::vector<real_t> getNonEquilibriumPdfsInCell( Cell const & cell, PdfField_T & pdfField ) const;
/*! ******************************************************************************************************************
* \brief Returns the PDF values of `cell`
**********************************************************************************************************************/
std::vector<real_t> getExtrapolationPdfsInCell ( Cell const & cell, PdfField_T & pdfField ) const;
/*! ******************************************************************************************************************
* \brief Sets the PDFs of x=`cell` according following linear combination:
* For `equilibriumAndNonEquilibriumReinitalizer`
* f(x,q) = f^{eq}(x+e,q) + 3* f^{neq}(x+1c,q) - 3* f^{neq}(x+2c,q) + 1* f^{neq}(x+3c,q)
* For `extrapolationReinitializer`
* f(x,q) = 3* f^{act}(x+1c,q) - 3* f^{act}(x+2c,q) + 1* f^{act}(x+3c,q)
**********************************************************************************************************************/
void applyQuadraticExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation = false );
/*! ******************************************************************************************************************
* \brief Sets the PDFs of x=`cell` according following linear combination:
* For `equilibriumAndNonEquilibriumReinitalizer`
* f(x,q) = f^{eq}(x+e,q) + 2* f^{neq}(x+1c,q) - 1* f^{neq}(x+2c,q)
* For `extrapolationReinitializer`
* f(x,q) = 2* f^{act}(x+1c,q) - 1* f^{act}(x+2c,q)
**********************************************************************************************************************/
void applyLinearExtrapolation ( Cell const & cell, PdfField_T & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation = false );
/*! ******************************************************************************************************************
* \brief Sets the PDFs of x=`cell` according following linear combination:
* For `equilibriumAndNonEquilibriumReinitalizer`
* f(x,q) = f^{eq}(x+e,q) + 1* f^{neq}(x+1c,q)
* For `extrapolationReinitializer` to few valid cells in extrapolation direction are available.
**********************************************************************************************************************/
void applyConstantExtrapolation ( Cell const & cell, PdfField_T & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation = false );
/*! ******************************************************************************************************************
* \brief Definition how many valid neighbors are required for the respective extrapolation.
......@@ -229,6 +187,62 @@ public:
}; // class PdfReinitializationSweep
// === global helper functions ===========================================================================================================
/*! \name global helper functions for PdfReinitializer */
//@{
namespace conversion_helper
{
/*! ******************************************************************************************************************
* \brief converts a `Vector3< cell_idx_t` to a Cell, e.g. to allow Cell operations for a Vector.
**********************************************************************************************************************/
Cell makeCell( Vector3< cell_idx_t > const & vector ) { return Cell( vector[0], vector[1], vector[2]); }
} // namespace conversion_helper
namespace extrapolation_helper
{
/*! ******************************************************************************************************************
* \brief Calculates the difference of the PDFs in `cell` compared to the equilibrium distribution
* and returns a vector of those differences.
**********************************************************************************************************************/
template< typename LatticeModel_T >
std::vector<real_t> getNonEquilibriumPdfsInCell( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField );
/*! ******************************************************************************************************************
* \brief Returns the PDF values of `cell`
**********************************************************************************************************************/
template< typename LatticeModel_T >
std::vector<real_t> getExtrapolationPdfsInCell ( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField );
/*! ******************************************************************************************************************
* \brief Sets the PDFs of x=`cell` according following linear combination:
* For `equilibriumAndNonEquilibriumReinitalizer`
* f(x,q) = f^{eq}(x+e,q) + 3* f^{neq}(x+1c,q) - 3* f^{neq}(x+2c,q) + 1* f^{neq}(x+3c,q)
* For `extrapolationReinitializer`
* f(x,q) = 3* f^{act}(x+1c,q) - 3* f^{act}(x+2c,q) + 1* f^{act}(x+3c,q)
**********************************************************************************************************************/
template< typename LatticeModel_T >
void applyQuadraticExtrapolation( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation = false );
/*! ******************************************************************************************************************
* \brief Sets the PDFs of x=`cell` according following linear combination:
* For `equilibriumAndNonEquilibriumReinitalizer`
* f(x,q) = f^{eq}(x+e,q) + 2* f^{neq}(x+1c,q) - 1* f^{neq}(x+2c,q)
* For `extrapolationReinitializer`
* f(x,q) = 2* f^{act}(x+1c,q) - 1* f^{act}(x+2c,q)
**********************************************************************************************************************/
template< typename LatticeModel_T >
void applyLinearExtrapolation ( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation = false );
/*! ******************************************************************************************************************
* \brief Sets the PDFs of x=`cell` according following linear combination:
* For `equilibriumAndNonEquilibriumReinitalizer`
* f(x,q) = f^{eq}(x+e,q) + 1* f^{neq}(x+1c,q)
* For `extrapolationReinitializer` to few valid cells in extrapolation direction are available.
**********************************************************************************************************************/
template< typename LatticeModel_T >
void applyConstantExtrapolation ( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation = false );
} // namespace extrapolation_helper
//@}
// === END - global helper functions =====================================================================================================
// === functionality for convenient construction ===============================================================================================
/*******************************************************************************************************************//**
* \brief Constructs a Reinitialization Class object and returns a shared pointer on it.
......@@ -243,7 +257,6 @@ public:
*
* \return shared pointer of reinitializer class
**********************************************************************************************************************/
//TODO test me
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers = true >
shared_ptr< PdfReinitializationSweep< BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers > >
makePdfReinitializationSweep( PdfReinitializationModel const & pdfReinitializerModel
......
......@@ -25,7 +25,6 @@ namespace walberla
{
namespace free_surface
{
// === Function Definition for PdfReinitializationSweep ==================================================================================================
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
......@@ -100,91 +99,7 @@ operator()(IBlock* const block)
}
// === Helper functions to find and probe the extrapolation direction ==================================================
// TODO I think this uses members, so it has to be a member function
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline Vector3< cell_idx_t >
PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
findExtrapolationDirection( Cell const & cell, FlagField_T const & flagField, ScalarField_T const & fillField) const
{
if ( sgh_ != nullptr )
{
// get flag for solid boundary
const flag_t solidFlag = flagField.getMask(sgh_->solidUIDs_);
// normal vector that will be returned
Vector3<real_t> normal {};
// the functions from the normalSweep expect iterators not fields
typename ScalarField_T::iterator fillIt( &fillField, cell.x() , cell.y() , cell.z() , cell_idx_c(0)
, uint_c(1), uint_c(1), uint_c(1), uint_c(1) );
typename FlagField_T::iterator flagIt( &flagField, cell.x() , cell.y() , cell.z() , cell_idx_c(0)
, uint_c(1), uint_c(1), uint_c(1), uint_c(1) );
if (!isFlagInNeighborhood< Stencil_T >(flagIt, solidFlag)) { normalSweeps_public_functions::computeNormal (normal, fillIt); }
else { normalSweeps_public_functions::computeNormalNearSolidBoundary(normal, fillIt, flagIt, solidFlag); }
// normalize normal
normalSweeps_public_functions::normalizeNorm(normal);
// Prob the most fitting Lattice Direction, using the `findCorrespondingLatticeDirection` function from the lbm_mesapd_coupling module.
// Note: since the surface normal points in gas direction and the extrapolation direction in fluid direction ==> the negative normal is used.
return (-1) * lbm_mesapd_coupling::findCorrespondingLatticeDirection< Stencil_T >( normal );
}
else /* This very simple cas is only used if no surface geometry handler is given / available. */
{
// normal vector that will be returned
Vector3<cell_idx_t> normal {};
// Very simple approximation of the surface normal by pointing in fluid direction, i.e. where PDFs are available.
for( auto directNeighborDir = stencil::D3Q6::begin(); directNeighborDir != stencil::D3Q6::end(); ++directNeighborDir)
{
if( flags_.isFluid (flagField.get( cell + (*directNeighborDir) )) &&
! flags_.needsReinitialization(flagField.get( cell + (*directNeighborDir) ))
)
{
normal[0] += directNeighborDir.cx();
normal[1] += directNeighborDir.cy();
normal[2] += directNeighborDir.cz();
}
}
return normal;
} // if ( sgh_ != nullptr )
} // findExtrapolationDirection()
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline uint_t
PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
getNumberOfExtrapolationCells( Cell const& cell, FlagField_T const & flagField, PdfField_T const & pdfField, Vector3< cell_idx_t > const & extrapolationDirection) const
{
if( extrapolationDirection == cell_idx_t(0) /* center cell */ ) { return uint_t(0); }
//Note: the number of ghost layer points for the flag-field and the pdf-field must not be the same, whether sufficient PDFs are available is of importance here though.
CellInterval localDomain = (useDataFromGhostLayers) ? pdfField.xyzSizeWithGhostLayer() : pdfField.xyzSize();
for( auto numCells = uint_t(1); numCells <= maximumNumberOfExtrapolationCells_; ++numCells )
{
Cell checkCell = cell + makeCell(cell_idx_c(numCells) * extrapolationDirection); // = potential cell for extrapolation
// check whether potential cell is inside domain, fluid and not a cell that was just converted from gas to interface.
if( !localDomain.contains( checkCell ) )
{ return numCells - uint_t(1); }
if( !flags_.isFluid(flagField.get( checkCell )) )
{ return numCells - uint_t(1); }
if( flags_.needsReinitialization(flagField.get( checkCell )) )
{ return numCells - uint_t(1); }
}
return maximumNumberOfExtrapolationCells_;
}
// =====================================================================================================================
// === Realization of the four reinitializer ===========================================================================
// TODO this calls stuff that uses members, so it has to stay a member function as well
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline void PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
equilibriumReinitializer( Cell const & cell, FlagField_T const & flagField, PdfField_T & pdfField)
......@@ -247,9 +162,9 @@ equilibriumAndNonEquilibriumReinitializer( Cell const & cell , FlagField_T const
uint_t numberOfCellsForExtrapolation = getNumberOfExtrapolationCells( cell, flagField, pdfField, extrapolationDirection );
// add a correction from extrapolation to it.
if ( enoughCellsForQuadraticExtrapolation( numberOfCellsForExtrapolation ) ) { applyQuadraticExtrapolation(cell, pdfField, extrapolationDirection, false); }
else if ( enoughCellsForLinearExtrapolation ( numberOfCellsForExtrapolation ) ) { applyLinearExtrapolation (cell, pdfField, extrapolationDirection, false); }
else if ( enoughCellsForExtrapolation ( numberOfCellsForExtrapolation ) ) { applyConstantExtrapolation (cell, pdfField, extrapolationDirection, false); }
if ( enoughCellsForQuadraticExtrapolation( numberOfCellsForExtrapolation ) ) { extrapolation_helper::applyQuadraticExtrapolation<LatticeModel_T>(cell, pdfField, extrapolationDirection, false); }
else if ( enoughCellsForLinearExtrapolation ( numberOfCellsForExtrapolation ) ) { extrapolation_helper::applyLinearExtrapolation <LatticeModel_T>(cell, pdfField, extrapolationDirection, false); }
else if ( enoughCellsForExtrapolation ( numberOfCellsForExtrapolation ) ) { extrapolation_helper::applyConstantExtrapolation <LatticeModel_T>(cell, pdfField, extrapolationDirection, false); }
else { /* NoneqilibriumReinitialization not possible since there is no valid extrapolation direction available. Hence, only equilibrium one is executed. */ }
} // equlibriumAndNonEquilibriumReinitializer
......@@ -261,8 +176,8 @@ extrapolationReinitializer( Cell const & cell , FlagField_T const & flagField ,
Vector3<cell_idx_t> extrapolationDirection = findExtrapolationDirection( cell, flagField, fillField );
uint_t numberOfCellsForExtrapolation = getNumberOfExtrapolationCells( cell, flagField, pdfField, extrapolationDirection );
if ( enoughCellsForQuadraticExtrapolation( numberOfCellsForExtrapolation ) ) { applyQuadraticExtrapolation(cell, pdfField, extrapolationDirection, true); }
else if ( enoughCellsForLinearExtrapolation ( numberOfCellsForExtrapolation ) ) { applyLinearExtrapolation (cell, pdfField, extrapolationDirection, true); }
if ( enoughCellsForQuadraticExtrapolation( numberOfCellsForExtrapolation ) ) { extrapolation_helper::applyQuadraticExtrapolation<LatticeModel_T>(cell, pdfField, extrapolationDirection, true); }
else if ( enoughCellsForLinearExtrapolation ( numberOfCellsForExtrapolation ) ) { extrapolation_helper::applyLinearExtrapolation <LatticeModel_T>(cell, pdfField, extrapolationDirection, true); }
else /* If not enough points for extrapolation are available --> execute */ { this->equilibriumAndNonEquilibriumReinitializer(cell, flagField, pdfField, fillField); } /* instead. */
//FIXME this looks all like particle stuff, so I just ignore it?
......@@ -281,15 +196,100 @@ extrapolationReinitializer( Cell const & cell , FlagField_T const & flagField ,
//TODO implement Grands MomentReinitialization
// =====================================================================================================================
// === END - Realization of the four reinitializer =====================================================================
// === Helper functions to find and probe the extrapolation direction ==================================================
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline Vector3< cell_idx_t >
PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
findExtrapolationDirection( Cell const & cell, FlagField_T const & flagField, ScalarField_T const & fillField) const
{
if ( sgh_ != nullptr )
{
// get flag for solid boundary
const flag_t solidFlag = flagField.getMask(sgh_->solidUIDs_);
// normal vector that will be returned
Vector3<real_t> normal {};
// the functions from the normalSweep expect iterators not fields
typename ScalarField_T::iterator fillIt( &fillField, cell.x() , cell.y() , cell.z() , cell_idx_c(0)
, uint_c(1), uint_c(1), uint_c(1), uint_c(1) );
typename FlagField_T::iterator flagIt( &flagField, cell.x() , cell.y() , cell.z() , cell_idx_c(0)
, uint_c(1), uint_c(1), uint_c(1), uint_c(1) );
if (!isFlagInNeighborhood< Stencil_T >(flagIt, solidFlag)) { normalSweeps_public_functions::computeNormal (normal, fillIt); }
else { normalSweeps_public_functions::computeNormalNearSolidBoundary(normal, fillIt, flagIt, solidFlag); }
// normalize normal
normalSweeps_public_functions::normalizeNorm(normal);
// Prob the most fitting Lattice Direction, using the `findCorrespondingLatticeDirection` function from the lbm_mesapd_coupling module.
// Note: since the surface normal points in gas direction and the extrapolation direction in fluid direction ==> the negative normal is used.
return (-1) * lbm_mesapd_coupling::findCorrespondingLatticeDirection< Stencil_T >( normal );
}
else /* This very simple cas is only used if no surface geometry handler is given / available. */
{
// normal vector that will be returned
Vector3<cell_idx_t> normal {};
// Very simple approximation of the surface normal by pointing in fluid direction, i.e. where PDFs are available.
for( auto directNeighborDir = stencil::D3Q6::begin(); directNeighborDir != stencil::D3Q6::end(); ++directNeighborDir)
{
if( flags_.isFluid (flagField.get( cell + (*directNeighborDir) )) &&
! flags_.needsReinitialization(flagField.get( cell + (*directNeighborDir) ))
)
{
normal[0] += directNeighborDir.cx();
normal[1] += directNeighborDir.cy();
normal[2] += directNeighborDir.cz();
}
}
return normal;
} // if ( sgh_ != nullptr )
} // findExtrapolationDirection()
// === Helper functions for extrapolation ==============================================================================
// TODO I think this uses no member, so it does not need to be a member function => create a namespace for it and make it global
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline std::vector< real_t >
PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
getNonEquilibriumPdfsInCell( Cell const & cell, PdfField_T & pdfField ) const
inline uint_t
PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
getNumberOfExtrapolationCells( Cell const& cell, FlagField_T const & flagField, PdfField_T const & pdfField, Vector3< cell_idx_t > const & extrapolationDirection) const
{
using namespace conversion_helper;
if( extrapolationDirection == cell_idx_t(0) /* center cell */ ) { return uint_t(0); }
//Note: the number of ghost layer points for the flag-field and the pdf-field must not be the same, whether sufficient PDFs are available is of importance here though.
CellInterval localDomain = (useDataFromGhostLayers) ? pdfField.xyzSizeWithGhostLayer() : pdfField.xyzSize();
for( auto numCells = uint_t(1); numCells <= maximumNumberOfExtrapolationCells_; ++numCells )
{
Cell checkCell = cell + makeCell(cell_idx_c(numCells) * extrapolationDirection); // = potential cell for extrapolation
// check whether potential cell is inside domain, fluid and not a cell that was just converted from gas to interface.
if( !localDomain.contains( checkCell ) )
{ return numCells - uint_t(1); }
if( !flags_.isFluid(flagField.get( checkCell )) )
{ return numCells - uint_t(1); }
if( flags_.needsReinitialization(flagField.get( checkCell )) )
{ return numCells - uint_t(1); }
}
return maximumNumberOfExtrapolationCells_;
}
// === END - Helper functions to find and probe the extrapolation direction ============================================
// === END - Function Definition for PdfReinitializationSweep ==============================================================================================
// === Helper functions for extrapolation ==============================================================================
namespace extrapolation_helper
{
template< typename LatticeModel_T >
std::vector<real_t> getNonEquilibriumPdfsInCell( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField )
{
using Stencil_T = typename LatticeModel_T::Stencil;
std::vector< real_t > nonEquilibriumPartOfPdfs(LatticeModel_T::Stencil::Size);
Vector3< real_t > velocity;
......@@ -304,11 +304,11 @@ getNonEquilibriumPdfsInCell( Cell const & cell, PdfField_T & pdfField ) const
return nonEquilibriumPartOfPdfs;
}
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline std::vector< real_t >
PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
getExtrapolationPdfsInCell( Cell const & cell, PdfField_T & pdfField ) const
template< typename LatticeModel_T >
std::vector<real_t> getExtrapolationPdfsInCell ( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField )
{
using Stencil_T = typename LatticeModel_T::Stencil;
std::vector< real_t > PdfsOfXthNeighbor(LatticeModel_T::Stencil::Size);
for( auto d = Stencil_T::begin(); d != Stencil_T::end(); ++d )
......@@ -318,10 +318,12 @@ getExtrapolationPdfsInCell( Cell const & cell, PdfField_T & pdfField ) const
return PdfsOfXthNeighbor;
}
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline void PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
applyQuadraticExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3< cell_idx_t > const & extrapolationDirection, bool const solelyExtrapolation )
template< typename LatticeModel_T >
void applyQuadraticExtrapolation( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation )
{
using namespace conversion_helper;
using Stencil_T = typename LatticeModel_T::Stencil;
// holder variable to store the PDFs of the cells participating in the interpolation
std::vector< real_t > pdfsXf (LatticeModel_T::Stencil::Size); // cell + 1 * extrapolationDirection
std::vector< real_t > pdfsXff (LatticeModel_T::Stencil::Size); // cell + 2 * extrapolationDirection
......@@ -354,10 +356,12 @@ applyQuadraticExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3<
}
}
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline void PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
applyLinearExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3< cell_idx_t > const & extrapolationDirection, bool const solelyExtrapolation )
template< typename LatticeModel_T >
void applyLinearExtrapolation ( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation )
{
using namespace conversion_helper;
using Stencil_T = typename LatticeModel_T::Stencil;
// holder variable to store the PDFs of the cells participating in the interpolation
std::vector< real_t > pdfsXf (LatticeModel_T::Stencil::Size); // cell + 1 * extrapolationDirection
std::vector< real_t > pdfsXff (LatticeModel_T::Stencil::Size); // cell + 2 * extrapolationDirection
......@@ -386,10 +390,12 @@ applyLinearExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3< cel
}
}
template< typename BoundaryHandling_T, typename LatticeModel_T, bool useDataFromGhostLayers >
inline void PdfReinitializationSweep<BoundaryHandling_T, LatticeModel_T, useDataFromGhostLayers>::
applyConstantExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3< cell_idx_t > const & extrapolationDirection, bool const solelyExtrapolation )
template< typename LatticeModel_T >
void applyConstantExtrapolation ( Cell const & cell, lbm::PdfField< LatticeModel_T > & pdfField, Vector3<cell_idx_t> const & extrapolationDirection, bool const solelyExtrapolation )
{
using namespace conversion_helper;
using Stencil_T = typename LatticeModel_T::Stencil;
// holder variable to store the PDFs of the cells participating in the interpolation
std::vector< real_t > pdfsXf (LatticeModel_T::Stencil::Size); // cell + 1 * extrapolationDirection
real_t centerFactor;
......@@ -411,9 +417,8 @@ applyConstantExtrapolation( Cell const & cell, PdfField_T & pdfField, Vector3< c
+ real_t(1) * pdfsXf [d.toIdx()];
}
}
// =====================================================================================================================
// === END - Function Definition for PdfReinitializationSweep ============================================================================================
} // namespace extrapolation_helper
// === END -Helper functions for extrapolation =========================================================================
} // namespace free_surface
} // namespace walberla
\ No newline at end of file
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