~fluidity-core/fluidity/sea-ice-branch

« back to all changes in this revision

Viewing changes to tests/mms_rans_p2p1_keps/mms_rans_p2p1_keps.xml

  • Committer: Simon Mouradian
  • Date: 2012-10-19 10:35:59 UTC
  • mfrom: (3520.32.371 fluidity)
  • Revision ID: simon.mouradian06@imperial.ac.uk-20121019103559-y36qa47phc69q8sc
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8" ?>
 
2
<!DOCTYPE testproblem SYSTEM "regressiontest.dtd">
 
3
<testproblem>
 
4
  <name>p2lumpedp1 RANS k-epsilon spatial convergence test with strong bcs</name>
 
5
  <owner userid="sparkinson"/>
 
6
  <tags>flml</tags>
 
7
  <problem_definition length="medium" nprocs="1">
 
8
    <command_line>fluidity -v3 MMS_A.flml &gt; MMS_A.log; fluidity -v3 MMS_B.flml &gt; MMS_B.log; fluidity -v3 MMS_C.flml &gt; MMS_C.log; fluidity -v3 MMS_D.flml &gt; MMS_D.log</command_line>
 
9
  </problem_definition>
 
10
  <variables>
 
11
    <variable name="convergence" language="python">
 
12
from fluidity_tools import stat_parser as stat
 
13
from math import log
 
14
import numpy as np
 
15
 
 
16
meshes = [['A','B'], ['B','C'], ['C','D']]
 
17
 
 
18
convergence = np.ones(12) * 1e10
 
19
 
 
20
print ''
 
21
print 'ORDER OF CONVERGENCE'
 
22
print '-------------------------------------------'
 
23
 
 
24
print 'VelocityError:'
 
25
print '-------------------------------------------'
 
26
 
 
27
for i, mesh in enumerate(meshes):
 
28
 
 
29
    a_error_x = stat("MMS_"+str(mesh[0])+".stat")["NS"]["VelocityError%1"]["l2norm"][-1]
 
30
    b_error_x = stat("MMS_"+str(mesh[1])+".stat")["NS"]["VelocityError%1"]["l2norm"][-1]
 
31
    a_error_y = stat("MMS_"+str(mesh[0])+".stat")["NS"]["VelocityError%2"]["l2norm"][-1]
 
32
    b_error_y = stat("MMS_"+str(mesh[1])+".stat")["NS"]["VelocityError%2"]["l2norm"][-1]
 
33
 
 
34
    ratio_x = a_error_x / b_error_x
 
35
    ratio_y = a_error_y / b_error_y
 
36
 
 
37
    print mesh[0] + '->' + mesh[1] + ': ', [log(ratio_x, 2), log(ratio_y, 2)]
 
38
 
 
39
    convergence[0] = min(log(ratio_x, 2), log(ratio_y, 2), convergence[0])
 
40
 
 
41
print '-------------------------------------------'
 
42
 
 
43
fields = ['TurbulentKineticEnergy_production_termError', 
 
44
          'TurbulentKineticEnergy_destruction_termError',
 
45
          'TurbulentKineticEnergy_buoyancy_termError',
 
46
          'TurbulentKineticEnergyError',
 
47
          'TurbulentDissipation_production_termError',
 
48
          'TurbulentDissipation_destruction_termError',
 
49
          'TurbulentDissipation_buoyancy_termError',
 
50
          'TurbulentDissipationError',
 
51
          'ScalarEddyViscosityError',
 
52
          'TemperatureError', 
 
53
          'PressureError',
 
54
          ]
 
55
 
 
56
for i, field in enumerate(fields):
 
57
    print field
 
58
    print '-------------------------------------------'
 
59
 
 
60
    for j, mesh in enumerate(meshes):
 
61
        
 
62
        a_error = stat("MMS_"+str(mesh[0])+".stat")["NS"][field]["l2norm"][-1]
 
63
        b_error = stat("MMS_"+str(mesh[1])+".stat")["NS"][field]["l2norm"][-1]
 
64
        
 
65
        ratio = a_error / b_error
 
