Merge lp:~fluidity-core/fluidity/fieldweightedpartition into lp:fluidity

Proposed by Rhodri Davies
Status: Merged
Merged at revision: 4055
Proposed branch: lp:~fluidity-core/fluidity/fieldweightedpartition
Merge into: lp:fluidity
Diff against target: 877 lines (+664/-13)
15 files modified
assemble/Zoltan_callbacks.F90 (+19/-7)
assemble/Zoltan_global_variables.F90 (+2/-1)
assemble/Zoltan_integration.F90 (+30/-4)
main/Fluids.F90 (+1/-0)
manual/meshes.tex (+7/-1)
preprocessor/Populate_State.F90 (+9/-0)
schemas/adaptivity_options.rnc (+14/-0)
schemas/adaptivity_options.rng (+20/-0)
schemas/flredecomp.rnc (+14/-0)
schemas/flredecomp.rng (+20/-0)
tests/flredecomp_2d_fieldweighted/Makefile (+13/-0)
tests/flredecomp_2d_fieldweighted/check_partitions.py (+28/-0)
tests/flredecomp_2d_fieldweighted/flredecomp-2d-fieldweighted.flml (+410/-0)
tests/flredecomp_2d_fieldweighted/flredecomp_2d_fieldweighted.xml (+25/-0)
tests/flredecomp_2d_fieldweighted/src/Subduction_Mesh.geo (+52/-0)
To merge this branch: bzr merge lp:~fluidity-core/fluidity/fieldweightedpartition
Reviewer Review Type Date Requested Status
Jon Hill Approve
Review via email: mp+123569@code.launchpad.net

Description of the change

This branch includes changes that allow one to weight mesh partitions based upon a user prescribed scalar field. Based upon this information, flredecomp will try to load balance in such a way that the sum of user prescribed weights in each partition is equal.

I have added a test for this new functionality. Results look good.

I have also updated the manual to describe this change.

The buildbot branch is here:
http://buildbot-ocean.ese.ic.ac.uk:8080/builders/cap_fields

Will update when green (hopefully).

As usual, a big fat thank you and man hug to my office hommie skramer!!!

To post a comment you must log in.
4056. By Rhodri Davies

Correct flredecomp path

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

Update: Buildbot is as green as Wales' beautiful valleys!

4057. By Rhodri Davies

Merge trunk change into branch

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

Looks good. Go for it.

review: Approve
4058. By Rhodri Davies

