DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::Euler::OneDimProfile< nVarsFixed > Struct Template Reference

One-dimensional profile for inlet/outlet boundary data. More...

#include <EulerBC.hpp>

Collaboration diagram for DNDS::Euler::OneDimProfile< nVarsFixed >:
[legend]

Public Member Functions

 OneDimProfile (const MPIInfo &_mpi)
 Construct with MPI communicator (no allocation yet).
 
void SortNodes ()
 Sort node coordinates in ascending order.
 
index Size () const
 Return the number of cells (= nodes.size() - 1).
 
real Len (index i)
 Return the length of cell i (= nodes[i+1] - nodes[i]).
 
void GenerateUniform (index size, int nvars, real minV, real maxV)
 Allocate a uniformly spaced profile.
 
void GenerateTanh (index size, int nvars, real minV, real maxV, real d0)
 Allocate a tanh-clustered (bilateral) profile.
 
void SetZero ()
 Zero both the value matrix and the divisor row vector.
 
template<class TU >
void AddSimpleInterval (TU vmean, real divV, real lV, real rV)
 Accumulate a cell-mean value over the interval [lV, rV].
 
void Reduce ()
 MPI Allreduce (SUM) the value matrix and divisor across all ranks.
 
Eigen::Vector< real, nVarsFixed > Get (index i) const
 Retrieve the averaged value for cell i.
 
Eigen::Vector< real, nVarsFixed > GetPlain (real v) const
 Linearly interpolate the profile at coordinate v.
 
void OutProfileCSV (std::ostream &o, bool title=true, int precision=16)
 Write the profile to a CSV stream after a valid MPI reduction.
 

Public Attributes

MPIInfo mpi
 MPI communicator info.
 
Eigen::Vector< real, Eigen::Dynamic > nodes
 Node coordinates (size = nCells + 1).
 
Eigen::Matrix< real, nVarsFixed, Eigen::Dynamic > v
 Accumulated cell values (nVars × nCells).
 
Eigen::RowVector< real, Eigen::Dynamic > div
 Per-cell divisor (area weight).
 

Detailed Description

template<int nVarsFixed>
struct DNDS::Euler::OneDimProfile< nVarsFixed >

One-dimensional profile for inlet/outlet boundary data.

Discretizes a 1-D coordinate range into cells delimited by nodes. Supports uniform and tanh (bilateral clustering) node distributions. Cell values are accumulated via AddSimpleInterval(), reduced across MPI ranks with Reduce(), then queried with Get() or interpolated with GetPlain(). The profile can be written to CSV with OutProfileCSV().

The number of cells equals nodes.size() - 1.

Template Parameters
nVarsFixedCompile-time number of state variables (or Eigen::Dynamic).

Definition at line 767 of file EulerBC.hpp.

Constructor & Destructor Documentation

◆ OneDimProfile()

template<int nVarsFixed>
DNDS::Euler::OneDimProfile< nVarsFixed >::OneDimProfile ( const MPIInfo _mpi)
inline

Construct with MPI communicator (no allocation yet).

Parameters
_mpiMPI communicator wrapper.

Definition at line 776 of file EulerBC.hpp.

Member Function Documentation

◆ AddSimpleInterval()

template<int nVarsFixed>
template<class TU >
void DNDS::Euler::OneDimProfile< nVarsFixed >::AddSimpleInterval ( TU  vmean,
real  divV,
real  lV,
real  rV 
)
inline

Accumulate a cell-mean value over the interval [lV, rV].

Distributes vmean weighted by divV across every profile cell that overlaps [lV, rV], proportional to the overlap fraction.

Template Parameters
TUVector type compatible with scalar multiplication and Eigen addition.
Parameters
vmeanMean state vector for the contributing interval.
divVDivisor (area / weight) for the contributing interval.
lVLeft coordinate of the contributing interval.
rVRight coordinate of the contributing interval.

Definition at line 848 of file EulerBC.hpp.

Here is the call graph for this function:

◆ GenerateTanh()

template<int nVarsFixed>
void DNDS::Euler::OneDimProfile< nVarsFixed >::GenerateTanh ( index  size,
int  nvars,
real  minV,
real  maxV,
real  d0 
)
inline

Allocate a tanh-clustered (bilateral) profile.

Parameters
sizeNumber of cells.
nvarsNumber of state variables.
minVLeft coordinate bound.
maxVRight coordinate bound.
d0First cell width controlling clustering intensity.

Definition at line 819 of file EulerBC.hpp.

