Merge lp:~fluidity-core/fluidity/fix-lagr-detectors into lp:fluidity
- fix-lagr-detectors
- Merge into dev-trunk
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 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jon Hill | Approve | ||
Rhodri Davies | Approve | ||
Review via email: mp+202367@code.launchpad.net |
Commit message
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
Michael Lange (michael-lange) wrote : | # |
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
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
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.
Jon Hill (jon-hill) wrote : | # |
Fine - we can't add tests for 3Gb files on a buildbot, so approved.
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_
*** FLUIDITY ERROR ***
Source location: (Diagnostic_
Error message: Failed assertion ierror == MPI_SUCCESS
Backtrace will follow if it is available:
../../bin/
../../bin/
../../bin/
../../bin/
../../bin/
../../bin/
../../bin/
../../bin/
/lib/x86_
../../bin/
Use addr2line -e <binary> <address> to decipher.
Error is terminal.
I configured as follows:
./configure --enable-debugging --enable-
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
Jon Hill (jon-hill) wrote : | # |
then we will fix the approve :)
- 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.
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
Rhodri Davies (rhodri-davies) wrote : | # |
Hi Michael,
I can confirm that the error is fixed on my local system, whilst detectors_
Rhod
Xiaohu Guo (xiaohu-guo) wrote : | # |
Hi Michael,
Just a thought.
in femtools/
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.
Michael Lange (michael-lange) wrote : | # |
Buildbot is green now.
Rhodri Davies (rhodri-davies) wrote : | # |
In that case - I think it's good to go. Nice work.
Jon Hill (jon-hill) : | # |
Preview Diff
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 | 50 | type(detector_list_ptr), dimension(:), allocatable, target, save :: detector_list_array | 50 | type(detector_list_ptr), dimension(:), allocatable, target, save :: detector_list_array |
6 | 51 | integer :: num_detector_lists = 0 | 51 | integer :: num_detector_lists = 0 |
7 | 52 | 52 | ||
8 | 53 | type detector_buffer | ||
9 | 54 | !!< Container type for MPI data buffers | ||
10 | 55 | real, dimension(:,:), pointer :: ptr | ||
11 | 56 | end type detector_buffer | ||
12 | 57 | |||
13 | 53 | contains | 58 | contains |
14 | 54 | 59 | ||
15 | 55 | subroutine register_detector_list(detector_list) | 60 | subroutine register_detector_list(detector_list) |
16 | @@ -301,7 +306,7 @@ | |||
17 | 301 | type(detector_linked_list), intent(inout) :: detector_list | 306 | type(detector_linked_list), intent(inout) :: detector_list |
18 | 302 | type(detector_linked_list), dimension(:), intent(inout) :: send_list_array | 307 | type(detector_linked_list), dimension(:), intent(inout) :: send_list_array |
19 | 303 | 308 | ||
21 | 304 | real, dimension(:,:), allocatable :: detector_buffer | 309 | type(detector_buffer), dimension(:), allocatable :: send_buffer, recv_buffer |
22 | 305 | type(detector_type), pointer :: detector, detector_received | 310 | type(detector_type), pointer :: detector, detector_received |
23 | 306 | type(vector_field), pointer :: xfield | 311 | type(vector_field), pointer :: xfield |
24 | 307 | type(halo_type), pointer :: ele_halo | 312 | type(halo_type), pointer :: ele_halo |
25 | @@ -342,9 +347,10 @@ | |||
26 | 342 | end if | 347 | end if |
27 | 343 | 348 | ||
28 | 344 | ! Send to all procs | 349 | ! Send to all procs |
29 | 350 | allocate(send_buffer(nprocs)) | ||
30 | 345 | do target_proc=1, nprocs | 351 | do target_proc=1, nprocs |
31 | 346 | ndet_to_send=send_list_array(target_proc)%length | 352 | ndet_to_send=send_list_array(target_proc)%length |
33 | 347 | allocate(detector_buffer(ndet_to_send,det_size)) | 353 | allocate(send_buffer(target_proc)%ptr(ndet_to_send,det_size)) |
34 | 348 | 354 | ||
35 | 349 | if (ndet_to_send>0) then | 355 | if (ndet_to_send>0) then |
36 | 350 | ewrite(2,*) " Sending", ndet_to_send, "detectors to process", target_proc | 356 | ewrite(2,*) " Sending", ndet_to_send, "detectors to process", target_proc |
37 | @@ -360,9 +366,9 @@ | |||
38 | 360 | detector%element = halo_universal_number(ele_halo, detector%element) | 366 | detector%element = halo_universal_number(ele_halo, detector%element) |
39 | 361 | 367 | ||
40 | 362 | if (have_update_vector) then | 368 | if (have_update_vector) then |
42 | 363 | call pack_detector(detector, detector_buffer(j,1:det_size), dim, nstages=n_stages) | 369 | call pack_detector(detector, send_buffer(target_proc)%ptr(j,1:det_size), dim, nstages=n_stages) |
43 | 364 | else | 370 | else |
45 | 365 | call pack_detector(detector, detector_buffer(j,1:det_size), dim) | 371 | call pack_detector(detector, send_buffer(target_proc)%ptr(j,1:det_size), dim) |
46 | 366 | end if | 372 | end if |
47 | 367 | 373 | ||
48 | 368 | ! delete also advances detector | 374 | ! delete also advances detector |
49 | @@ -372,18 +378,17 @@ | |||
50 | 372 | end if | 378 | end if |
51 | 373 | 379 | ||
52 | 374 | ! getprocno() returns the rank of the processor + 1, hence target_proc-1 | 380 | ! getprocno() returns the rank of the processor + 1, hence target_proc-1 |
54 | 375 | call MPI_ISEND(detector_buffer,size(detector_buffer), & | 381 | call MPI_ISEND(send_buffer(target_proc)%ptr,size(send_buffer(target_proc)%ptr(:,:)), & |
55 | 376 | & getpreal(), target_proc-1, TAG, MPI_COMM_FEMTOOLS, sendRequest(target_proc), IERROR) | 382 | & getpreal(), target_proc-1, TAG, MPI_COMM_FEMTOOLS, sendRequest(target_proc), IERROR) |
56 | 377 | assert(ierror == MPI_SUCCESS) | 383 | assert(ierror == MPI_SUCCESS) |
57 | 378 | 384 | ||
58 | 379 | ! deallocate buffer after sending | ||
59 | 380 | deallocate(detector_buffer) | ||
60 | 381 | end do | 385 | end do |
61 | 382 | 386 | ||
62 | 383 | allocate( status(MPI_STATUS_SIZE) ) | 387 | allocate( status(MPI_STATUS_SIZE) ) |
63 | 384 | call get_universal_numbering_inverse(ele_halo, ele_numbering_inverse) | 388 | call get_universal_numbering_inverse(ele_halo, ele_numbering_inverse) |
64 | 385 | 389 | ||
65 | 386 | ! Receive from all procs | 390 | ! Receive from all procs |
66 | 391 | allocate(recv_buffer(nprocs)) | ||
67 | 387 | do receive_proc=1, nprocs | 392 | do receive_proc=1, nprocs |
68 | 388 | call MPI_PROBE(receive_proc-1, TAG, MPI_COMM_FEMTOOLS, status(:), IERROR) | 393 | call MPI_PROBE(receive_proc-1, TAG, MPI_COMM_FEMTOOLS, status(:), IERROR) |
69 | 389 | assert(ierror == MPI_SUCCESS) | 394 | assert(ierror == MPI_SUCCESS) |
70 | @@ -392,13 +397,13 @@ | |||
71 | 392 | assert(ierror == MPI_SUCCESS) | 397 | assert(ierror == MPI_SUCCESS) |
72 | 393 | 398 | ||
73 | 394 | ndet_received=count/det_size | 399 | ndet_received=count/det_size |
75 | 395 | allocate(detector_buffer(ndet_received,det_size)) | 400 | allocate(recv_buffer(receive_proc)%ptr(ndet_received,det_size)) |
76 | 396 | 401 | ||
77 | 397 | if (ndet_received>0) then | 402 | if (ndet_received>0) then |
78 | 398 | ewrite(2,*) " Receiving", ndet_received, "detectors from process", receive_proc | 403 | ewrite(2,*) " Receiving", ndet_received, "detectors from process", receive_proc |
79 | 399 | end if | 404 | end if |
80 | 400 | 405 | ||
82 | 401 | call MPI_Recv(detector_buffer,count, getpreal(), status(MPI_SOURCE), TAG, MPI_COMM_FEMTOOLS, MPI_STATUS_IGNORE, IERROR) | 406 | call MPI_Recv(recv_buffer(receive_proc)%ptr,count, getpreal(), status(MPI_SOURCE), TAG, MPI_COMM_FEMTOOLS, MPI_STATUS_IGNORE, IERROR) |
83 | 402 | assert(ierror == MPI_SUCCESS) | 407 | assert(ierror == MPI_SUCCESS) |
84 | 403 | 408 | ||
85 | 404 | do j=1, ndet_received | 409 | do j=1, ndet_received |
86 | @@ -407,10 +412,10 @@ | |||
87 | 407 | ! Unpack routine uses ele_numbering_inverse to translate universal element | 412 | ! Unpack routine uses ele_numbering_inverse to translate universal element |
88 | 408 | ! back to local detector element | 413 | ! back to local detector element |
89 | 409 | if (have_update_vector) then | 414 | if (have_update_vector) then |
91 | 410 | call unpack_detector(detector_received,detector_buffer(j,1:det_size),dim,& | 415 | call unpack_detector(detector_received,recv_buffer(receive_proc)%ptr(j,1:det_size),dim,& |
92 | 411 | global_to_local=ele_numbering_inverse,coordinates=xfield,nstages=n_stages) | 416 | global_to_local=ele_numbering_inverse,coordinates=xfield,nstages=n_stages) |
93 | 412 | else | 417 | else |
95 | 413 | call unpack_detector(detector_received,detector_buffer(j,1:det_size),dim,& | 418 | call unpack_detector(detector_received,recv_buffer(receive_proc)%ptr(j,1:det_size),dim,& |
96 | 414 | global_to_local=ele_numbering_inverse,coordinates=xfield) | 419 | global_to_local=ele_numbering_inverse,coordinates=xfield) |
97 | 415 | end if | 420 | end if |
98 | 416 | 421 | ||
99 | @@ -423,8 +428,15 @@ | |||
100 | 423 | 428 | ||
101 | 424 | call insert(detector_received, detector_list) | 429 | call insert(detector_received, detector_list) |
102 | 425 | end do | 430 | end do |
105 | 426 | deallocate(detector_buffer) | 431 | end do |
106 | 427 | end do | 432 | |
107 | 433 | ! Deallocate buffers after exchange | ||
108 | 434 | do target_proc=1, nprocs | ||
109 | 435 | deallocate(send_buffer(target_proc)%ptr) | ||
110 | 436 | deallocate(recv_buffer(target_proc)%ptr) | ||
111 | 437 | end do | ||
112 | 438 | deallocate(send_buffer) | ||
113 | 439 | deallocate(recv_buffer) | ||
114 | 428 | 440 | ||
115 | 429 | call MPI_WAITALL(nprocs, sendRequest, MPI_STATUSES_IGNORE, IERROR) | 441 | call MPI_WAITALL(nprocs, sendRequest, MPI_STATUSES_IGNORE, IERROR) |
116 | 430 | assert(ierror == MPI_SUCCESS) | 442 | assert(ierror == MPI_SUCCESS) |
117 | 431 | 443 | ||
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 | 1533 | default_stat%detector_list%detector_names(static_dete+i)=detector_name | 1533 | default_stat%detector_list%detector_names(static_dete+i)=detector_name |
123 | 1534 | 1534 | ||
124 | 1535 | call create_single_detector(default_stat%detector_list, xfield, & | 1535 | call create_single_detector(default_stat%detector_list, xfield, & |
126 | 1536 | detector_location, static_dete+1, LAGRANGIAN_DETECTOR, trim(detector_name)) | 1536 | detector_location, static_dete+i, LAGRANGIAN_DETECTOR, trim(detector_name)) |
127 | 1537 | end do | 1537 | end do |
128 | 1538 | 1538 | ||
129 | 1539 | k=static_dete+lagrangian_dete+1 | 1539 | k=static_dete+lagrangian_dete+1 |
130 | @@ -1682,6 +1682,7 @@ | |||
131 | 1682 | read(default_stat%detector_checkpoint_unit) detector_location | 1682 | read(default_stat%detector_checkpoint_unit) detector_location |
132 | 1683 | call create_single_detector(default_stat%detector_list, xfield, & | 1683 | call create_single_detector(default_stat%detector_list, xfield, & |
133 | 1684 | detector_location, k, type_det, trim(detector_name)) | 1684 | detector_location, k, type_det, trim(detector_name)) |
134 | 1685 | default_stat%detector_list%detector_names(k)=trim(detector_name) | ||
135 | 1685 | k=k+1 | 1686 | k=k+1 |
136 | 1686 | end do | 1687 | end do |
137 | 1687 | else | 1688 | else |
138 | 1688 | 1689 | ||
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 | 18 | ElapsedTime=s["ElapsedTime"]["value"] | 18 | ElapsedTime=s["ElapsedTime"]["value"] |
144 | 19 | </variable> | 19 | </variable> |
145 | 20 | <variable name="last_locations_error" language="python"> | 20 | <variable name="last_locations_error" language="python"> |
148 | 21 | from readtool import readstat | 21 | from fluidity_tools import stat_parser |
149 | 22 | last_locations_error = readstat("detectors.detectors") | 22 | from numpy import zeros,fromfile |
150 | 23 | |||
151 | 24 | s = stat_parser('detectors.detectors') | ||
152 | 25 | last_locations_error = zeros((2,100)) | ||
153 | 26 | X = fromfile('Xvals.txt',sep=' ') | ||
154 | 27 | Y = fromfile('Yvals.txt',sep=' ') | ||
155 | 28 | for i in range(100): | ||
156 | 29 | name = 'Steve_' + str(i+1).zfill(3) | ||
157 | 30 | # +0.5 due to domain change from the lagrangian_detectors setup | ||
158 | 31 | last_locations_error[0,i] = s[name]['position'][0][-1] - X[i] + 0.5 | ||
159 | 32 | last_locations_error[1,i] = s[name]['position'][1][-1] - Y[i] + 0.5 | ||
160 | 23 | </variable> | 33 | </variable> |
161 | 24 | </variables> | 34 | </variables> |
162 | 25 | <pass_tests> | 35 | <pass_tests> |
163 | 26 | 36 | ||
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 | 1 | from fluidity_tools import stat_parser | ||
169 | 2 | from numpy import zeros,fromfile | ||
170 | 3 | def readstat(file_name): | ||
171 | 4 | s = stat_parser(file_name) | ||
172 | 5 | |||
173 | 6 | last_locations_error = zeros((2,100)) | ||
174 | 7 | for i in range(100): | ||
175 | 8 | n = i + 1 | ||
176 | 9 | padding = '' | ||
177 | 10 | if(n<100): | ||
178 | 11 | padding = '0' | ||
179 | 12 | if(n<10): | ||
180 | 13 | padding ='00' | ||
181 | 14 | # +0.5 due to domain change from the lagrangian_detectors setup | ||
182 | 15 | last_locations_error[0,i] = s['Steve_'+padding+str(n)]['position'][0][-1]+0.5 | ||
183 | 16 | last_locations_error[1,i] = s['Steve_'+padding+str(n)]['position'][1][-1]+0.5 | ||
184 | 17 | X = fromfile('Xvals.txt',sep=' ') | ||
185 | 18 | Y = fromfile('Yvals.txt',sep=' ') | ||
186 | 19 | last_locations_error[0,:] = last_locations_error[0,:] - X | ||
187 | 20 | last_locations_error[1,:] = last_locations_error[1,:] - Y | ||
188 | 21 | return last_locations_error | ||
189 | 22 | 0 | ||
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 | 11 | </command_line> | 11 | </command_line> |
195 | 12 | </problem_definition> | 12 | </problem_definition> |
196 | 13 | <variables> | 13 | <variables> |
197 | 14 | <variable name="last_single_locations_error" language="python"> | ||
198 | 15 | import numpy as np | ||
199 | 16 | from fluidity_tools import stat_parser | ||
200 | 17 | s = stat_parser("lagrangian_detectors.detectors") | ||
201 | 18 | last_single_locations_error = np.zeros((2,3)) | ||
202 | 19 | X = np.fromfile('Xvals.txt',sep=' ') | ||
203 | 20 | Y = np.fromfile('Yvals.txt',sep=' ') | ||
204 | 21 | last_single_locations_error[0,0] = s['Single_Lagr_1']['position'][0][-1] - X[0] | ||
205 | 22 | last_single_locations_error[1,0] = s['Single_Lagr_1']['position'][1][-1] - Y[0] | ||
206 | 23 | last_single_locations_error[0,1] = s['Single_Lagr_2']['position'][0][-1] - X[50] | ||
207 | 24 | last_single_locations_error[1,1] = s['Single_Lagr_2']['position'][1][-1] - Y[50] | ||
208 | 25 | last_single_locations_error[0,2] = s['Single_Lagr_3']['position'][0][-1] - X[99] | ||
209 | 26 | last_single_locations_error[1,2] = s['Single_Lagr_3']['position'][1][-1] - Y[99] | ||
210 | 27 | </variable> | ||
211 | 14 | <variable name="last_locations_error" language="python"> | 28 | <variable name="last_locations_error" language="python"> |
214 | 15 | from readtool import readstat | 29 | from fluidity_tools import stat_parser |
215 | 16 | last_locations_error = readstat() | 30 | from numpy import zeros,fromfile |
216 | 31 | |||
217 | 32 | s = stat_parser('lagrangian_detectors.detectors') | ||
218 | 33 | last_locations_error = zeros((2,100)) | ||
219 | 34 | X = fromfile('Xvals.txt',sep=' ') | ||
220 | 35 | Y = fromfile('Yvals.txt',sep=' ') | ||
221 | 36 | for i in range(100): | ||
222 | 37 | name = 'Steve_' + str(i+1).zfill(3) | ||
223 | 38 | last_locations_error[0,i] = s[name]['position'][0][-1] - X[i] | ||
224 | 39 | last_locations_error[1,i] = s[name]['position'][1][-1] - Y[i] | ||
225 | 17 | </variable> | 40 | </variable> |
226 | 18 | </variables> | 41 | </variables> |
227 | 19 | <pass_tests> | 42 | <pass_tests> |
228 | 43 | <test name="CorrectSingleLagrangianDetectors" language="python"> | ||
229 | 44 | assert abs(last_single_locations_error).max() < 1.0e-6 | ||
230 | 45 | </test> | ||
231 | 20 | <test name="CorrectLagrangianTrajectory" language="python"> | 46 | <test name="CorrectLagrangianTrajectory" language="python"> |
232 | 21 | assert abs(last_locations_error).max() < 1.0e-6 | 47 | assert abs(last_locations_error).max() < 1.0e-6 |
233 | 22 | </test> | 48 | </test> |
234 | 23 | 49 | ||
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 | 52 | <output_mesh name="VelocityMesh"/> | 52 | <output_mesh name="VelocityMesh"/> |
240 | 53 | <stat/> | 53 | <stat/> |
241 | 54 | <detectors> | 54 | <detectors> |
242 | 55 | <lagrangian_detector name="Single_Lagr_1"> | ||
243 | 56 | <location> | ||
244 | 57 | <real_value shape="2" dim1="dim" rank="1">0.5 0.5</real_value> | ||
245 | 58 | </location> | ||
246 | 59 | </lagrangian_detector> | ||
247 | 60 | <lagrangian_detector name="Single_Lagr_2"> | ||
248 | 61 | <location> | ||
249 | 62 | <real_value shape="2" dim1="dim" rank="1">0.625 0.5</real_value> | ||
250 | 63 | </location> | ||
251 | 64 | </lagrangian_detector> | ||
252 | 65 | <lagrangian_detector name="Single_Lagr_3"> | ||
253 | 66 | <location> | ||
254 | 67 | <real_value shape="2" dim1="dim" rank="1">0.7475 0.5</real_value> | ||
255 | 68 | </location> | ||
256 | 69 | </lagrangian_detector> | ||
257 | 55 | <detector_array name="Steve"> | 70 | <detector_array name="Steve"> |
258 | 56 | <number_of_detectors> | 71 | <number_of_detectors> |
259 | 57 | <integer_value rank="0">100</integer_value> | 72 | <integer_value rank="0">100</integer_value> |
260 | 58 | 73 | ||
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 | 1 | from fluidity_tools import stat_parser | ||
266 | 2 | from numpy import zeros,fromfile | ||
267 | 3 | def readstat(): | ||
268 | 4 | s = stat_parser("lagrangian_detectors.detectors") | ||
269 | 5 | |||
270 | 6 | last_locations_error = zeros((2,100)) | ||
271 | 7 | for i in range(100): | ||
272 | 8 | n = i + 1 | ||
273 | 9 | padding = '' | ||
274 | 10 | if(n<100): | ||
275 | 11 | padding = '0' | ||
276 | 12 | if(n<10): | ||
277 | 13 | padding ='00' | ||
278 | 14 | last_locations_error[0,i] = s['Steve_'+padding+str(n)]['position'][0][-1] | ||
279 | 15 | last_locations_error[1,i] = s['Steve_'+padding+str(n)]['position'][1][-1] | ||
280 | 16 | X = fromfile('Xvals.txt',sep=' ') | ||
281 | 17 | Y = fromfile('Yvals.txt',sep=' ') | ||
282 | 18 | last_locations_error[0,:] = last_locations_error[0,:] - X | ||
283 | 19 | last_locations_error[1,:] = last_locations_error[1,:] - Y | ||
284 | 20 | return last_locations_error | ||
285 | 21 | 0 | ||
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 | 1 | input: default | ||
292 | 2 | default: clean | ||
293 | 3 | gmsh -2 -bin square.geo -o square.msh | ||
294 | 4 | |||
295 | 5 | clean: | ||
296 | 6 | rm -rf *.msh *.halo *.vtu *.pvtu *.log* *.err* *.stat blob_[012] *.detectors *.dat *.groups *flredecomp* *checkpoint.flml | ||
297 | 7 | |||
298 | 8 | logs: | ||
299 | 9 | ../../bin/fluidity -v3 -l lagrangian_detectors_rk.flml | ||
300 | 0 | 10 | ||
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 | 1 | 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 | 0 | \ No newline at end of file | 2 | \ No newline at end of file |
307 | 1 | 3 | ||
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 | 1 | 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 | 0 | \ No newline at end of file | 2 | \ No newline at end of file |
314 | 1 | 3 | ||
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 | 1 | <?xml version='1.0' encoding='utf-8'?> | ||
320 | 2 | <fluidity_options> | ||
321 | 3 | <simulation_name> | ||
322 | 4 | <string_value lines="1">lagrangian_detectors</string_value> | ||
323 | 5 | </simulation_name> | ||
324 | 6 | <problem_type> | ||
325 | 7 | <string_value lines="1">fluids</string_value> | ||
326 | 8 | </problem_type> | ||
327 | 9 | <geometry> | ||
328 | 10 | <dimension> | ||
329 | 11 | <integer_value rank="0">2</integer_value> | ||
330 | 12 | </dimension> | ||
331 | 13 | <mesh name="CoordinateMesh"> | ||
332 | 14 | <from_file file_name="square"> | ||
333 | 15 | <format name="gmsh"/> | ||
334 | 16 | <stat> | ||
335 | 17 | <include_in_stat/> | ||
336 | 18 | </stat> | ||
337 | 19 | </from_file> | ||
338 | 20 | </mesh> | ||
339 | 21 | <mesh name="VelocityMesh"> | ||
340 | 22 | <from_mesh> | ||
341 | 23 | <mesh name="CoordinateMesh"/> | ||
342 | 24 | <mesh_shape> | ||
343 | 25 | <polynomial_degree> | ||
344 | 26 | <integer_value rank="0">1</integer_value> | ||
345 | 27 | </polynomial_degree> | ||
346 | 28 | </mesh_shape> | ||
347 | 29 | <mesh_continuity> | ||
348 | 30 | <string_value>discontinuous</string_value> | ||
349 | 31 | </mesh_continuity> | ||
350 | 32 | <stat> | ||
351 | 33 | <exclude_from_stat/> | ||
352 | 34 | </stat> | ||
353 | 35 | </from_mesh> | ||
354 | 36 | </mesh> | ||
355 | 37 | <quadrature> | ||
356 | 38 | <degree> | ||
357 | 39 | <integer_value rank="0">3</integer_value> | ||
358 | 40 | </degree> | ||
359 | 41 | </quadrature> | ||
360 | 42 | </geometry> | ||
361 | 43 | <io> | ||
362 | 44 | <dump_format> | ||
363 | 45 | <string_value>vtk</string_value> | ||
364 | 46 | </dump_format> | ||
365 | 47 | <dump_period> | ||
366 | 48 | <constant> | ||
367 | 49 | <real_value rank="0">4.0</real_value> | ||
368 | 50 | </constant> | ||
369 | 51 | </dump_period> | ||
370 | 52 | <output_mesh name="VelocityMesh"/> | ||
371 | 53 | <checkpointing> | ||
372 | 54 | <checkpoint_period_in_dumps> | ||
373 | 55 | <integer_value rank="0">1</integer_value> | ||
374 | 56 | </checkpoint_period_in_dumps> | ||
375 | 57 | </checkpointing> | ||
376 | 58 | <stat/> | ||
377 | 59 | <detectors> | ||
378 | 60 | <detector_array name="Steve"> | ||
379 | 61 | <number_of_detectors> | ||
380 | 62 | <integer_value rank="0">100</integer_value> | ||
381 | 63 | </number_of_detectors> | ||
382 | 64 | <lagrangian/> | ||
383 | 65 | <python> | ||
384 | 66 | <string_value lines="20" type="code" language="python">def val(t): | ||
385 | 67 | from numpy import arange,zeros,reshape,concatenate | ||
386 | 68 | x = 0.5+0.25*arange(0,100.)/100. | ||
387 | 69 | y = zeros(100) + 0.5 | ||
388 | 70 | return reshape(concatenate((x,y)),(2,100)).T</string_value> | ||
389 | 71 | </python> | ||
390 | 72 | </detector_array> | ||
391 | 73 | <fail_outside_domain/> | ||
392 | 74 | <lagrangian_timestepping> | ||
393 | 75 | <subcycles> | ||
394 | 76 | <integer_value rank="0">1</integer_value> | ||
395 | 77 | </subcycles> | ||
396 | 78 | <search_tolerance> | ||
397 | 79 | <real_value rank="0">1.0e-10</real_value> | ||
398 | 80 | </search_tolerance> | ||
399 | 81 | <explicit_runge_kutta_guided_search> | ||
400 | 82 | <n_stages> | ||
401 | 83 | <integer_value rank="0">4</integer_value> | ||
402 | 84 | </n_stages> | ||
403 | 85 | <stage_weights> | ||
404 | 86 | <real_value shape="6" rank="1">0.5 0. 0.5 0. 0. 1</real_value> | ||
405 | 87 | </stage_weights> | ||
406 | 88 | <timestep_weights> | ||
407 | 89 | <real_value shape="4" rank="1">0.16666666666666666 0.3333333333333333 | ||
408 | 90 | 0.3333333333333333 0.16666666666666666</real_value> | ||
409 | 91 | </timestep_weights> | ||
410 | 92 | </explicit_runge_kutta_guided_search> | ||
411 | 93 | </lagrangian_timestepping> | ||
412 | 94 | </detectors> | ||
413 | 95 | </io> | ||
414 | 96 | <timestepping> | ||
415 | 97 | <current_time> | ||
416 | 98 | <real_value rank="0">0.0</real_value> | ||
417 | 99 | </current_time> | ||
418 | 100 | <timestep> | ||
419 | 101 | <real_value rank="0">0.1</real_value> | ||
420 | 102 | </timestep> | ||
421 | 103 | <finish_time> | ||
422 | 104 | <real_value rank="0">8</real_value> | ||
423 | 105 | </finish_time> | ||
424 | 106 | </timestepping> | ||
425 | 107 | <physical_parameters> | ||
426 | 108 | <gravity> | ||
427 | 109 | <magnitude> | ||
428 | 110 | <real_value rank="0">1</real_value> | ||
429 | 111 | </magnitude> | ||
430 | 112 | <vector_field name="GravityDirection" rank="1"> | ||
431 | 113 | <prescribed> | ||
432 | 114 | <mesh name="CoordinateMesh"/> | ||
433 | 115 | <value name="WholeMesh"> | ||
434 | 116 | <constant> | ||
435 | 117 | <real_value shape="2" dim1="dim" rank="1">0.0 -1.0</real_value> | ||
436 | 118 | </constant> | ||
437 | 119 | </value> | ||
438 | 120 | <output/> | ||
439 | 121 | <stat> | ||
440 | 122 | <include_in_stat/> | ||
441 | 123 | </stat> | ||
442 | 124 | <detectors> | ||
443 | 125 | <exclude_from_detectors/> | ||
444 | 126 | </detectors> | ||
445 | 127 | </prescribed> | ||
446 | 128 | </vector_field> | ||
447 | 129 | </gravity> | ||
448 | 130 | </physical_parameters> | ||
449 | 131 | <material_phase name="BoussinesqFluid"> | ||
450 | 132 | <vector_field name="Velocity" rank="1"> | ||
451 | 133 | <prescribed> | ||
452 | 134 | <mesh name="VelocityMesh"/> | ||
453 | 135 | <value name="WholeMesh"> | ||
454 | 136 | <python> | ||
455 | 137 | <string_value lines="20" type="code" language="python">def val(X,t): | ||
456 | 138 | x = X[0] | ||
457 | 139 | y = X[1] | ||
458 | 140 | return [-(y-0.5),x-0.5]</string_value> | ||
459 | 141 | </python> | ||
460 | 142 | </value> | ||
461 | 143 | <output/> | ||
462 | 144 | <stat> | ||
463 | 145 | <include_in_stat/> | ||
464 | 146 | </stat> | ||
465 | 147 | <detectors> | ||
466 | 148 | <exclude_from_detectors/> | ||
467 | 149 | </detectors> | ||
468 | 150 | </prescribed> | ||
469 | 151 | </vector_field> | ||
470 | 152 | </material_phase> | ||
471 | 153 | <mesh_adaptivity> | ||
472 | 154 | <hr_adaptivity> | ||
473 | 155 | <period> | ||
474 | 156 | <real_value rank="0">4.</real_value> | ||
475 | 157 | </period> | ||
476 | 158 | <maximum_number_of_nodes> | ||
477 | 159 | <integer_value rank="0">200</integer_value> | ||
478 | 160 | </maximum_number_of_nodes> | ||
479 | 161 | <enable_gradation/> | ||
480 | 162 | <tensor_field name="MinimumEdgeLengths"> | ||
481 | 163 | <anisotropic_symmetric> | ||
482 | 164 | <constant> | ||
483 | 165 | <real_value symmetric="true" dim2="dim" shape="2 2" dim1="dim" rank="2">0.05 0.0 0.0 0.05</real_value> | ||
484 | 166 | </constant> | ||
485 | 167 | </anisotropic_symmetric> | ||
486 | 168 | </tensor_field> | ||
487 | 169 | <tensor_field name="MaximumEdgeLengths"> | ||
488 | 170 | <anisotropic_symmetric> | ||
489 | 171 | <constant> | ||
490 | 172 | <real_value symmetric="true" dim2="dim" shape="2 2" dim1="dim" rank="2">0.06 0.0 0.0 0.06</real_value> | ||
491 | 173 | </constant> | ||
492 | 174 | </anisotropic_symmetric> | ||
493 | 175 | </tensor_field> | ||
494 | 176 | </hr_adaptivity> | ||
495 | 177 | </mesh_adaptivity> | ||
496 | 178 | </fluidity_options> | ||
497 | 0 | 179 | ||
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 | 1 | <?xml version="1.0" encoding="UTF-8" ?> | ||
503 | 2 | |||
504 | 3 | <testproblem> | ||
505 | 4 | <name>lagrangian_detectors_checkpoint</name> | ||
506 | 5 | <owner userid="mlange"/> | ||
507 | 6 | <tags>flml detectors checkpoint</tags> | ||
508 | 7 | <problem_definition length="short" nprocs="4"> | ||
509 | 8 | <command_line> | ||
510 | 9 | ../../bin/fluidity -v2 -l lagrangian_detectors.flml; | ||
511 | 10 | ../../bin/fluidity -v2 -l lagrangian_detectors_1_checkpoint.flml | ||
512 | 11 | </command_line> | ||
513 | 12 | </problem_definition> | ||
514 | 13 | <variables> | ||
515 | 14 | <variable name="last_locations_error" language="python"> | ||
516 | 15 | from fluidity_tools import stat_parser | ||
517 | 16 | from numpy import zeros,fromfile | ||
518 | 17 | |||
519 | 18 | s = stat_parser('lagrangian_detectors_checkpoint.detectors') | ||
520 | 19 | last_locations_error = zeros((2,100)) | ||
521 | 20 | X = fromfile('Xvals.txt',sep=' ') | ||
522 | 21 | Y = fromfile('Yvals.txt',sep=' ') | ||
523 | 22 | for i in range(100): | ||
524 | 23 | name = 'Steve_' + str(i+1).zfill(3) | ||
525 | 24 | last_locations_error[0,i] = s[name]['position'][0][-1] - X[i] | ||
526 | 25 | last_locations_error[1,i] = s[name]['position'][1][-1] - Y[i] | ||
527 | 26 | </variable> | ||
528 | 27 | </variables> | ||
529 | 28 | <pass_tests> | ||
530 | 29 | <test name="CorrectLagrangianTrajectory" language="python"> | ||
531 | 30 | assert abs(last_locations_error).max() < 1.0e-6 | ||
532 | 31 | </test> | ||
533 | 32 | </pass_tests> | ||
534 | 33 | <warn_tests> | ||
535 | 34 | </warn_tests> | ||
536 | 35 | </testproblem> | ||
537 | 0 | 36 | ||
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 | 1 | Point(1) = {0,0,0,0.03}; | ||
543 | 2 | Extrude {1,0,0} { | ||
544 | 3 | Point{1}; | ||
545 | 4 | } | ||
546 | 5 | Extrude {0,1,0} { | ||
547 | 6 | Line{1}; | ||
548 | 7 | } | ||
549 | 8 | Physical Line(8) = {2}; | ||
550 | 9 | Physical Line(9) = {4}; | ||
551 | 10 | Physical Line(10) = {3}; | ||
552 | 11 | Physical Line(11) = {1}; | ||
553 | 12 | Physical Surface(7) = {5}; | ||
554 | 13 |
Buildbot queue is green.