66
        
 
67
        print mesh[0] + '->' + mesh[1] + ': ', log(ratio, 2)
 
68
 
 
69
        convergence[i+1] = min(log(ratio, 2), convergence[i+1])
 
70
    
 
71
    print '-------------------------------------------'
 
72
 
 
73
print ''
 
74
    </variable>
 
75
    <variable name="a_finish_time" language="python">
 
76
from fluidity_tools import stat_parser as stat
 
77
a_finish_time = stat("MMS_A.stat")["ElapsedTime"]["value"][-1]
 
78
    </variable>
 
79
    <variable name="b_finish_time" language="python">
 
80
from fluidity_tools import stat_parser as stat
 
81
b_finish_time = stat("MMS_B.stat")["ElapsedTime"]["value"][-1]
 
82
    </variable>
 
83
    <variable name="c_finish_time" language="python">
 
84
from fluidity_tools import stat_parser as stat
 
85
c_finish_time = stat("MMS_C.stat")["ElapsedTime"]["value"][-1]
 
86
    </variable>
 
87
    <variable name="d_finish_time" language="python">
 
88
from fluidity_tools import stat_parser as stat
 
89
d_finish_time = stat("MMS_D.stat")["ElapsedTime"]["value"][-1]
 
90
    </variable>
 
91
  </variables>
 
92
  <pass_tests>
 
93
    <test name="velocity convergence order > 2.8" language="python">
 
94
assert(convergence[0] &gt; 2.8)
 
95
    </test>
 
96
    <test name="k production term convergence order > 1.9" language="python">
 
97
assert(convergence[1] &gt; 1.9)
 
98
    </test>
 
99
    <test name="k destruction convergence order > 2.8" language="python">
 
100
assert(convergence[2] &gt; 2.8)
 
101
    </test>
 
102
    <test name="k buoyancy term convergence order > 1.9" language="python">
 
103
assert(convergence[3] &gt; 1.9)
 
104
    </test>
 
105
    <test name="k convergence order > 2.8" language="python">
 
106
assert(convergence[4] &gt; 2.8)
 
107
    </test>
 
108
    <test name="epsilon production term convergence order > 1.9" language="python">
 
109
assert(convergence[5] &gt; 1.9)
 
110
    </test>
 
111
    <test name="epsilon destruction convergence order > 2.8" language="python">
 
112
assert(convergence[6] &gt; 2.8)
 
113
    </test>
 
114
    <test name="epsilon buoyancy term convergence order > 1.9" language="python">
 
115
assert(convergence[7] &gt; 1.9)
 
116
    </test>
 
117
    <test name="epsilon convergence order > 2.8" language="python">
 
118
assert(convergence[8] &gt; 2.8)
 
119
    </test>
 
120
    <test name="scalar eddy viscosity convergence order > 2.8" language="python">
 
121
assert(convergence[9] &gt; 2.8)
 
122
    </test>
 
123
    <test name="buoyant scalar field convergence order > 2.8" language="python">
 
124
assert(convergence[10] &gt; 2.8)
 
125
    </test>
 
126
    <test name="pressure convergence order > 1.6" language="python">
 
127
assert(convergence[11] &gt; 1.6)
 
128
    </test>
 
129
    <test name="checking A finished in less than 100 seconds" language="python">
 
130
assert(a_finish_time-100.0 &lt; 1.E-10)
 
131
    </test>
 
132
    <test name="checking B finished in less than 100 seconds" language="python">
 
133
assert(b_finish_time-100.0 &lt; 1.E-10)
 
134
    </test>
 
135
    <test name="checking C finished in less than 100 seconds" language="python">
 
136
assert(c_finish_time-100.0 &lt; 1.E-10)
 
137
    </test>
 
138
    <test name="checking D finished in less than 100 seconds" language="python">
 
139
assert(d_finish_time-100.0 &lt; 1.E-10)
 
140
    </test>
 
141
  </pass_tests>
 
142
  <warn_tests>
 
143
  </warn_tests>
 
144
</testproblem>
 
145