![]() |
|
The old fstatistics tool was based on the templated StatisticsVector class. It added functionality to DPMBase that allowed the evaluation of continuum fields, either during a simulation or as a post-processing step. For example, to add global statistical output to your simulation, you had to derive your Driver class from both Mercury3D and StatisticsVector<O>:
This setup was inflexible, however, as it allowed only the evaluation of one type of coarse-graining. This was replaced in MercuryCG by the cgHandler, which can contain several CG objects if desired:
If a cg object is added to the cgHandler, it will produce analytical data while the simulation is running. This data is stored in a file named $name.$n.stat
, where $name
is the problem name specified by setName, and $n
is the index of the cg object in the cgHandler. A basic example is shown in TutorialCG0.cpp. It produces spatially averaged statistics at every 50-th time step, resulting in the following output:
The first header line gives the user information about the type of coarse-graining applied; in this case, the coordinate type is O, which denotes globally-averaged statistics.
The second header line denotes the column numbers of the coordinates (time) and the fields (volume fraction, etc) evaluated at the coordinates.
All other lines contain coordinate and field values; e.g. the third line tells you that the volume fraction at time 0 was 0.6.
The simple file format allow easy plotting of the data in gnuplot, e.g.
One can also plot the same data in Matlab using loadStatistics.m provided in the Matlab folder
The example above produced globally averaged statistics. However, usually coarse-graining is used to extract spatially dependent continuum fields. This can be done by changing the CGCoordinate type:
The code above produces two sets of output: Test.0.stat
contains globally averaged data, Test.1.stat
contains spatially resolved data. In the latter case, the number of evaluation points and the coarse-graining width has to be specified – in this case, a Gaussian of width (standard deviation) 1 and a 20x20x20 mesh of evaluation points will be used. Note that the latter statistics will produce huge amounts of data (8000 times more than the globally averaged statistics), even though we have not chosen a particularly high resolution. The data will further be highly fluctuating, as the continuum fields only depend on the small amount of data in the sphere around the evaluation point. Thus, it is advisable to average in space when ever possible, i.e. if the data is homogeneous in space. Often the data is not homogeneous in all spatial directions, but in some. In that case, spatial averaging can be applied in specific directions only. This is done by using partially resolved CGCoordinates: X, Y, Z, XY, XZ, or YZ. For example, CG<CGCoordinates::Z>
averages over the yz-plane, but resolves the fields in z-direction. This is shown exemplary in TutorialCG1.1.stat
:
A simple matlab plot reveals that the confining stress increases in the z-direction.
Coarse-graining can also be applied in the time dimension. This can be done in MercuryCG by using a TimeAveragedCG or TimeSmoothedCG object:
This can best be studied by looking at a time-dependent problem, such as a slowly sheared Lees-Edwards-style simulation: The friction in this system initially builds up until it reaches a maximum, then decreases towards a smaller, critical value.
If your DPM problem is steady, it is not necessary to resolve the continuum fields in time. This can be done in Mercury by using time-averaging cg, e.g.
TimeAveragedCG<CGFunctions::GaussZ> cg;
cg.setNZ(10);
cg.setWidth(0.15);
cg.statFile.setSaveCount(20000);
problem.cgHandler.copyAndAddObject(cg);
To limit the time interval over which the continuum fields are evaluated to e.g. \([10,20]\), use
cg.setTimeMin(10);
cg.setTimeMax(20);
Processing restart files
The list below links to the documentation of the different classes that comprise MercuryCG.