Merge trunk changes into branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'assemble/Zoltan_callbacks.F90'
--- assemble/Zoltan_callbacks.F90 2011-10-18 09:36:51 +0000
+++ assemble/Zoltan_callbacks.F90 2012-09-18 19:42:23 +0000
@@ -64,7 +64,6 @@
64 ierr = ZOLTAN_OK64 ierr = ZOLTAN_OK
65 end function zoltan_cb_owned_node_count65 end function zoltan_cb_owned_node_count
6666
67
68 subroutine zoltan_cb_get_owned_nodes(data, num_gid_entries, num_lid_entries, global_ids, local_ids, wgt_dim, obj_wgts, ierr)67 subroutine zoltan_cb_get_owned_nodes(data, num_gid_entries, num_lid_entries, global_ids, local_ids, wgt_dim, obj_wgts, ierr)
69 integer(zoltan_int), dimension(*), intent(in) :: data ! not used68 integer(zoltan_int), dimension(*), intent(in) :: data ! not used
70 integer(zoltan_int), intent(in) :: num_gid_entries, num_lid_entries 69 integer(zoltan_int), intent(in) :: num_gid_entries, num_lid_entries
@@ -75,7 +74,7 @@
75 integer(zoltan_int), intent(out) :: ierr74 integer(zoltan_int), intent(out) :: ierr
76 75
77 integer :: count, i76 integer :: count, i
78 real(zoltan_float) :: max_obj_wgt77 real(zoltan_float) :: max_obj_wgt, min_obj_wgt
79 78
80 ewrite(1,*) "In zoltan_cb_get_owned_nodes"79 ewrite(1,*) "In zoltan_cb_get_owned_nodes"
81 80
@@ -96,24 +95,38 @@
96 if(zoltan_global_migrate_extruded_mesh) then95 if(zoltan_global_migrate_extruded_mesh) then
97 ! weight the nodes according to the number of nodes in the column beneath it96 ! weight the nodes according to the number of nodes in the column beneath it
98 max_obj_wgt = 1.097 max_obj_wgt = 1.0
99 do i=1,count98 do i = 1, count
100 obj_wgts(i) = float(row_length(zoltan_global_columns_sparsity, i))99 obj_wgts(i) = float(row_length(zoltan_global_columns_sparsity, i))
101 max_obj_wgt = max(max_obj_wgt, obj_wgts(i))100 max_obj_wgt = max(max_obj_wgt, obj_wgts(i))
102 end do101 end do
103 ! normalise according to the most nodes in a column102 ! normalise according to the most nodes in a column
104 do i=1,count103 do i = 1, count
105 obj_wgts(i) = obj_wgts(i)/max_obj_wgt104 obj_wgts(i) = obj_wgts(i)/max_obj_wgt
106 end do105 end do
107 else106 else
108 do i=1,count107 do i = 1, count
109 obj_wgts(i) = 1.0108 obj_wgts(i) = 1.0
110 end do109 end do
111 end if110 end if
111
112 if(zoltan_global_field_weighted_partitions) then
113 max_obj_wgt = 1.0
114 min_obj_wgt = 0.0
115 do i = 1, count
116 obj_wgts(i) = node_val(zoltan_global_field_weighted_partition_values,i)
117 max_obj_wgt = max(max_obj_wgt, obj_wgts(i))
118 min_obj_wgt = min(min_obj_wgt, obj_wgts(i))
119 end do
120
121 if((max_obj_wgt > 1.0) .OR. (min_obj_wgt < 0.0)) then
122 FLExit("0.0 <= FieldWeightedPartitionValues <= 1.0: condition not satisfied")
123 end if
124
125 end if
112 126
113 ierr = ZOLTAN_OK127 ierr = ZOLTAN_OK
114 end subroutine zoltan_cb_get_owned_nodes128 end subroutine zoltan_cb_get_owned_nodes
115129
116
117 subroutine zoltan_cb_get_num_edges(data, num_gid_entries, num_lid_entries, num_obj, global_ids, local_ids, num_edges, ierr) 130 subroutine zoltan_cb_get_num_edges(data, num_gid_entries, num_lid_entries, num_obj, global_ids, local_ids, num_edges, ierr)
118 integer(zoltan_int), dimension(*), intent(in) :: data 131 integer(zoltan_int), dimension(*), intent(in) :: data
119 integer(zoltan_int), intent(in) :: num_gid_entries, num_lid_entries, num_obj132 integer(zoltan_int), intent(in) :: num_gid_entries, num_lid_entries, num_obj
@@ -150,7 +163,6 @@
150 ierr = ZOLTAN_OK163 ierr = ZOLTAN_OK
151 end subroutine zoltan_cb_get_num_edges164 end subroutine zoltan_cb_get_num_edges
152165
153
154 subroutine zoltan_cb_get_edge_list(data, num_gid_entries, num_lid_entries, num_obj, global_ids, local_ids, &166 subroutine zoltan_cb_get_edge_list(data, num_gid_entries, num_lid_entries, num_obj, global_ids, local_ids, &
155 & num_edges, nbor_global_id, nbor_procs, wgt_dim, ewgts, ierr)167 & num_edges, nbor_global_id, nbor_procs, wgt_dim, ewgts, ierr)
156 integer(zoltan_int), intent(in) :: data 168 integer(zoltan_int), intent(in) :: data
157169
=== modified file 'assemble/Zoltan_global_variables.F90'
--- assemble/Zoltan_global_variables.F90 2011-09-26 17:04:31 +0000
+++ assemble/Zoltan_global_variables.F90 2012-09-18 19:42:23 +0000
@@ -34,11 +34,12 @@
34 ! Needed for zoltan_cb_get_owned_nodes34 ! Needed for zoltan_cb_get_owned_nodes
35 type(csr_sparsity), save :: zoltan_global_columns_sparsity35 type(csr_sparsity), save :: zoltan_global_columns_sparsity
36 logical, save :: zoltan_global_migrate_extruded_mesh36 logical, save :: zoltan_global_migrate_extruded_mesh
37 logical, save :: zoltan_global_field_weighted_partitions
38 type(scalar_field), save :: zoltan_global_field_weighted_partition_values
3739
38 ! Needed for zoltan_cb_get_num_edges40 ! Needed for zoltan_cb_get_num_edges
39 type(csr_sparsity), save, pointer :: zoltan_global_zz_sparsity_one41 type(csr_sparsity), save, pointer :: zoltan_global_zz_sparsity_one
4042
41
42 ! Needed for zoltan_cb_get_edge_list43 ! Needed for zoltan_cb_get_edge_list
43 logical, save :: zoltan_global_calculate_edge_weights44 logical, save :: zoltan_global_calculate_edge_weights
44 ! elements with quality greater than this value are ok45 ! elements with quality greater than this value are ok
4546
=== modified file 'assemble/Zoltan_integration.F90'
--- assemble/Zoltan_integration.F90 2011-12-07 11:33:45 +0000
+++ assemble/Zoltan_integration.F90 2012-09-18 19:42:23 +0000
@@ -136,12 +136,20 @@
136 zoltan_global_migrate_extruded_mesh = option_count('/geometry/mesh/from_mesh/extrude') > 0 &136 zoltan_global_migrate_extruded_mesh = option_count('/geometry/mesh/from_mesh/extrude') > 0 &
137 .and. .not. present_and_true(ignore_extrusion)137 .and. .not. present_and_true(ignore_extrusion)
138138
139 zoltan_global_field_weighted_partitions = &
140 have_option(trim(zoltan_global_base_option_path) // "/field_weighted_partitions")
141
142 if(zoltan_global_migrate_extruded_mesh .AND. zoltan_global_field_weighted_partitions) then
143 ewrite(-1,*) "Cannot weight mesh partitions based upon extruded columns"// &
144 "and a prescribed field. Select one option only or fix the code."
145 FLExit("Use Weighted mesh partitions for EITHER extruded meshes or prescribed fields")
146 end if
147
139 call setup_module_variables(states, final_adapt_iteration, zz)148 call setup_module_variables(states, final_adapt_iteration, zz)
140 149
141 call setup_quality_module_variables(states, metric) ! this needs to be called after setup_module_variables150 call setup_quality_module_variables(states, metric) ! this needs to be called after setup_module_variables
142 ! (but only on the 2d mesh with 2+1d adaptivity)151 ! (but only on the 2d mesh with 2+1d adaptivity)
143152
144
145 load_imbalance_tolerance = get_load_imbalance_tolerance(final_adapt_iteration)153 load_imbalance_tolerance = get_load_imbalance_tolerance(final_adapt_iteration)
146 call set_zoltan_parameters(final_adapt_iteration, flredecomp, flredecomp_target_procs, load_imbalance_tolerance, zz)154 call set_zoltan_parameters(final_adapt_iteration, flredecomp, flredecomp_target_procs, load_imbalance_tolerance, zz)
147155
@@ -424,7 +432,22 @@
424 call insert(zoltan_global_universal_element_number_to_region_id, universal_element_number, zoltan_global_zz_positions%mesh%region_ids(i))432 call insert(zoltan_global_universal_element_number_to_region_id, universal_element_number, zoltan_global_zz_positions%mesh%region_ids(i))
425 end do433 end do
426 end if434 end if
427 435
436 if(zoltan_global_field_weighted_partitions) then
437 zoltan_global_field_weighted_partition_values = extract_scalar_field(states, "FieldWeightedPartitionValues")
438 assert(zoltan_global_field_weighted_partition_values%mesh == zoltan_global_zz_mesh)
439
440 if(zoltan_global_field_weighted_partition_values%mesh%name /= zoltan_global_zz_mesh%name) then
441 ewrite(-1,*) "FieldWeightedPartitionValues and Zoltan Global ZZ Mesh must be on the " // &
442 "same mesh. 99.9% of the time, this means that FieldWeightedPartitionValues " // &
443 "must be on the external mesh."
444 FLExit("FieldWeightedPartitionValues must be on the external mesh")
445 end if
446
447 call incref(zoltan_global_field_weighted_partition_values)
448
449 end if
450
428 end subroutine setup_module_variables451 end subroutine setup_module_variables
429452
430 subroutine setup_quality_module_variables(states, metric)453 subroutine setup_quality_module_variables(states, metric)
@@ -724,6 +747,10 @@
724 if(zoltan_global_migrate_extruded_mesh) then747 if(zoltan_global_migrate_extruded_mesh) then
725 call deallocate(zoltan_global_columns_sparsity)748 call deallocate(zoltan_global_columns_sparsity)
726 end if749 end if
750 if(zoltan_global_field_weighted_partitions) then
751 call deallocate(zoltan_global_field_weighted_partition_values)
752 end if
753
727 end subroutine cleanup_quality_module_variables754 end subroutine cleanup_quality_module_variables
728755
729 subroutine cleanup_other_module_variables756 subroutine cleanup_other_module_variables
@@ -1787,7 +1814,6 @@
1787 1814
1788 end subroutine initialise_transfer1815 end subroutine initialise_transfer
17891816
1790
1791 subroutine update_detector_list_element(detector_list_array)1817 subroutine update_detector_list_element(detector_list_array)
1792 ! Update the detector%element field for every detector left in our list1818 ! Update the detector%element field for every detector left in our list
1793 ! and check that we did not miss any in the first send1819 ! and check that we did not miss any in the first send
17941820
=== modified file 'main/Fluids.F90'
--- main/Fluids.F90 2012-09-05 08:44:55 +0000
+++ main/Fluids.F90 2012-09-18 19:42:23 +0000
@@ -893,6 +893,7 @@
893 end if893 end if
894894
895 end do timestep_loop895 end do timestep_loop
896
896 ! ****************************897 ! ****************************
897 ! *** END OF TIMESTEP LOOP ***898 ! *** END OF TIMESTEP LOOP ***
898 ! ****************************899 ! ****************************
899900
=== modified file 'manual/meshes.tex'
--- manual/meshes.tex 2011-11-07 12:52:36 +0000
+++ manual/meshes.tex 2012-09-18 19:42:23 +0000
@@ -238,7 +238,13 @@
238The output of running flredecomp is a series of mesh and vtu files as well238The output of running flredecomp is a series of mesh and vtu files as well
239as the new flml; in this case \lstinline+foo_flredecomp.flml+. 239as the new flml; in this case \lstinline+foo_flredecomp.flml+.
240Note that \lstinline[language=bash]+flredecomp+ must be run on a number of processors equal to the larger number of processors between input and output.240Note that \lstinline[language=bash]+flredecomp+ must be run on a number of processors equal to the larger number of processors between input and output.
241More information can be found in section~\ref{sec:flredecomp}.241
242When using flredecomp, it is possible to partition the mesh based upon a user defined weighting.
243This is achieved by prescribing a scalar field, bounded between values of 0 and 1, under
244\option{/flredecomp/field\_weighted\_partitions}. Flredecomp will then try to ensure that the sum
245of weights on each partition is approximately equal.
246
247Further information on flredecomp can be found in section~\ref{sec:flredecomp}.
242248
243\subsection{Decomposing a periodic mesh}249\subsection{Decomposing a periodic mesh}
244\index{mesh!meshing tools!periodise}250\index{mesh!meshing tools!periodise}
245251
=== modified file 'preprocessor/Populate_State.F90'
--- preprocessor/Populate_State.F90 2012-09-03 11:38:44 +0000
+++ preprocessor/Populate_State.F90 2012-09-18 19:42:23 +0000
@@ -1211,6 +1211,15 @@
1211 states(1), dont_allocate_prognostic_value_spaces=dont_allocate_prognostic_value_spaces)1211 states(1), dont_allocate_prognostic_value_spaces=dont_allocate_prognostic_value_spaces)
1212 end if1212 end if
12131213
1214 ! Field that controls the weighting of partitions:
1215 if (have_option('/flredecomp/field_weighted_partitions')) then
1216 call allocate_and_insert_scalar_field('/flredecomp/field_weighted_partitions/scalar_field::FieldWeightedPartitionValues', states(1))
1217 end if
1218
1219 if (have_option('/mesh_adaptivity/hr_adaptivity/zoltan_options/field_weighted_partitions')) then
1220 call allocate_and_insert_scalar_field('/mesh_adaptivity/hr_adaptivity/zoltan_options/field_weighted_partitions/scalar_field::FieldWeightedPartitionValues', states(1))
1221 end if
1222
1214 ! grid velocity1223 ! grid velocity
1215 if (have_option('/mesh_adaptivity/mesh_movement/vector_field::GridVelocity')) then1224 if (have_option('/mesh_adaptivity/mesh_movement/vector_field::GridVelocity')) then
1216 call allocate_and_insert_vector_field('/mesh_adaptivity/mesh_movement/vector_field::GridVelocity', &1225 call allocate_and_insert_vector_field('/mesh_adaptivity/mesh_movement/vector_field::GridVelocity', &
12171226
=== modified file 'schemas/adaptivity_options.rnc'
--- schemas/adaptivity_options.rnc 2012-03-21 10:13:54 +0000
+++ schemas/adaptivity_options.rnc 2012-09-18 19:42:23 +0000
@@ -974,6 +974,20 @@
974 element additional_adapt_iterations {974 element additional_adapt_iterations {
975 integer975 integer
976 }?,976 }?,
977 element field_weighted_partitions {
978 ## Field weighted partitions: turning on this option allows one to
979 ## weight mesh partitions, based upon a prescribed scalar field.
980 ## Note that the field should have a minimum value of 0 and a maximum
981 ## value of 1 (no normalisation is done within the code).
982 element scalar_field {
983 attribute rank { "0" },
984 attribute name { "FieldWeightedPartitionValues" },
985 element prescribed {
986 coordinate_mesh_choice,
987 prescribed_scalar_field
988 }
989 }
990 }?,
977 ## Zoltan Debugging991 ## Zoltan Debugging
978 ## 992 ##
979 ## Turn on more verbose output for use when debugging Zoltan.993 ## Turn on more verbose output for use when debugging Zoltan.
980994
=== modified file 'schemas/adaptivity_options.rng'
--- schemas/adaptivity_options.rng 2012-03-21 10:13:54 +0000
+++ schemas/adaptivity_options.rng 2012-09-18 19:42:23 +0000
@@ -1143,6 +1143,26 @@
1143 </element>1143 </element>
1144 </optional>1144 </optional>
1145 <optional>1145 <optional>
1146 <element name="field_weighted_partitions">
1147 <element name="scalar_field">
1148 <a:documentation>Field weighted partitions: turning on this option allows one to
1149weight mesh partitions, based upon a prescribed scalar field.
1150Note that the field should have a minimum value of 0 and a maximum
1151value of 1 (no normalisation is done within the code).</a:documentation>
1152 <attribute name="rank">
1153 <value>0</value>
1154 </attribute>
1155 <attribute name="name">
1156 <value>FieldWeightedPartitionValues</value>
1157 </attribute>
1158 <element name="prescribed">
1159 <ref name="coordinate_mesh_choice"/>
1160 <ref name="prescribed_scalar_field"/>
1161 </element>
1162 </element>
1163 </element>
1164 </optional>
1165 <optional>
1146 <element name="zoltan_debug">1166 <element name="zoltan_debug">
1147 <a:documentation>Zoltan Debugging1167 <a:documentation>Zoltan Debugging
11481168
11491169
=== modified file 'schemas/flredecomp.rnc'
--- schemas/flredecomp.rnc 2011-09-12 11:17:09 +0000
+++ schemas/flredecomp.rnc 2012-09-18 19:42:23 +0000
@@ -30,6 +30,20 @@
30 }30 }
31 }31 }
32 }?,32 }?,
33 element field_weighted_partitions {
34 ## Field weighted partitions: turning on this option allows one to
35 ## weight mesh partitions, based upon a prescribed scalar field.
36 ## Note that the field should have a minimum value of 0 and a maximum
37 ## value of 1 (no normalisation is done within the code).
38 element scalar_field {
39 attribute rank { "0" },
40 attribute name { "FieldWeightedPartitionValues" },
41 element prescribed {
42 coordinate_mesh_choice,
43 prescribed_scalar_field
44 }
45 }
46 }?,
33 ## Zoltan Debugging47 ## Zoltan Debugging
34 ## 48 ##
35 ## Turn on more verbose output for use when debugging Zoltan.49 ## Turn on more verbose output for use when debugging Zoltan.
3650
=== modified file 'schemas/flredecomp.rng'
--- schemas/flredecomp.rng 2011-09-12 11:17:09 +0000
+++ schemas/flredecomp.rng 2012-09-18 19:42:23 +0000
@@ -38,6 +38,26 @@
38 </element>38 </element>
39 </optional>39 </optional>
40 <optional>40 <optional>
41 <element name="field_weighted_partitions">
42 <element name="scalar_field">
43 <a:documentation>Field weighted partitions: turning on this option allows one to
44weight mesh partitions, based upon a prescribed scalar field.
45Note that the field should have a minimum value of 0 and a maximum
46value of 1 (no normalisation is done within the code).</a:documentation>
47 <attribute name="rank">
48 <value>0</value>
49 </attribute>
50 <attribute name="name">
51 <value>FieldWeightedPartitionValues</value>
52 </attribute>
53 <element name="prescribed">
54 <ref name="coordinate_mesh_choice"/>
55 <ref name="prescribed_scalar_field"/>
56 </element>
57 </element>
58 </element>
59 </optional>
60 <optional>
41 <element name="zoltan_debug">61 <element name="zoltan_debug">
42 <a:documentation>Zoltan Debugging62 <a:documentation>Zoltan Debugging
4363
4464
=== added directory 'tests/flredecomp_2d_fieldweighted'
=== added file 'tests/flredecomp_2d_fieldweighted/Makefile'
--- tests/flredecomp_2d_fieldweighted/Makefile 1970-01-01 00:00:00 +0000
+++ tests/flredecomp_2d_fieldweighted/Makefile 2012-09-18 19:42:23 +0000
@@ -0,0 +1,13 @@
1MODEL=flredecomp-2d-fieldweighted
2
3default: input
4
5input: clean
6 gmsh -2 -optimize src/Subduction_Mesh.geo
7 cp src/Subduction_Mesh.msh .
8 ../../bin/gmsh2triangle --2d -i Subduction_Mesh.msh
9
10clean:
11 rm -f *.ele *.edge *.node *.vtu *.stat *.msh *.detectors fluidity.* Parallel*
12 rm -R -f $(MODEL)_*
13
014
=== added file 'tests/flredecomp_2d_fieldweighted/check_partitions.py'
--- tests/flredecomp_2d_fieldweighted/check_partitions.py 1970-01-01 00:00:00 +0000
+++ tests/flredecomp_2d_fieldweighted/check_partitions.py 2012-09-18 19:42:23 +0000
@@ -0,0 +1,28 @@
1#! /usr/bin/env python
2
3import sys
4import numpy
5
6num_partitions = 16
7
8def calculate_partition_weights():
9 partition_weights = numpy.zeros(num_partitions,dtype=float)
10
11 for i in range(num_partitions):
12 filename = 'Parallel-NP16-flredecomp-2d-fieldweighted_CoordinateMesh_%d.ele'%i
13 elements = numpy.loadtxt(filename, skiprows=1)
14 # Sum weights across each partition.
15 # Note prognostic region ID == 27: weighting (in .flml) == 1.0
16 # Prescribed regions ID == 24, 30: weighting (in .flml) == 0.01
17 for j in range(elements.shape[0]):
18 if(elements[j,4] == 27):
19 partition_weights[i] = partition_weights[i] + 1.0
20 else:
21 partition_weights[i] = partition_weights[i] + 0.005
22
23 min_weight = min(partition_weights)
24 max_weight = max(partition_weights)
25 max_load_imbalance = max_weight / min_weight
26
27 return max_load_imbalance
28
029
=== added file 'tests/flredecomp_2d_fieldweighted/flredecomp-2d-fieldweighted.flml'
--- tests/flredecomp_2d_fieldweighted/flredecomp-2d-fieldweighted.flml 1970-01-01 00:00:00 +0000
+++ tests/flredecomp_2d_fieldweighted/flredecomp-2d-fieldweighted.flml 2012-09-18 19:42:23 +0000
@@ -0,0 +1,410 @@
1<?xml version='1.0' encoding='utf-8'?>
2<fluidity_options>
3 <simulation_name>
4 <string_value lines="1">flredecomp_field_weighted_partition_test</string_value>
5 <comment>Checks for field_weighted_partitions in flredecomp and gmsh2triangle -i. </comment>
6 </simulation_name>
7 <problem_type>
8 <string_value lines="1">stokes</string_value>
9 </problem_type>
10 <geometry>
11 <dimension>
12 <integer_value rank="0">2</integer_value>
13 </dimension>
14 <mesh name="CoordinateMesh">
15 <from_file file_name="Subduction_Mesh">
16 <format name="triangle"/>
17 <stat>
18 <include_in_stat/>
19 </stat>
20 </from_file>
21 </mesh>
22 <mesh name="VelocityMesh">
23 <from_mesh>
24 <mesh name="CoordinateMesh"/>
25 <mesh_shape>
26 <polynomial_degree>
27 <integer_value rank="0">2</integer_value>
28 </polynomial_degree>
29 </mesh_shape>
30 <stat>
31 <exclude_from_stat/>
32 </stat>
33 </from_mesh>
34 </mesh>
35 <quadrature>
36 <degree>
37 <integer_value rank="0">5</integer_value>
38 </degree>
39 </quadrature>
40 </geometry>
41 <io>
42 <dump_format>
43 <string_value>vtk</string_value>
44 </dump_format>
45 <dump_period>
46 <constant>
47 <real_value rank="0">2e12</real_value>
48 </constant>
49 </dump_period>
50 <output_mesh name="CoordinateMesh"/>
51 <stat>
52 <output_at_start/>
53 </stat>
54 <detectors>
55 <static_detector name="Temperature6060">
56 <location>
57 <real_value shape="2" dim1="dim" rank="1">60000. -60000.</real_value>
58 </location>
59 </static_detector>
60 <detector_array name="TSlab">
61 <number_of_detectors>
62 <integer_value rank="0">36</integer_value>
63 </number_of_detectors>
64 <static/>
65 <python>
66 <string_value lines="20" type="code" language="python">def val(t):
67 import numpy
68 start = numpy.array([0, 0])
69 end = numpy.array([210000, -210000])
70 output = []
71 for i in range(36):
72 output.append(start + (float(i)/35) * end)
73 return output</string_value>
74 </python>
75 </detector_array>
76 <detector_array name="TWedge">
77 <number_of_detectors>
78 <integer_value rank="0">78</integer_value>
79 </number_of_detectors>
80 <static/>
81 <python>
82 <string_value lines="20" type="code" language="python">def val(t):
83 output1 = []
84 for i in range(12):
85 for j in range(12):
86 if i &gt;= j:
87 output1.append([54000 + (float(i)/20) * 120000, -54000 + (float(j)/20) * (-120000)])
88 return output1</string_value>
89 </python>
90 </detector_array>
91 <fail_outside_domain/>
92 </detectors>
93 </io>
94 <timestepping>
95 <current_time>
96 <real_value rank="0">0.0</real_value>
97 </current_time>
98 <timestep>
99 <real_value rank="0">1e11</real_value>
100 </timestep>
101 <finish_time>
102 <real_value rank="0">1.0e15</real_value>
103 </finish_time>
104 <adaptive_timestep>
105 <requested_cfl>
106 <real_value rank="0">3.0</real_value>
107 </requested_cfl>
108 <courant_number name="CFLNumber">
109 <mesh name="CoordinateMesh"/>
110 </courant_number>
111 <increase_tolerance>
112 <real_value rank="0">5</real_value>
113 </increase_tolerance>
114 </adaptive_timestep>
115 <steady_state>
116 <tolerance>
117 <real_value rank="0">1e-3</real_value>
118 <infinity_norm/>
119 </tolerance>
120 </steady_state>
121 </timestepping>
122 <material_phase name="Fluid">
123 <scalar_field name="Pressure" rank="0">
124 <prognostic>
125 <mesh name="CoordinateMesh"/>
126 <spatial_discretisation>
127 <continuous_galerkin>
128 <remove_stabilisation_term/>
129 </continuous_galerkin>
130 </spatial_discretisation>
131 <scheme>
132 <poisson_pressure_solution>
133 <string_value lines="1">never</string_value>
134 </poisson_pressure_solution>
135 <use_projection_method>
136 <full_schur_complement>
137 <inner_matrix name="FullMomentumMatrix">
138 <solver>
139 <iterative_method name="preonly"/>
140 <preconditioner name="lu"/>
141 <relative_error>
142 <real_value rank="0">1.0e-6</real_value>
143 </relative_error>
144 <max_iterations>
145 <integer_value rank="0">10000</integer_value>
146 </max_iterations>
147 <start_from_zero/>
148 <never_ignore_solver_failures/>
149 <diagnostics>
150 <monitors/>
151 </diagnostics>
152 </solver>
153 </inner_matrix>
154 <preconditioner_matrix name="DiagonalSchurComplement"/>
155 </full_schur_complement>
156 </use_projection_method>
157 </scheme>
158 <solver>
159 <iterative_method name="fgmres"/>
160 <preconditioner name="jacobi"/>
161 <relative_error>
162 <real_value rank="0">1.0e-4</real_value>
163 </relative_error>
164 <max_iterations>
165 <integer_value rank="0">10000</integer_value>
166 </max_iterations>
167 <never_ignore_solver_failures/>
168 <diagnostics>
169 <monitors/>
170 </diagnostics>
171 </solver>
172 <output/>
173 <stat/>
174 <convergence>
175 <include_in_convergence/>
176 </convergence>
177 <detectors>
178 <exclude_from_detectors/>
179 </detectors>
180 <steady_state>
181 <exclude_from_steady_state/>
182 </steady_state>
183 <consistent_interpolation/>
184 </prognostic>
185 </scalar_field>
186 <vector_field name="Velocity" rank="1">
187 <prognostic>
188 <mesh name="VelocityMesh"/>
189 <equation name="LinearMomentum"/>
190 <spatial_discretisation>
191 <continuous_galerkin>
192 <stabilisation>
193 <no_stabilisation/>
194 </stabilisation>
195 <mass_terms>
196 <exclude_mass_terms/>
197 </mass_terms>
198 <advection_terms>
199 <exclude_advection_terms/>
200 </advection_terms>
201 <stress_terms>
202 <tensor_form/>
203 </stress_terms>
204 </continuous_galerkin>
205 <conservative_advection>
206 <real_value rank="0">1.0</real_value>
207 </conservative_advection>
208 </spatial_discretisation>
209 <temporal_discretisation>
210 <theta>
211 <real_value rank="0">1.0</real_value>
212 </theta>
213 <relaxation>
214 <real_value rank="0">1.0</real_value>
215 </relaxation>
216 </temporal_discretisation>
217 <solver>
218 <iterative_method name="preonly"/>
219 <preconditioner name="lu"/>
220 <relative_error>
221 <real_value rank="0">1.0e-6</real_value>
222 </relative_error>
223 <max_iterations>
224 <integer_value rank="0">10000</integer_value>
225 </max_iterations>
226 <never_ignore_solver_failures/>
227 <diagnostics>
228 <monitors/>
229 </diagnostics>
230 </solver>
231 <initial_condition name="Batchelor">
232 <region_ids>
233 <integer_value shape="1" rank="1">27</integer_value>
234 </region_ids>
235 <python>
236 <string_value lines="20" type="code" language="python">def val(X, t):
237
238 from math import sqrt, atan, cos, sin, pi
239
240 Xcoord = X[0]
241 Ycoord = X[1]
242
243 Depth = (X[1] * -1.) -50000.
244 Xdist = X[0] -50000.
245
246 if(Xdist == 0.) :
247 Xdist = 0.000000000000001
248
249 if Depth == 0 :
250
251 Vx = 0.
252 Vy = 0.
253
254 else :
255
256 ALFA = atan(1)
257 THETA = atan(Depth/Xdist)
258
259 VTHETA = (((ALFA - THETA) * sin(THETA) * sin(ALFA)) - (ALFA * THETA * sin(ALFA-THETA))) / (ALFA**2 - (sin(ALFA)**2))
260 VTHETA = VTHETA * (0.05/(3600.*24.*365.)) *-1.
261
262 VR = (((ALFA - THETA) * cos(THETA) * sin(ALFA)) - (sin(ALFA) * sin(THETA)) - (ALFA * sin(ALFA-THETA)) + (ALFA*THETA*cos(ALFA-THETA))) / ((ALFA**2) - (sin(ALFA))**2)
263 VR = VR * (0.05/(3600.*24.*365.))
264
265 Vx = -( VTHETA*sin(THETA) - VR*cos(THETA) )
266 Vy = - (VTHETA*cos(THETA) + VR*sin(THETA) )
267
268 return [Vx, Vy]</string_value>
269 </python>
270 </initial_condition>
271 <prescribed_region name="Crust">
272 <region_ids>
273 <integer_value shape="1" rank="1">24</integer_value>
274 </region_ids>
275 <constant>
276 <real_value shape="2" dim1="dim" rank="1">0. 0.</real_value>
277 </constant>
278 </prescribed_region>
279 <prescribed_region name="Slab">
280 <region_ids>
281 <integer_value shape="1" rank="1">30</integer_value>
282 </region_ids>
283 <python>
284 <string_value lines="20" type="code" language="python">def val(X, t):
285 from math import sqrt
286 vx = sqrt(((0.05/(3600.*24.*365.))**2.)/2.)
287 vy = -sqrt(((0.05/(3600.*24.*365.))**2.)/2.)
288 return [vx,vy]</string_value>
289 </python>
290 </prescribed_region>
291 <boundary_conditions name="Crust">
292 <surface_ids>
293 <integer_value shape="1" rank="1">32</integer_value>
294 </surface_ids>
295 <type name="dirichlet">
296 <align_bc_with_cartesian>
297 <x_component>
298 <constant>
299 <real_value rank="0">0.0</real_value>
300 </constant>
301 </x_component>
302 <y_component>
303 <constant>
304 <real_value rank="0">0.0</real_value>
305 </constant>
306 </y_component>
307 </align_bc_with_cartesian>
308 </type>
309 </boundary_conditions>
310 <boundary_conditions name="Slab">
311 <surface_ids>
312 <integer_value shape="1" rank="1">31</integer_value>
313 </surface_ids>
314 <type name="dirichlet">
315 <align_bc_with_cartesian>
316 <x_component>
317 <python>
318 <string_value lines="20" type="code" language="python">def val(X, t):
319 from math import sqrt
320 vx = sqrt(((0.05/(3600.*24.*365.))**2.)/2.)
321 return vx</string_value>
322 </python>
323 </x_component>
324 <y_component>
325 <python>
326 <string_value lines="20" type="code" language="python">def val(X, t):
327 from math import sqrt
328 vy = -sqrt(((0.05/(3600.*24.*365.))**2.)/2.)
329 return vy</string_value>
330 </python>
331 </y_component>
332 </align_bc_with_cartesian>
333 </type>
334 </boundary_conditions>
335 <tensor_field name="Viscosity" rank="2">
336 <prescribed>
337 <value name="WholeMesh">
338 <isotropic>
339 <constant>
340 <real_value rank="0">1.0e21</real_value>
341 </constant>
342 </isotropic>
343 </value>
344 <output/>
345 </prescribed>
346 </tensor_field>
347 <output/>
348 <stat>
349 <include_in_stat/>
350 <surface_integral type="normal" name="Outflow">
351 <surface_ids>
352 <integer_value shape="2" rank="1">13 16</integer_value>
353 </surface_ids>
354 </surface_integral>
355 <surface_integral type="normal" name="All">
356 <surface_ids>
357 <integer_value shape="3" rank="1">12 13 16</integer_value>
358 </surface_ids>
359 </surface_integral>
360 <previous_time_step>
361 <exclude_from_stat/>
362 </previous_time_step>
363 <nonlinear_field>
364 <exclude_from_stat/>
365 </nonlinear_field>
366 </stat>
367 <convergence>
368 <include_in_convergence/>
369 </convergence>
370 <detectors>
371 <include_in_detectors/>
372 </detectors>
373 <steady_state>
374 <include_in_steady_state/>
375 </steady_state>
376 <consistent_interpolation/>
377 </prognostic>
378 </vector_field>
379 </material_phase>
380 <flredecomp>
381 <field_weighted_partitions>
382 <scalar_field name="FieldWeightedPartitionValues" rank="0">
383 <prescribed>
384 <mesh name="CoordinateMesh"/>
385 <value name="Prognostic_Regions">
386 <region_ids>
387 <integer_value shape="1" rank="1">27</integer_value>
388 </region_ids>
389 <constant>
390 <real_value rank="0">1.</real_value>
391 </constant>
392 </value>
393 <value name="Prescribed_Regions">
394 <region_ids>
395 <integer_value shape="2" rank="1">24 30</integer_value>
396 </region_ids>
397 <constant>
398 <real_value rank="0">0.005</real_value>
399 </constant>
400 </value>
401 <output/>
402 <stat/>
403 <detectors>
404 <exclude_from_detectors/>
405 </detectors>
406 </prescribed>
407 </scalar_field>
408 </field_weighted_partitions>
409 </flredecomp>
410</fluidity_options>
0411
=== added file 'tests/flredecomp_2d_fieldweighted/flredecomp_2d_fieldweighted.xml'
--- tests/flredecomp_2d_fieldweighted/flredecomp_2d_fieldweighted.xml 1970-01-01 00:00:00 +0000
+++ tests/flredecomp_2d_fieldweighted/flredecomp_2d_fieldweighted.xml 2012-09-18 19:42:23 +0000
@@ -0,0 +1,25 @@
1<?xml version='1.0' encoding='utf-8'?>
2<testproblem>
3 <name>flredecomp-2d-fieldweighted</name>
4 <owner userid="rhodrid"/>
5 <tags>flml</tags>
6
7 <problem_definition length="medium" nprocs="1">
8 <command_line>mpiexec -n 16 flredecomp -i 1 -o 16 flredecomp-2d-fieldweighted Parallel-NP16-flredecomp-2d-fieldweighted</command_line>
9 </problem_definition>
10
11 <variables>
12 <variable name="max_load_imbalance" language="python">
13from check_partitions import *
14max_load_imbalance = calculate_partition_weights()
15 <comment>Calculates the weight of each partition (i.e. sums weights of elements in each partition). The weights are prescribed in the flml to be 1.0 for region 27, and 0.005 elsewhere.</comment>
16 </variable>
17 </variables>
18
19 <pass_tests>
20 <test name="maximum load imbalance .lt. 1.5 " language="python">
21 assert ( max_load_imbalance &lt; 1.5 )
22 </test>
23 </pass_tests>
24
25</testproblem>
026
=== added directory 'tests/flredecomp_2d_fieldweighted/src'
=== added file 'tests/flredecomp_2d_fieldweighted/src/Subduction_Mesh.geo'
--- tests/flredecomp_2d_fieldweighted/src/Subduction_Mesh.geo 1970-01-01 00:00:00 +0000
+++ tests/flredecomp_2d_fieldweighted/src/Subduction_Mesh.geo 2012-09-18 19:42:23 +0000
@@ -0,0 +1,52 @@
1// Gmsh project created on Fri Dec 4 14:59:47 2009
2// We reproduce a subduction zone on a (660x600) km domain.
3// The kinematically moving slab (see image, on the left) subducts under a 50km-thick plate (up, right) and hence dynamically inducing a flow in the upper-mantle wedge (down, on the right).
4// We therefore are trying to match the benchmark results established by vanKeken2008 for this problem, computing the thermal field throughout the domain by use of finite element methods.
5// The structured, non-adaptive mesh shown in the images contains for instance the sought information at the mesh nodes, spaced out 2.5 km from each other near the critical point of contact between the three// different regions of our domain, and 7.5km everywhere else. In this particular case, the test uses a prescribed wedge flow (Batchelor1967) and is mainly intended to check for the validity of initial condi// tions at the various boundaries.
6
7minsize=4000;
8maxsize=4000;
9
10Point(1) = {0,0,0,minsize};
11Point(2) = {660000,0,0,maxsize};
12Point(3) = {660000,-50000,0,maxsize};
13Point(4) = {660000,-600000,0,maxsize};
14Point(5) = {600000,-600000,0,maxsize};
15Point(6) = {0,-600000,0,maxsize};
16Point(7) = {50000,-50000,0,minsize};
17Point(8) = {660000,-420000,0,maxsize};
18
19Line(1) = {1,2};
20Line(2) = {2,3};
21Line(3) = {3,8};
22Line(4) = {4,5};
23Line(5) = {5,6};
24Line(7) = {1,7};
25Line(9) = {7,3};
26Line(10) = {8,4};
27Line(11) = {7,5};
28Line(14) = {6,1};
29
30Physical Line(10) = {1};
31Physical Line(11) = {2};
32Physical Line(12) = {3};
33Physical Line(13) = {4};
34Physical Line(19) = {5};
35Physical Line(15) = {14};
36Physical Line(16) = {10};
37// Physical Line(17) = {9};
38// Physical Line(18) = {11};
39// Physical Line(20) = {7};
40
41Line Loop(22) = {1,2,-9,-7};
42Plane Surface(23) = {22};
43Physical Surface(24) = {23};
44Line Loop(25) = {9,3,10,4,-11};
45Plane Surface(26) = {25};
46Physical Surface(27) = {26};
47Line Loop(28) = {5,14,7,11};
48Plane Surface(29) = {28};
49Physical Surface(30) = {29};
50
51Physical Line(31) = {11};
52Physical Line(32) = {9};