[aspect-devel] hacking aspect

Wolfgang Bangerth bangerth at math.tamu.edu
Fri Jan 6 16:28:48 PST 2012


Hi Thomas,
I've taken a look at the changes you made and I think you're making your 
life much harder than necessary. If I see this right, for every piece of 
data you want to compute, you open (or keep open) a file and litter the 
output directory with a bunch of different files. The idea of these 
postprocessors is different, however: simply put the data you generate 
into the statistics object every postprocessor function gets as 
argument, and it will show up in the statistics file in the output 
directory chosen in the input file. The data you produce will then 
simply be one column in this file.

For example, rather than writing code like
    if (this->Vrmsout== NULL) this->Vrmsout = fopen("bin/Vrms.dat", "w");
       fprintf(Vrmsout,"%e %e\n", this->get_time(), vrms);
and having the Vrmsout handle as a member variable, simply do
    statistics.add_value("vrms", vrms);

If you run this, take a look at bin/statistics (or whichever directory 
this is for you) and find a column labeled "vrms" that you can then plot 
just as easily as the data above.

The reason to do it this way is (i) it's simpler, no need to deal with 
output files by hand; (ii) it's designed to also work in the case where 
you checkpoint the program and restart it later, which in your scheme 
will lead to a loss of the data you've generated so far.

I think it would be useful to transition the code you wrote in revisions 
569 and following to the scheme above. Let me know if you have questions 
about this and we'll try to help out. I guess I should also write a bit 
of text in section 7.1.6 of the manual on how this is all supposed to 
work...

Cheers
  W.

------------------------------------------------------------------------
Wolfgang Bangerth               email:            bangerth at math.tamu.edu
                                 www: http://www.math.tamu.edu/~bangerth/



More information about the Aspect-devel mailing list