[Mesa-users] E vs D in scientific notation of output
Francis Timmes
fxt44 at mac.com
Wed Aug 16 15:28:06 EDT 2017
> (I'm not sure what the "s" character does?)
the “s” is for plus “+” sign control.
“sp” prints the leading plus “+” sign,
“ss” suppresses the leading “+” sign, and
“s” uses the default, which is almost always “ss”.
not specifying any sign control gives the default, almost always “ss”.
the minus sign “-“ for negative numbers is always printed.
program plus_control
write(6,'(1x,sp,1pe10.2)') 1.23e4
write(6,'(1x,ss,1pe10.2)') 1.23e4
write(6,'(1x,1pes10.2)') 1.23e4
write(6,'(1x,1pe10.2)') 1.23e4
write(6,'(1x,1pe10.2)') -1.23e4
end
fxt
> On Aug 16, 2017, at 11:27 AM, Warrick Ball <wball at bison.ph.bham.ac.uk> wrote:
>
> Hi everyone,
>
> I've been working on some basic Python modules to speed up my working with MESA's (wonderfully simple!) output files and have noticed a small detail that makes life every-so-slightly difficult. Most of MESA's output uses E to to indicate the exponent in scientific notation, as in G = 6.674E-8. But the astero module seems to use D. i.e. G = 6.674D-8. For many purposes this probably doesn't matter at all but for Python I'm currently resorting to replacing the Ds with Es myself, when I don't see any good reason for astero to use E rather than D.
>
> An example offending line (I think) in the astero module would be $MESA_DIR/star/astero/src/astero_data.f:1462 (r9575)
>
>
> write(iounit,'(3x,i5,7(1pd26.16),i16,22(1pd26.16),7i20)',advance='no') i, &
>
>
> where the 1pd26.16 is what produces the D. For comparison, in $MESA_DIR/star/defaults/controls.default:236, the history files use
>
>
> star_history_dbl_format = '(1pes40.16e3, 1x)' ! was '(1pes32.16e3, 1x)'
>
>
> So I propose to replace the 1pd26.16 (and anything similar) with 1pes26.16. (I'm not sure what the "s" character does?) I'm going to try this change in my own code tomorrow.
>
> Cheers,
> Warrick
>
>
> ------------
> Warrick Ball
> Postdoc, School of Physics and Astronomy
> University of Birmingham, Edgbaston, Birmingham B15 2TT
> wball at bison.ph.bham.ac.uk
> +44 (0)121 414 4552
More information about the Mesa-users
mailing list