[MITgcm-support] precision difference between freshwater flux bin file generated with Matlab and EXFempmr diagnostics
Sandy.Gregorio at uqar.ca
Sandy.Gregorio at uqar.ca
Mon Jan 8 14:32:42 EST 2018
Hi Martin,
Thank you so much for your message! :)
Yes the masking is the same indeed.
When I generate my bin files with Matlab, I compute a flux such that it integrates to 10^(-11). I save my precip field to bin file and, from it and the flux I generated, I save my evap field as well. Then I compare the integral of my EXFempmr diag to the value I computed in Matlab in the first place.
I thought the precision difference may come from the calculation sflux=evap-precip from which I may have lost precision. So I compared the atemp I generate with Matlab to EXFatemp diag: I set atemp=278.15K everywhere, and I get EXFatemp=278.1499999999994K everywhere. So if I understand, my problem comes from the extra precision I loose when saving to disk and I won't be able to solve it, will I?
Thanks again for your help :)
Sandy
________________________________________
De : MITgcm-support <mitgcm-support-bounces at mitgcm.org> de la part de Martin Losch <Martin.Losch at awi.de>
Envoyé : lundi 8 janvier 2018 11:40
À : MITgcm Support
Objet : Re: [MITgcm-support] precision difference between freshwater flux bin file generated with Matlab and EXFempmr diagnostics
Sandy,
- is the masking the same?
- when you compute the net flux in matlab do you first save the fields to your files and then read them again? There’s always some extra precision (in excess of the 64bits) in the “online” fields that you loose when you save them to disk. Very often that’s the the reason for these differences.
Martin
> On 5. Jan 2018, at 23:31, <Sandy.Gregorio at uqar.ca> <Sandy.Gregorio at uqar.ca> wrote:
>
> Hi everyone,
>
> I use mnc/exf/seaice packages. I want to "control" my freshwater flux, sflux, so I prescribe the precipitation and evaporation fields such that my sflux (=evap-precip) integrates to zero (or at least integrates to an order of 10^(-11)) at the surface.
>
> If I look at my results, my salt in my basin increases all the time during my simulation. I compared the sflux I generate with Matlab in binary file (that is evap-precip) with my EXFempmr diag and they differ to an order of 10^(-23) (my sflux generated with Matlab integrates to 10^(-11) while my sflux from EXF integrates to 10^(-9)).
>
> To generate my forcing files, I have tried:
> fid=fopen('precip.bin','w','ieee-be.l64'); fwrite(fid,precip,'real*8'); fclose(fid);
> and
> fid=fopen('precip.bin','w','ieee-be'); fwrite(fid,precip,'real*8'); fclose(fid);
>
> In data, PARM01, I have:
> readBinaryPrec=64,
> writeBinaryPrec=64,
>
> In data.exf, EXF_NML_01, I have:
> exf_iprec = 64,
>
> I have to admit that my difference is smaller since I have used double precision (first I was using real*4 and precision 32, and my EXFempmr integrated to 10^(-3) which is very bad!) but I was wondering if I could get exactly in my diags what I generated with Matlab, and where does this difference between my sflux generated with Matlab and my diags comes from.
>
> If you have ideas/suggestions it would be very cool! By the way, I compile with ifort v15 using build-option/linux_ia64_ifort.
>
> I wish you a wonderful year 2018 :)
>
> Sandy
>
> ps: I get same difference without mnc package
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
_______________________________________________
MITgcm-support mailing list
MITgcm-support at mitgcm.org
http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support
More information about the MITgcm-support
mailing list