Here is the call graph for this function:

◆ GenerateUniform()

template<int nVarsFixed>
void DNDS::Euler::OneDimProfile< nVarsFixed >::GenerateUniform ( index  size,
int  nvars,
real  minV,
real  maxV 
)
inline

Allocate a uniformly spaced profile.

Parameters
sizeNumber of cells.
nvarsNumber of state variables.
minVLeft coordinate bound.
maxVRight coordinate bound.

Definition at line 804 of file EulerBC.hpp.

◆ Get()

template<int nVarsFixed>
Eigen::Vector< real, nVarsFixed > DNDS::Euler::OneDimProfile< nVarsFixed >::Get ( index  i) const
inline

Retrieve the averaged value for cell i.

Returns v(:, i) / div(i), with a tiny epsilon to avoid division by zero.

Parameters
iCell index in [0, Size()).
Returns
The area-weighted average state vector for cell i.

Definition at line 885 of file EulerBC.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlain()

template<int nVarsFixed>
Eigen::Vector< real, nVarsFixed > DNDS::Euler::OneDimProfile< nVarsFixed >::GetPlain ( real  v) const
inline

Linearly interpolate the profile at coordinate v.

Locates the cell containing v, then blends the averaged values of that cell and its neighbors to produce a smooth interpolation.

Parameters
vCoordinate at which to evaluate the profile.
Returns
Interpolated state vector.

Definition at line 900 of file EulerBC.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Len()

template<int nVarsFixed>
real DNDS::Euler::OneDimProfile< nVarsFixed >::Len ( index  i)
inline

Return the length of cell i (= nodes[i+1] - nodes[i]).

Parameters
iCell index in [0, Size()).

Definition at line 792 of file EulerBC.hpp.

◆ OutProfileCSV()

template<int nVarsFixed>
void DNDS::Euler::OneDimProfile< nVarsFixed >::OutProfileCSV ( std::ostream &  o,
bool  title = true,
int  precision = 16 
)
inline

Write the profile to a CSV stream after a valid MPI reduction.

Should be called on a single MPI rank. Outputs one row per node coordinate with interpolated values.

Parameters
oOutput stream to write CSV data to.
titleIf true, write a CSV header row first.
precisionFloating-point precision for std::scientific output.

Definition at line 926 of file EulerBC.hpp.

Here is the call graph for this function:

◆ Reduce()

template<int nVarsFixed>
void DNDS::Euler::OneDimProfile< nVarsFixed >::Reduce ( )
inline

MPI Allreduce (SUM) the value matrix and divisor across all ranks.

Definition at line 868 of file EulerBC.hpp.

Here is the call graph for this function:

◆ SetZero()

template<int nVarsFixed>
void DNDS::Euler::OneDimProfile< nVarsFixed >::SetZero ( )
inline

Zero both the value matrix and the divisor row vector.

Definition at line 829 of file EulerBC.hpp.

◆ Size()

template<int nVarsFixed>
index DNDS::Euler::OneDimProfile< nVarsFixed >::Size ( ) const
inline

Return the number of cells (= nodes.size() - 1).

Definition at line 785 of file EulerBC.hpp.

Here is the caller graph for this function:

◆ SortNodes()

template<int nVarsFixed>
void DNDS::Euler::OneDimProfile< nVarsFixed >::SortNodes ( )
inline

Sort node coordinates in ascending order.

Definition at line 779 of file EulerBC.hpp.

Member Data Documentation

◆ div

template<int nVarsFixed>
Eigen::RowVector<real, Eigen::Dynamic> DNDS::Euler::OneDimProfile< nVarsFixed >::div

Per-cell divisor (area weight).

Definition at line 772 of file EulerBC.hpp.

◆ mpi

template<int nVarsFixed>
MPIInfo DNDS::Euler::OneDimProfile< nVarsFixed >::mpi

MPI communicator info.

Definition at line 769 of file EulerBC.hpp.

◆ nodes

template<int nVarsFixed>
Eigen::Vector<real, Eigen::Dynamic> DNDS::Euler::OneDimProfile< nVarsFixed >::nodes

Node coordinates (size = nCells + 1).

Definition at line 770 of file EulerBC.hpp.

◆ v

template<int nVarsFixed>
Eigen::Matrix<real, nVarsFixed, Eigen::Dynamic> DNDS::Euler::OneDimProfile< nVarsFixed >::v

Accumulated cell values (nVars × nCells).

Definition at line 771 of file EulerBC.hpp.


The documentation for this struct was generated from the following file: