Merge lp:~fluidity-core/fluidity/fix-lagr-detectors into lp:fluidity

Proposed by Michael Lange
Status: Merged
Merged at revision: 4315
Proposed branch: lp:~fluidity-core/fluidity/fix-lagr-detectors
Merge into: lp:fluidity
Diff against target: 554 lines (+319/-59)
13 files modified
femtools/Detector_Parallel.F90 (+25/-13)
femtools/Diagnostic_variables.F90 (+2/-1)
tests/detectors_parallel_adaptivity/detectors_parallel_adaptivity.xml (+12/-2)
tests/detectors_parallel_adaptivity/readtool.py (+0/-21)
tests/lagrangian_detectors/lagrangian_detectors.xml (+28/-2)
tests/lagrangian_detectors/lagrangian_detectors_rk.flml (+15/-0)
tests/lagrangian_detectors/readtool.py (+0/-20)
tests/lagrangian_detectors_checkpoint/Makefile (+9/-0)
tests/lagrangian_detectors_checkpoint/Xvals.txt (+1/-0)
tests/lagrangian_detectors_checkpoint/Yvals.txt (+1/-0)
tests/lagrangian_detectors_checkpoint/lagrangian_detectors.flml (+178/-0)
tests/lagrangian_detectors_checkpoint/lagrangian_detectors_checkpoint.xml (+35/-0)
tests/lagrangian_detectors_checkpoint/square.geo (+13/-0)
To merge this branch: bzr merge lp:~fluidity-core/fluidity/fix-lagr-detectors
Reviewer Review Type Date Requested Status
Jon Hill Approve
Rhodri Davies Approve
Review via email: mp+202367@code.launchpad.net

Description of the change

Fixing several bugs in lagrangian detectors:

 * Bug #1262890: Single lagrangian detectors are initialised with wrong names, causing detector I/O to fail in parallel
 * Bug #1260019: Prevent buffer corruption in exchange_detectors through use of multiple send/receive buffers
 * Re-initialisation of detector names from checkpoint

To post a comment you must log in.
Revision history for this message
Michael Lange (michael-lange) wrote :

Buildbot queue is green.

Revision history for this message
Rhodri Davies (rhodri-davies) wrote :

Hi Michael,

The changes looks good to me, although it may be worth somebody that better understands how detectors are handled in parallel taking a look at the MPI changes before the merge is approved.

One issue: there don't seem to be any modifications to tests to verify that these errors will not crop up again in the future. Is there any way some of the lagrangian detector cases could be modified to test these things? I guess a test for the individual lagrangian detector I/O bug could easily be added to an existing test, but how about the other bug?

Rhod

Revision history for this message
Jon Hill (jon-hill) wrote :

Yep - these look good. We do need a short test, if possible to verify these changes do fix the bug (I'm positive they do!) and do make the detectors more robust in general. Otherwise, it's an approve from me.

4305. By Michael Lange

Adding a test for single lagrangian detectors.

4306. By Michael Lange

Adding a test for detector checkpointing based on the lagrangian_detectors test.

4307. By Michael Lange

Bugfix to allow detector output files to grow larger than 2.1GB. Thanks to Jean Mensa for reporting and providing the fix for this.

4308. By Michael Lange

Merge from trunk

Revision history for this message
Michael Lange (michael-lange) wrote :

I added tests for detector checkpointing and the single lagrangian detector fix. The buffer corruption issue, however, cannot reliably be triggered and requires a lot of detectors; so I think it is impractical to test for this in small/medium tests.

I have also added Jean Mensa's fix for large detector output files, but again this seems like a corner case that is very hard to catch in buildbot.

Revision history for this message
Jon Hill (jon-hill) wrote :

Fine - we can't add tests for 3Gb files on a buildbot, so approved.

review: Approve
Revision history for this message
Rhodri Davies (rhodri-davies) wrote :

Hi Michael/Jon,

Sorry - I emailed Michal this earlier rather than add it to the review... At present, there remains work to be done before the merge (email copied below)...

------------

Hi Michael,

Whilst looking over your most recent changes to the fix_lagr_detectors branch, I tried to run the lagrangian_detectors test case locally. I get the following error (with backtrace):

*** FLUIDITY ERROR ***
Source location: (Diagnostic_variables.F90, 2785)
Error message: Failed assertion ierror == MPI_SUCCESS
Backtrace will follow if it is available:
../../bin/fluidity(fprint_backtrace_+0x1f) [0x57be1f]
../../bin/fluidity(__fldebug_MOD_flabort_pinpoint+0x304) [0x5701c3]
../../bin/fluidity(__diagnostic_variables_MOD_write_mpi_out+0x7a0) [0x627c29]
../../bin/fluidity(__diagnostic_variables_MOD_write_detectors+0x1c7d) [0x62af98]
../../bin/fluidity(__diagnostic_variables_MOD_write_diagnostics+0x577d) [0x635d9e]
../../bin/fluidity(__fluids_module_MOD_fluids+0x72a5) [0x57b17c]
../../bin/fluidity(mainfl+0x11d) [0x56d889]
../../bin/fluidity(main+0x177) [0x5641ad]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f785ded476d]
../../bin/fluidity() [0x563d51]
Use addr2line -e <binary> <address> to decipher.
Error is terminal.

I configured as follows:

./configure --enable-debugging --enable-2d-adaptivity ; make clean ; make -j ; make -j fltools

Do you get this error locally?

Buildbot on your branch is also red right now (but apparently not for this test, which confuses me slightly!)... Any ideas?

Rhod

Revision history for this message
Jon Hill (jon-hill) wrote :

then we will fix the approve :)

review: Needs Fixing
4309. By Michael Lange

Reverting the previous bugfix for large detector output files, since it causes buildbot failures. We'll have to re-visit this problem in a separate merge.

Revision history for this message
Michael Lange (michael-lange) wrote :

Hi Rhodri,

All tests pass locally for me, so the buildbot error is indeed confusing. Your local error though should to be due to the filesize bugfix I just reverted. Can you please confirm that this works now?

Thanks
Michael

Revision history for this message
Rhodri Davies (rhodri-davies) wrote :

Hi Michael,

I can confirm that the error is fixed on my local system, whilst detectors_parallel_adaptivity also passes locally. Sadly the buildbot branch is still red for the detectors_parallel_adaptivity case, however, which I think is a tolerance issue. Are you happy to reduce the final_location_error tolerance slightly (if this is indeed the issue on buildbot of course)? Once this test passes on buildbot I think this merge is good to go.

Rhod

Revision history for this message
Xiaohu Guo (xiaohu-guo) wrote :

Hi Michael,
   Just a thought.

   in femtools/Detector_Parallel.F90:35

   should MPI_ISEND also covered by "if (ndet_to_send>0)", otherwise you would have zero messages ?

Cheers
Xiaohu

4310. By Michael Lange

Avoid errors due to Python import caching in all lagrangian detector tests.

When runnning all test in one Python instance, like buildbot does, Python
would load the wrong readtool.py due to import caching. This can be avoided
by moving the test code into the xml.

Revision history for this message
Michael Lange (michael-lange) wrote :

Buildbot is green now.

Revision history for this message
Rhodri Davies (rhodri-davies) wrote :

In that case - I think it's good to go. Nice work.

review: Approve
Revision history for this message
Jon Hill (jon-hill) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'femtools/Detector_Parallel.F90'
2--- femtools/Detector_Parallel.F90 2011-10-14 07:58:31 +0000
3+++ femtools/Detector_Parallel.F90 2014-01-29 10:13:58 +0000
4@@ -50,6 +50,11 @@
5 type(detector_list_ptr), dimension(:), allocatable, target, save :: detector_list_array
6 integer :: num_detector_lists = 0
7
8+ type detector_buffer
9+ !!< Container type for MPI data buffers
10+ real, dimension(:,:), pointer :: ptr
11+ end type detector_buffer
12+
13 contains
14
15 subroutine register_detector_list(detector_list)
16@@ -301,7 +306,7 @@
17 type(detector_linked_list), intent(inout) :: detector_list
18 type(detector_linked_list), dimension(:), intent(inout) :: send_list_array
19
20- real, dimension(:,:), allocatable :: detector_buffer
21+ type(detector_buffer), dimension(:), allocatable :: send_buffer, recv_buffer
22 type(detector_type), pointer :: detector, detector_received
23 type(vector_field), pointer :: xfield
24 type(halo_type), pointer :: ele_halo
25@@ -342,9 +347,10 @@
26 end if
27
28 ! Send to all procs
29+ allocate(send_buffer(nprocs))
30 do target_proc=1, nprocs
31 ndet_to_send=send_list_array(target_proc)%length
32- allocate(detector_buffer(ndet_to_send,det_size))
33+ allocate(send_buffer(target_proc)%ptr(ndet_to_send,det_size))
34
35 if (ndet_to_send>0) then
36 ewrite(2,*) " Sending", ndet_to_send, "detectors to process", target_proc
37@@ -360,9 +366,9 @@
38 detector%element = halo_universal_number(ele_halo, detector%element)
39
40 if (have_update_vector) then
41- call pack_detector(detector, detector_buffer(j,1:det_size), dim, nstages=n_stages)
42+ call pack_detector(detector, send_buffer(target_proc)%ptr(j,1:det_size), dim, nstages=n_stages)
43 else
44- call pack_detector(detector, detector_buffer(j,1:det_size), dim)
45+ call pack_detector(detector, send_buffer(target_proc)%ptr(j,1:det_size), dim)
46 end if
47
48 ! delete also advances detector
49@@ -372,18 +378,17 @@
50 end if
51
52 ! getprocno() returns the rank of the processor + 1, hence target_proc-1
53- call MPI_ISEND(detector_buffer,size(detector_buffer), &
54+ call MPI_ISEND(send_buffer(target_proc)%ptr,size(send_buffer(target_proc)%ptr(:,:)), &
55 & getpreal(), target_proc-1, TAG, MPI_COMM_FEMTOOLS, sendRequest(target_proc), IERROR)
56 assert(ierror == MPI_SUCCESS)
57
58- ! deallocate buffer after sending
59- deallocate(detector_buffer)
60 end do
61
62 allocate( status(MPI_STATUS_SIZE) )
63 call get_universal_numbering_inverse(ele_halo, ele_numbering_inverse)
64
65 ! Receive from all procs
66+ allocate(recv_buffer(nprocs))
67 do receive_proc=1, nprocs
68 call MPI_PROBE(receive_proc-1, TAG, MPI_COMM_FEMTOOLS, status(:), IERROR)
69 assert(ierror == MPI_SUCCESS)
70@@ -392,13 +397,13 @@
71 assert(ierror == MPI_SUCCESS)
72
73 ndet_received=count/det_size
74- allocate(detector_buffer(ndet_received,det_size))
75+ allocate(recv_buffer(receive_proc)%ptr(ndet_received,det_size))
76
77 if (ndet_received>0) then
78 ewrite(2,*) " Receiving", ndet_received, "detectors from process", receive_proc
79 end if
80
81- call MPI_Recv(detector_buffer,count, getpreal(), status(MPI_SOURCE), TAG, MPI_COMM_FEMTOOLS, MPI_STATUS_IGNORE, IERROR)
82+ call MPI_Recv(recv_buffer(receive_proc)%ptr,count, getpreal(), status(MPI_SOURCE), TAG, MPI_COMM_FEMTOOLS, MPI_STATUS_IGNORE, IERROR)
83 assert(ierror == MPI_SUCCESS)
84
85 do j=1, ndet_received
86@@ -407,10 +412,10 @@
87 ! Unpack routine uses ele_numbering_inverse to translate universal element
88 ! back to local detector element
89 if (have_update_vector) then
90- call unpack_detector(detector_received,detector_buffer(j,1:det_size),dim,&
91+ call unpack_detector(detector_received,recv_buffer(receive_proc)%ptr(j,1:det_size),dim,&
92 global_to_local=ele_numbering_inverse,coordinates=xfield,nstages=n_stages)
93 else
94- call unpack_detector(detector_received,detector_buffer(j,1:det_size),dim,&
95+ call unpack_detector(detector_received,recv_buffer(receive_proc)%ptr(j,1:det_size),dim,&
96 global_to_local=ele_numbering_inverse,coordinates=xfield)
97 end if
98
99@@ -423,8 +428,15 @@
100
101 call insert(detector_received, detector_list)
102 end do
103- deallocate(detector_buffer)
104- end do
105+ end do
106+
107+ ! Deallocate buffers after exchange
108+ do target_proc=1, nprocs
109+ deallocate(send_buffer(target_proc)%ptr)
110+ deallocate(recv_buffer(target_proc)%ptr)
111+ end do
112+ deallocate(send_buffer)
113+ deallocate(recv_buffer)
114
115 call MPI_WAITALL(nprocs, sendRequest, MPI_STATUSES_IGNORE, IERROR)
116 assert(ierror == MPI_SUCCESS)
117
118=== modified file 'femtools/Diagnostic_variables.F90'
119--- femtools/Diagnostic_variables.F90 2013-10-10 07:35:33 +0000
120+++ femtools/Diagnostic_variables.F90 2014-01-29 10:13:58 +0000
121@@ -1533,7 +1533,7 @@
122 default_stat%detector_list%detector_names(static_dete+i)=detector_name
123
124 call create_single_detector(default_stat%detector_list, xfield, &
125- detector_location, static_dete+1, LAGRANGIAN_DETECTOR, trim(detector_name))
126+ detector_location, static_dete+i, LAGRANGIAN_DETECTOR, trim(detector_name))
127 end do
128
129 k=static_dete+lagrangian_dete+1
130@@ -1682,6 +1682,7 @@
131 read(default_stat%detector_checkpoint_unit) detector_location
132 call create_single_detector(default_stat%detector_list, xfield, &
133 detector_location, k, type_det, trim(detector_name))
134+ default_stat%detector_list%detector_names(k)=trim(detector_name)
135 k=k+1
136 end do
137 else
138
139=== modified file 'tests/detectors_parallel_adaptivity/detectors_parallel_adaptivity.xml'
140--- tests/detectors_parallel_adaptivity/detectors_parallel_adaptivity.xml 2013-08-21 19:58:53 +0000
141+++ tests/detectors_parallel_adaptivity/detectors_parallel_adaptivity.xml 2014-01-29 10:13:58 +0000
142@@ -18,8 +18,18 @@
143 ElapsedTime=s["ElapsedTime"]["value"]
144 </variable>
145 <variable name="last_locations_error" language="python">
146-from readtool import readstat
147-last_locations_error = readstat("detectors.detectors")
148+from fluidity_tools import stat_parser
149+from numpy import zeros,fromfile
150+
151+s = stat_parser('detectors.detectors')
152+last_locations_error = zeros((2,100))
153+X = fromfile('Xvals.txt',sep=' ')
154+Y = fromfile('Yvals.txt',sep=' ')
155+for i in range(100):
156+ name = 'Steve_' + str(i+1).zfill(3)
157+ # +0.5 due to domain change from the lagrangian_detectors setup
158+ last_locations_error[0,i] = s[name]['position'][0][-1] - X[i] + 0.5
159+ last_locations_error[1,i] = s[name]['position'][1][-1] - Y[i] + 0.5
160 </variable>
161 </variables>
162 <pass_tests>
163
164=== removed file 'tests/detectors_parallel_adaptivity/readtool.py'
165--- tests/detectors_parallel_adaptivity/readtool.py 2011-06-08 19:33:56 +0000
166+++ tests/detectors_parallel_adaptivity/readtool.py 1970-01-01 00:00:00 +0000
167@@ -1,21 +0,0 @@
168-from fluidity_tools import stat_parser
169-from numpy import zeros,fromfile
170-def readstat(file_name):
171- s = stat_parser(file_name)
172-
173- last_locations_error = zeros((2,100))
174- for i in range(100):
175- n = i + 1
176- padding = ''
177- if(n<100):
178- padding = '0'
179- if(n<10):
180- padding ='00'
181- # +0.5 due to domain change from the lagrangian_detectors setup
182- last_locations_error[0,i] = s['Steve_'+padding+str(n)]['position'][0][-1]+0.5
183- last_locations_error[1,i] = s['Steve_'+padding+str(n)]['position'][1][-1]+0.5
184- X = fromfile('Xvals.txt',sep=' ')
185- Y = fromfile('Yvals.txt',sep=' ')
186- last_locations_error[0,:] = last_locations_error[0,:] - X
187- last_locations_error[1,:] = last_locations_error[1,:] - Y
188- return last_locations_error
189
190=== modified file 'tests/lagrangian_detectors/lagrangian_detectors.xml'
191--- tests/lagrangian_detectors/lagrangian_detectors.xml 2013-08-21 19:58:53 +0000
192+++ tests/lagrangian_detectors/lagrangian_detectors.xml 2014-01-29 10:13:58 +0000
193@@ -11,12 +11,38 @@
194 </command_line>
195 </problem_definition>
196 <variables>
197+ <variable name="last_single_locations_error" language="python">
198+import numpy as np
199+from fluidity_tools import stat_parser
200+s = stat_parser("lagrangian_detectors.detectors")
201+last_single_locations_error = np.zeros((2,3))
202+X = np.fromfile('Xvals.txt',sep=' ')
203+Y = np.fromfile('Yvals.txt',sep=' ')
204+last_single_locations_error[0,0] = s['Single_Lagr_1']['position'][0][-1] - X[0]
205+last_single_locations_error[1,0] = s['Single_Lagr_1']['position'][1][-1] - Y[0]
206+last_single_locations_error[0,1] = s['Single_Lagr_2']['position'][0][-1] - X[50]
207+last_single_locations_error[1,1] = s['Single_Lagr_2']['position'][1][-1] - Y[50]
208+last_single_locations_error[0,2] = s['Single_Lagr_3']['position'][0][-1] - X[99]
209+last_single_locations_error[1,2] = s['Single_Lagr_3']['position'][1][-1] - Y[99]
210+ </variable>
211 <variable name="last_locations_error" language="python">
212-from readtool import readstat
213-last_locations_error = readstat()
214+from fluidity_tools import stat_parser
215+from numpy import zeros,fromfile
216+
217+s = stat_parser('lagrangian_detectors.detectors')
218+last_locations_error = zeros((2,100))
219+X = fromfile('Xvals.txt',sep=' ')
220+Y = fromfile('Yvals.txt',sep=' ')
221+for i in range(100):
222+ name = 'Steve_' + str(i+1).zfill(3)
223+ last_locations_error[0,i] = s[name]['position'][0][-1] - X[i]
224+ last_locations_error[1,i] = s[name]['position'][1][-1] - Y[i]
225 </variable>
226 </variables>
227 <pass_tests>
228+ <test name="CorrectSingleLagrangianDetectors" language="python">
229+assert abs(last_single_locations_error).max() &lt; 1.0e-6
230+ </test>
231 <test name="CorrectLagrangianTrajectory" language="python">
232 assert abs(last_locations_error).max() &lt; 1.0e-6
233 </test>
234
235=== modified file 'tests/lagrangian_detectors/lagrangian_detectors_rk.flml'
236--- tests/lagrangian_detectors/lagrangian_detectors_rk.flml 2012-03-11 02:25:56 +0000
237+++ tests/lagrangian_detectors/lagrangian_detectors_rk.flml 2014-01-29 10:13:58 +0000
238@@ -52,6 +52,21 @@
239 <output_mesh name="VelocityMesh"/>
240 <stat/>
241 <detectors>
242+ <lagrangian_detector name="Single_Lagr_1">
243+ <location>
244+ <real_value shape="2" dim1="dim" rank="1">0.5 0.5</real_value>
245+ </location>
246+ </lagrangian_detector>
247+ <lagrangian_detector name="Single_Lagr_2">
248+ <location>
249+ <real_value shape="2" dim1="dim" rank="1">0.625 0.5</real_value>
250+ </location>
251+ </lagrangian_detector>
252+ <lagrangian_detector name="Single_Lagr_3">
253+ <location>
254+ <real_value shape="2" dim1="dim" rank="1">0.7475 0.5</real_value>
255+ </location>
256+ </lagrangian_detector>
257 <detector_array name="Steve">
258 <number_of_detectors>
259 <integer_value rank="0">100</integer_value>
260
261=== removed file 'tests/lagrangian_detectors/readtool.py'
262--- tests/lagrangian_detectors/readtool.py 2011-02-16 16:29:58 +0000
263+++ tests/lagrangian_detectors/readtool.py 1970-01-01 00:00:00 +0000
264@@ -1,20 +0,0 @@
265-from fluidity_tools import stat_parser
266-from numpy import zeros,fromfile
267-def readstat():
268- s = stat_parser("lagrangian_detectors.detectors")
269-
270- last_locations_error = zeros((2,100))
271- for i in range(100):
272- n = i + 1
273- padding = ''
274- if(n<100):
275- padding = '0'
276- if(n<10):
277- padding ='00'
278- last_locations_error[0,i] = s['Steve_'+padding+str(n)]['position'][0][-1]
279- last_locations_error[1,i] = s['Steve_'+padding+str(n)]['position'][1][-1]
280- X = fromfile('Xvals.txt',sep=' ')
281- Y = fromfile('Yvals.txt',sep=' ')
282- last_locations_error[0,:] = last_locations_error[0,:] - X
283- last_locations_error[1,:] = last_locations_error[1,:] - Y
284- return last_locations_error
285
286=== added directory 'tests/lagrangian_detectors_checkpoint'
287=== added file 'tests/lagrangian_detectors_checkpoint/Makefile'
288--- tests/lagrangian_detectors_checkpoint/Makefile 1970-01-01 00:00:00 +0000
289+++ tests/lagrangian_detectors_checkpoint/Makefile 2014-01-29 10:13:58 +0000
290@@ -0,0 +1,9 @@
291+input: default
292+default: clean
293+ gmsh -2 -bin square.geo -o square.msh
294+
295+clean:
296+ rm -rf *.msh *.halo *.vtu *.pvtu *.log* *.err* *.stat blob_[012] *.detectors *.dat *.groups *flredecomp* *checkpoint.flml
297+
298+logs:
299+ ../../bin/fluidity -v3 -l lagrangian_detectors_rk.flml
300
301=== added file 'tests/lagrangian_detectors_checkpoint/Xvals.txt'
302--- tests/lagrangian_detectors_checkpoint/Xvals.txt 1970-01-01 00:00:00 +0000
303+++ tests/lagrangian_detectors_checkpoint/Xvals.txt 2014-01-29 10:13:58 +0000
304@@ -0,0 +1,1 @@
305+0.5 0.499391156266 0.498782312532 0.498173468799 0.497564625065 0.496955781331 0.496346937597 0.495738093863 0.49512925013 0.494520406396 0.493911562662 0.493302718928 0.492693875194 0.492085031461 0.491476187727 0.490867343993 0.490258500259 0.489649656525 0.489040812792 0.488431969058 0.487823125324 0.48721428159 0.486605437856 0.485996594123 0.485387750389 0.484778906655 0.484170062921 0.483561219187 0.482952375453 0.48234353172 0.481734687986 0.481125844252 0.480517000518 0.479908156784 0.479299313051 0.478690469317 0.478081625583 0.477472781849 0.476863938115 0.476255094382 0.475646250648 0.475037406914 0.47442856318 0.473819719446 0.473210875713 0.472602031979 0.471993188245 0.471384344511 0.470775500777 0.470166657044 0.46955781331 0.468948969576 0.468340125842 0.467731282108 0.467122438375 0.466513594641 0.465904750907 0.465295907173 0.464687063439 0.464078219706 0.463469375972 0.462860532238 0.462251688504 0.46164284477 0.461034001037 0.460425157303 0.459816313569 0.459207469835 0.458598626101 0.457989782368 0.457380938634 0.4567720949 0.456163251166 0.455554407432 0.454945563699 0.454336719965 0.453727876231 0.453119032497 0.452510188763 0.45190134503 0.451292501296 0.450683657562 0.450074813828 0.449465970094 0.44885712636 0.448248282627 0.447639438893 0.447030595159 0.446421751425 0.445812907691 0.445204063958 0.444595220224 0.44398637649 0.443377532756 0.442768689022 0.442159845289 0.441551001555 0.440942157821 0.440333314087 0.439724470353
306\ No newline at end of file
307
308=== added file 'tests/lagrangian_detectors_checkpoint/Yvals.txt'
309--- tests/lagrangian_detectors_checkpoint/Yvals.txt 1970-01-01 00:00:00 +0000
310+++ tests/lagrangian_detectors_checkpoint/Yvals.txt 2014-01-29 10:13:58 +0000
311@@ -0,0 +1,1 @@
312+0.5 0.50242472726 0.50484945452 0.50727418178 0.50969890904 0.5121236363 0.51454836356 0.51697309082 0.51939781808 0.52182254534 0.5242472726 0.52667199986 0.52909672712 0.53152145438 0.53394618164 0.5363709089 0.53879563616 0.54122036342 0.54364509068 0.54606981794 0.5484945452 0.55091927246 0.55334399972 0.55576872698 0.55819345424 0.5606181815 0.56304290876 0.56546763602 0.56789236328 0.57031709054 0.5727418178 0.57516654506 0.57759127232 0.58001599958 0.58244072684 0.5848654541 0.58729018136 0.58971490862 0.59213963588 0.59456436314 0.5969890904 0.59941381766 0.60183854492 0.60426327218 0.60668799944 0.6091127267 0.61153745396 0.61396218122 0.61638690848 0.61881163574 0.621236363 0.62366109026 0.62608581752 0.62851054478 0.63093527204 0.6333599993 0.63578472656 0.63820945382 0.64063418108 0.64305890834 0.6454836356 0.64790836286 0.65033309012 0.65275781738 0.65518254464 0.6576072719 0.66003199916 0.662456726419 0.664881453679 0.667306180939 0.669730908199 0.672155635459 0.674580362719 0.677005089979 0.679429817239 0.681854544499 0.684279271759 0.686703999019 0.689128726279 0.691553453539 0.693978180799 0.696402908059 0.698827635319 0.701252362579 0.703677089839 0.706101817099 0.708526544359 0.710951271619 0.713375998879 0.715800726139 0.718225453399 0.720650180659 0.723074907919 0.725499635179 0.727924362439 0.730349089699 0.732773816959 0.735198544219 0.737623271479 0.740047998739
313\ No newline at end of file
314
315=== added file 'tests/lagrangian_detectors_checkpoint/lagrangian_detectors.flml'
316--- tests/lagrangian_detectors_checkpoint/lagrangian_detectors.flml 1970-01-01 00:00:00 +0000
317+++ tests/lagrangian_detectors_checkpoint/lagrangian_detectors.flml 2014-01-29 10:13:58 +0000
318@@ -0,0 +1,178 @@
319+<?xml version='1.0' encoding='utf-8'?>
320+<fluidity_options>
321+ <simulation_name>
322+ <string_value lines="1">lagrangian_detectors</string_value>
323+ </simulation_name>
324+ <problem_type>
325+ <string_value lines="1">fluids</string_value>
326+ </problem_type>
327+ <geometry>
328+ <dimension>
329+ <integer_value rank="0">2</integer_value>
330+ </dimension>
331+ <mesh name="CoordinateMesh">
332+ <from_file file_name="square">
333+ <format name="gmsh"/>
334+ <stat>
335+ <include_in_stat/>
336+ </stat>
337+ </from_file>
338+ </mesh>
339+ <mesh name="VelocityMesh">
340+ <from_mesh>
341+ <mesh name="CoordinateMesh"/>
342+ <mesh_shape>
343+ <polynomial_degree>
344+ <integer_value rank="0">1</integer_value>
345+ </polynomial_degree>
346+ </mesh_shape>
347+ <mesh_continuity>
348+ <string_value>discontinuous</string_value>
349+ </mesh_continuity>
350+ <stat>
351+ <exclude_from_stat/>
352+ </stat>
353+ </from_mesh>
354+ </mesh>
355+ <quadrature>
356+ <degree>
357+ <integer_value rank="0">3</integer_value>
358+ </degree>
359+ </quadrature>
360+ </geometry>
361+ <io>
362+ <dump_format>
363+ <string_value>vtk</string_value>
364+ </dump_format>
365+ <dump_period>
366+ <constant>
367+ <real_value rank="0">4.0</real_value>
368+ </constant>
369+ </dump_period>
370+ <output_mesh name="VelocityMesh"/>
371+ <checkpointing>
372+ <checkpoint_period_in_dumps>
373+ <integer_value rank="0">1</integer_value>
374+ </checkpoint_period_in_dumps>
375+ </checkpointing>
376+ <stat/>
377+ <detectors>
378+ <detector_array name="Steve">
379+ <number_of_detectors>
380+ <integer_value rank="0">100</integer_value>
381+ </number_of_detectors>
382+ <lagrangian/>
383+ <python>
384+ <string_value lines="20" type="code" language="python">def val(t):
385+ from numpy import arange,zeros,reshape,concatenate
386+ x = 0.5+0.25*arange(0,100.)/100.
387+ y = zeros(100) + 0.5
388+ return reshape(concatenate((x,y)),(2,100)).T</string_value>
389+ </python>
390+ </detector_array>
391+ <fail_outside_domain/>
392+ <lagrangian_timestepping>
393+ <subcycles>
394+ <integer_value rank="0">1</integer_value>
395+ </subcycles>
396+ <search_tolerance>
397+ <real_value rank="0">1.0e-10</real_value>
398+ </search_tolerance>
399+ <explicit_runge_kutta_guided_search>
400+ <n_stages>
401+ <integer_value rank="0">4</integer_value>
402+ </n_stages>
403+ <stage_weights>
404+ <real_value shape="6" rank="1">0.5 0. 0.5 0. 0. 1</real_value>
405+ </stage_weights>
406+ <timestep_weights>
407+ <real_value shape="4" rank="1">0.16666666666666666 0.3333333333333333
408+ 0.3333333333333333 0.16666666666666666</real_value>
409+ </timestep_weights>
410+ </explicit_runge_kutta_guided_search>
411+ </lagrangian_timestepping>
412+ </detectors>
413+ </io>
414+ <timestepping>
415+ <current_time>
416+ <real_value rank="0">0.0</real_value>
417+ </current_time>
418+ <timestep>
419+ <real_value rank="0">0.1</real_value>
420+ </timestep>
421+ <finish_time>
422+ <real_value rank="0">8</real_value>
423+ </finish_time>
424+ </timestepping>
425+ <physical_parameters>
426+ <gravity>
427+ <magnitude>
428+ <real_value rank="0">1</real_value>
429+ </magnitude>
430+ <vector_field name="GravityDirection" rank="1">
431+ <prescribed>
432+ <mesh name="CoordinateMesh"/>
433+ <value name="WholeMesh">
434+ <constant>
435+ <real_value shape="2" dim1="dim" rank="1">0.0 -1.0</real_value>
436+ </constant>
437+ </value>
438+ <output/>
439+ <stat>
440+ <include_in_stat/>
441+ </stat>
442+ <detectors>
443+ <exclude_from_detectors/>
444+ </detectors>
445+ </prescribed>
446+ </vector_field>
447+ </gravity>
448+ </physical_parameters>
449+ <material_phase name="BoussinesqFluid">
450+ <vector_field name="Velocity" rank="1">
451+ <prescribed>
452+ <mesh name="VelocityMesh"/>
453+ <value name="WholeMesh">
454+ <python>
455+ <string_value lines="20" type="code" language="python">def val(X,t):
456+ x = X[0]
457+ y = X[1]
458+ return [-(y-0.5),x-0.5]</string_value>
459+ </python>
460+ </value>
461+ <output/>
462+ <stat>
463+ <include_in_stat/>
464+ </stat>
465+ <detectors>
466+ <exclude_from_detectors/>
467+ </detectors>
468+ </prescribed>
469+ </vector_field>
470+ </material_phase>
471+ <mesh_adaptivity>
472+ <hr_adaptivity>
473+ <period>
474+ <real_value rank="0">4.</real_value>
475+ </period>
476+ <maximum_number_of_nodes>
477+ <integer_value rank="0">200</integer_value>
478+ </maximum_number_of_nodes>
479+ <enable_gradation/>
480+ <tensor_field name="MinimumEdgeLengths">
481+ <anisotropic_symmetric>
482+ <constant>
483+ <real_value symmetric="true" dim2="dim" shape="2 2" dim1="dim" rank="2">0.05 0.0 0.0 0.05</real_value>
484+ </constant>
485+ </anisotropic_symmetric>
486+ </tensor_field>
487+ <tensor_field name="MaximumEdgeLengths">
488+ <anisotropic_symmetric>
489+ <constant>
490+ <real_value symmetric="true" dim2="dim" shape="2 2" dim1="dim" rank="2">0.06 0.0 0.0 0.06</real_value>
491+ </constant>
492+ </anisotropic_symmetric>
493+ </tensor_field>
494+ </hr_adaptivity>
495+ </mesh_adaptivity>
496+</fluidity_options>
497
498=== added file 'tests/lagrangian_detectors_checkpoint/lagrangian_detectors_checkpoint.xml'
499--- tests/lagrangian_detectors_checkpoint/lagrangian_detectors_checkpoint.xml 1970-01-01 00:00:00 +0000
500+++ tests/lagrangian_detectors_checkpoint/lagrangian_detectors_checkpoint.xml 2014-01-29 10:13:58 +0000
501@@ -0,0 +1,35 @@
502+<?xml version="1.0" encoding="UTF-8" ?>
503+
504+<testproblem>
505+ <name>lagrangian_detectors_checkpoint</name>
506+ <owner userid="mlange"/>
507+ <tags>flml detectors checkpoint</tags>
508+ <problem_definition length="short" nprocs="4">
509+ <command_line>
510+../../bin/fluidity -v2 -l lagrangian_detectors.flml;
511+../../bin/fluidity -v2 -l lagrangian_detectors_1_checkpoint.flml
512+ </command_line>
513+ </problem_definition>
514+ <variables>
515+ <variable name="last_locations_error" language="python">
516+from fluidity_tools import stat_parser
517+from numpy import zeros,fromfile
518+
519+s = stat_parser('lagrangian_detectors_checkpoint.detectors')
520+last_locations_error = zeros((2,100))
521+X = fromfile('Xvals.txt',sep=' ')
522+Y = fromfile('Yvals.txt',sep=' ')
523+for i in range(100):
524+ name = 'Steve_' + str(i+1).zfill(3)
525+ last_locations_error[0,i] = s[name]['position'][0][-1] - X[i]
526+ last_locations_error[1,i] = s[name]['position'][1][-1] - Y[i]
527+ </variable>
528+ </variables>
529+ <pass_tests>
530+ <test name="CorrectLagrangianTrajectory" language="python">
531+assert abs(last_locations_error).max() &lt; 1.0e-6
532+ </test>
533+ </pass_tests>
534+ <warn_tests>
535+ </warn_tests>
536+</testproblem>
537
538=== added file 'tests/lagrangian_detectors_checkpoint/square.geo'
539--- tests/lagrangian_detectors_checkpoint/square.geo 1970-01-01 00:00:00 +0000
540+++ tests/lagrangian_detectors_checkpoint/square.geo 2014-01-29 10:13:58 +0000
541@@ -0,0 +1,13 @@
542+Point(1) = {0,0,0,0.03};
543+Extrude {1,0,0} {
544+ Point{1};
545+}
546+Extrude {0,1,0} {
547+ Line{1};
548+}
549+Physical Line(8) = {2};
550+Physical Line(9) = {4};
551+Physical Line(10) = {3};
552+Physical Line(11) = {1};
553+Physical Surface(7) = {5};
554+