|
IBAMR
IBAMR version 0.19.
|
Class HierarchyAveragedDataManager provides a method of tracking and determining periodic steady states of fields. In particular, this class can be used to determine the average of a field over several instances, for example determining the mean flow of a turbulent flow field. More...
#include <ibtk/HierarchyAveragedDataManager.h>

Private Member Functions | |
| void | getFromRestart () |
| void | commonConstructor (SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > input_db) |
| Registers a scratch variable with the variable database. This data is allocated and deallocated as needed. More... | |
The average field is defined as \( \bar{u} = \lim_{N\rightarrow\infty}\frac{1}{N} \sum_{i = 0}^{N-1} u(x,t + i*P) \) in which \( P \) is the period. This class computes the average \( \bar{u}_N = \frac{1}{N} \sum_{i = 0}^{N-1} u(x,t + i*P) \) via the relation \( \bar{u}_N = \frac{N - 1}{N} \bar{u}_{N-1} + \frac{1}{N} u(x, t + (N-1)*P) \). The average is considered converged when the L2 norm of \( \frac{1}{N} (\bar{u}_N - u(x, t + (N-1)*P)) \) is less than some specified threshold.
Note when the period is equal to 0.0, the average field reduces to \( \bar{u} = \lim_{T\rightarrow\infty} \frac{1}{T} \int_0^T u(x, t_0 + \tau)d\tau \). In this case, it is important that snapshots be taken at consistent time intervals to ensure the above recurrence relation still holds.
If requested, this class can output visualization files corresponding to the tracked average and convergence criteria (called 'deviation'). Visualization files are written after every call to updateTimeAveragedSnapshot. Side and face centered variables are assumed to represent d-dimensional vector fields, while all other fields output a depth consistent with the provided variable in the constructor.
A common use of this class is to determine an average flow field over the course of a simulation. For example, the below code will take snapshots of a flow field at specified intervals.
| IBTK::HierarchyAveragedDataManager::HierarchyAveragedDataManager | ( | std::string | object_name, |
| SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM > > | var, | ||
| SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > | input_db, | ||
| SAMRAI::tbox::Pointer< SAMRAI::hier::GridGeometry< NDIM > > | grid_geom, | ||
| bool | register_for_restart = true |
||
| ) |
The constructor for class HierarchyAveragedDataManager sets some default values and determines data centering. The expected period and number of snapshots must be set in the input database. This class assumes the snapshots will be taken at equidistant points along the periodic interval.
The input database is searched for the following keys:
| IBTK::HierarchyAveragedDataManager::HierarchyAveragedDataManager | ( | std::string | object_name, |
| SAMRAI::tbox::Pointer< SAMRAI::hier::Variable< NDIM > > | var, | ||
| SAMRAI::tbox::Pointer< SAMRAI::tbox::Database > | input_db, | ||
| std::set< double > | snapshot_time_points, | ||
| double | period_start_time, | ||
| double | period_end_time, | ||
| double | threshold, | ||
| SAMRAI::tbox::Pointer< SAMRAI::hier::GridGeometry< NDIM > > | grid_geom, | ||
| bool | register_for_restart = true |
||
| ) |
The constructor for class HierarchyAveragedDataManager sets some default values and determines data centering. In this constructor, the times at which snapshots are taken are set by arguments.
The input database is searched for the following keys:
|
default |
| void IBTK::HierarchyAveragedDataManager::clearSnapshots | ( | ) |
Clear the snapshots taken with this class.
|
inline |
Update the time averaged snapshot. The update is computed through the relation \( u_avg = u_avg + 1/N * (u - u_avg) \) in which N is the number of updates to the snapshot. If this the first update after clearSnapshots() is called, we simply copy data.
This function returns true if the snapshot is at a steady state, or that 1/N*||u - u_avg|| < threshold. Note that a weight patch index should be supplied to accurately compute the norm.
If specified in the constructor, this function also writes visualization files for both the mean field and the deviation.
| bool IBTK::HierarchyAveragedDataManager::updateTimeAveragedSnapshot | ( | int | u_idx, |
| double | time, | ||
| SAMRAI::tbox::Pointer< SAMRAI::hier::PatchHierarchy< NDIM > > | hierarchy, | ||
| const std::string & | mean_refine_type, | ||
| const int | wgt_idx = IBTK::invalid_index, |
||
| double | tol = 1.0e-8 |
||
| ) |
|
inline |
Return true if all the tracked mean fields are at a steady state.
|
inline |
Return whether the point at the specified time is at a periodic steady state. If multiple time points are found within the provided tolerance, this function returns the closest time that is less than the requested time.
|
inline |
Return the time points this class is storing.
Returns the exact data point at which points are being stored in the internal map. Note that if a time point is not found within the specified tolerance, an unrecoverable error occurs.
|
inline |
Get the SnapshotCache object.
|
overridevirtual |
Write the averaged data manager to a database
Implements SAMRAI::tbox::Serializable.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.17