how to change precision of output in field saver?

Asked by Andy Wilkins

Hi,

The default precision of a field saver is a small number (6?) significant figures. How can i change this using python?

andyu

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
SteffenAbe
Solved:
Last query:
Last reply:
Revision history for this message
Dion Weatherley (d-weatherley) said :
#1

Hi Andy,

It is not currently possible to change the precision of FieldSaver output from python. All the relevant FieldSaver code is at the C++ level. I'll take a look at the code but I suspect changes will be required in numerous locations to change the output precision. I've often thought it would be better to go with scientific precision for FieldSaver output rather than the default stream output format. Depending on the amount of work involved I will either commit a new revision or add it to Blueprints as a feature request for development after the impending v2.2 release of ESyS-Particle.

Cheers,

Dion

Revision history for this message
SteffenAbe (s-abe) said :
#2

This was already discussed as part of the answer to Question #173921. A quick & dirty fix (i.e. setting the precision for all savers to, say 9 or 10 significant digits) requires ~3 lines of code in FieldMaster.cpp. A clean implementation, i.e. with a python interface to set the precision for each saver individually would be much more work.
Suggestion would be: I'll implement the Q & D version for now, and Dion adds the proper implementation to the Blueprints (as part of the improve-fieldsaver-code Blueprint?).

Steffen

Revision history for this message
SteffenAbe (s-abe) said :
#3

Correction:

> A quick & dirty fix (i.e. setting the precision for all savers to, say 9 or 10 significant digits)
> requires ~3 lines of code in FieldMaster.cpp
Its actually not quite as simple, unfortunately, because we're not writing to std::cout and the ios format flags need to be set per stream, not globally.
That means its 1 line per saver writing function, setting the format flags (no need to restore them - the stream gets closed anyway).
So for which savers do you actually need higher precision ?

Steffen

Revision history for this message
Andy Wilkins (andrew-wilkins) said :
#4

Thanks for your comments Dion and Steffan.

At present (today), I'm using
WallVectorFieldSaverPrms
InteractionScalarFieldSaverPrms

andy

Revision history for this message
Dion Weatherley (d-weatherley) said :
#5

Hi Andy and Steffen,

This only further highlights the need for a re-think of the whole data output infrastructure at some stage. I've added a note to the relevant blueprint:
https://blueprints.launchpad.net/esys-particle/+spec/improve-fieldsaver-code

Cheers,

Dion.

Revision history for this message
Best SteffenAbe (s-abe) said :
#6

Hi Andy,

I've committed a temporary fix to increase the output precision for WallVectorFieldSaver (fileFormat="RAW_SERIES") and InteractionScalarFieldSaver (fileFormat="SUM") to 10 significant digits.
See rev. 1029.

Steffen

Revision history for this message
Andy Wilkins (andrew-wilkins) said :
#7

Thanks SteffenAbe, that solved my question.

Revision history for this message
ceguo (hhh-guo) said :
#8

Hi,

I'm glad to hear your highlights on fieldsaver. As I posted before, I need the contact info between particles and walls which is very important to microscopic study for granular materials. The lack of these contacts makes a lot of analysis incomplete, like contact-based averaged stress, fabric tensor, coordination number, just to name a few. So an implementation of the fieldsaver is really appreciated.

Ning

Revision history for this message
Dion Weatherley (d-weatherley) said :
#9

Hi Ning,

Thanks for the reminder. I've updated the Blueprint accordingly:
https://blueprints.launchpad.net/esys-particle/+spec/improve-fieldsaver-code

If anyone has other ideas for FieldSaver or CheckPointer improvements, please post to the whiteboard in the above Blueprint.

Cheers,

Dion.