Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fs subcycle cfl fix #307

Merged
merged 39 commits into from
Feb 23, 2017
Merged

Fs subcycle cfl fix #307

merged 39 commits into from
Feb 23, 2017

Conversation

ursg
Copy link
Contributor

@ursg ursg commented Feb 7, 2017

This replaces pull request #229, it was simply rebased onto current master.

The testpackage runs fine with it, but that is unsurprising, since the testpackage doesn't subcycle.

galfthan and others added 20 commits August 23, 2016 16:49
… solver.

Extremely slow as long time spent in allreduce itself.
Slowness is in large part due to load imbalance.
Also removed the writeVerbose commands.
No changes, passes testpackage against bc34c4d.
Magnetosphere has the following, small random diffs which are unavoidable.
Magnetosphere_small  -  Verifying bc34c4deaadfb99491b72b26c68545c1196dd7ab___DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER against df2ca359d2ed439613496c4819a649572162c1cc__DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER
--------------------------------------------------------------------------------------------
------------------------------------------------------------
 ref-time     |   new-time       |  speedup                |
------------------------------------------------------------
48.26        49.58         0.973376
------------------------------------------------------------
  variable     |     absolute diff     |     relative diff |
------------------------------------------------------------
rho_0                9.55033                 9.33096e-06
rho_v_0                4.88038e+06                 9.76061e-06
rho_v_1                165343                 8.39368e-06
rho_v_2                160637                 9.98949e-05
B_0                1.97057e-15                 4.93907e-07
B_1                2.73734e-15                 6.79429e-07
B_2                3.56442e-15                 2.13865e-10
E_0                5.79479e-09                 2.59921e-06
E_1                5.91271e-09                 9.21795e-07
E_2                4.06094e-09                 2.27526e-06
--------------------------------------------------------------------------------------------
   Distribution function diff
--------------------------------------------------------------------------------------------
INFO Reading in two files.
File names: /stornext/field/vlasiator/test_package_data/df2ca359d2ed439613496c4819a649572162c1cc__DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER/Magnetosphere_small/bulk.0000001.vlsv & /lustre/tmp/yann/testpackage/run/Magnetosphere_small/bulk.0000001.vlsv
NonIdenticalBlocks:      0
IdenticalBlocks:         3321
Absolute_Error:          1.89792e-18
Mean-Absolute-Error:     7.63565e-23
Max-Absolute-Error:      1.92028e-20
Absolute-log-Error:      6.45948e-05
Mean-Absolute-log-Error: 2.59876e-09
Conflicts:

	fieldsolver/ldz_electric_field.cpp
@ykempf
Copy link
Contributor

ykempf commented Feb 21, 2017

Can you for clarity summarise at the top what this is about? It is easier than clicking through to an old/other pull request and reading through an extended thing there...

ursg added 2 commits February 21, 2017 16:11
A new, dynamic timestep is actually being calculated, but then
discarded.
A new, dynamic timestep is actually being calculated, but then
discarded.
ursg and others added 10 commits February 21, 2017 17:19
And give a friendly message about it being overridden.
…vements

Field solver stepping improvements.

Everybody agrees that this looks good now, and it's about time we got this into master.
And give a friendly message about it being overridden.
Updated testpackage (subcycle tests and polar magnetosphere)
Fix update moments in acc

I conclude: Substeps look just as bad as the same amount of normal steps, this pull request doesn't alter them significantly, all is good.
@ursg
Copy link
Contributor Author

ursg commented Feb 23, 2017

This pull request is a makeover of the fieldsover subcycle dt calculation, to ensure that it never oversteps and doesn't do too few steps, either.

Original found during the "summer of debugging", where field artefacts were occuring on subcycle-amount-boundaries. Fixed by yann, then fixed again in a different way by sebastian (hence the large amount of commits), then rebased onto master by urs.

Conflicts:
	fieldsolver/ldz_main.cpp
@ykempf
Copy link
Contributor

ykempf commented Feb 23, 2017

The derivatives of the moments needn't be recomputed in the second RK step of any subcycle, not even during the first subcycle.

@ursg
Copy link
Contributor Author

ursg commented Feb 23, 2017

The updated testpackage shows 0 changes, except in the polar magnetosphere test and (ridiculously tiny) changes in the fieldsolver substep test:

--------------------------------------------------------------------------------------------
running Magnetosphere_polar_small 
Parameter data file (sw1.dat) has 1 values
--------------------------------------------------------------------------------------------
Magnetosphere_polar_small  -  Verifying dffbd6cc78031db7b0c6ae37056c0e8481528472___DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER__DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER against current
--------------------------------------------------------------------------------------------
------------------------------------------------------------
 ref-time     |   new-time       |  speedup                |
------------------------------------------------------------
344.6        356.3         0.967163
------------------------------------------------------------
  variable     |     absolute diff     |     relative diff | 
------------------------------------------------------------
rho_0                32.3124                 2.08945e-05    
rho_v_0                8.63193e+07                 0.000101274    
rho_v_1                6.339e+06                 0.00837116    
rho_v_2                4.5105e+07                 0.000884839    
B_0                2.91523e-12                 1.44123e-06    
B_1                2.78782e-13                 0.00369895    
B_2                5.90053e-12                 1.12096e-08    
E_0                2.37728e-07                 0.00202775    
E_1                6.30687e-06                 0.000526345    
E_2                1.42299e-07                 0.001516    
--------------------------------------------------------------------------------------------
   Distribution function diff                                                               
--------------------------------------------------------------------------------------------
INFO Reading in two files.
File names: /mnt/btrfs/work/uganse/testpackage/testpackage_data/current/Magnetosphere_polar_small/bulk.0000001.vlsv & /mnt/btrfs/work/uganse/testpackage/run_2017.02.23_13.25.53/Magnetosphere_polar_small/bulk.0000001.vlsv
NonIdenticalBlocks:      62
IdenticalBlocks:         100574
Absolute_Error:          1.81924e-10
Mean-Absolute-Error:     1.33509e-16
Max-Absolute-Error:      1.90082e-13
Absolute-log-Error:      4250.1
Mean-Absolute-log-Error: 0.00311903
--------------------------------------------------------------------------------------------
running test_fp_substeps 
--------------------------------------------------------------------------------------------
test_fp_substeps  -  Verifying dffbd6cc78031db7b0c6ae37056c0e8481528472___DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER__DACC_SEMILAG_PQM__DTRANS_SEMILAG_PPM__DDP__DDPF__DVEC4D_AGNER against current
--------------------------------------------------------------------------------------------
------------------------------------------------------------
 ref-time     |   new-time       |  speedup                |
------------------------------------------------------------
52.88        53.47         0.988966
------------------------------------------------------------
  variable     |     absolute diff     |     relative diff | 
------------------------------------------------------------
rho_0                0                 0    
rho_v_0                0                 0    
rho_v_1                0                 0    
rho_v_2                0                 0    
B_0                5.29913e-23                 6.8043e-14    
B_1                5.32498e-23                 6.83749e-14    
B_2                5.32498e-23                 6.83749e-14    
E_0                2.12182e-19                 1.2218e-13    
E_1                2.10911e-19                 1.21448e-13    
E_2                2.11017e-19                 1.21509e-13    
--------------------------------------------------------------------------------------------

so I assume this is really just caused by floating point-accuracy level changes.

// If we are at the first subcycle we need to update the derivatives of the moments,
// otherwise only B changed and those derivatives need to be updated.
calculateDerivativesSimple(mpiGrid, sysBoundaries, localCells, RK_ORDER2_STEP2, (subcycleCount==0));
// Here, we never need to update the moment derivatives since they will not have changed from
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, until we interpolate moments in time as Sebastian wants us to do since last summer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but that doesn't happen yet, so this is, for now, correct.

I would suggest merging this now, if there are no other objections.

@ykempf ykempf merged commit b9c3edc into fmihpc:master Feb 23, 2017
@ursg ursg deleted the fs_subcycle_cfl_fix branch February 23, 2017 12:51
ursg added a commit to ursg/vlasiator that referenced this pull request Feb 23, 2017
…uired

since within the substeps, the moments are being accessed at both RK2
times alternatingly, they need to be computed back and forth.

This *might* cost some performance, or then again it might be
negligible. If it is to costly, they could also be precomputed and
stored.
ursg added a commit to ursg/vlasiator that referenced this pull request Feb 24, 2017
…uired

since within the substeps, the moments are being accessed at both RK2
times alternatingly, they need to be computed back and forth.

This *might* cost some performance, or then again it might be
negligible. If it is to costly, they could also be precomputed and
stored.
ykempf added a commit that referenced this pull request Feb 24, 2017
Revert last commit of #307: Moment derivatives are actually required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants