This file is indexed.

/usr/lib/python2.7/dist-packages/code_saturne/Pages/GroundwaterModel.py is in code-saturne-data 4.3.3+repack-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# -*- coding: utf-8 -*-

#-------------------------------------------------------------------------------

# This file is part of Code_Saturne, a general-purpose CFD tool.
#
# Copyright (C) 1998-2015 EDF S.A.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.

#-------------------------------------------------------------------------------

"""
This module defines the values of reference.

This module contains the following classes and function:
- GroundwaterModel
- GroundwaterTestCase
"""

#-------------------------------------------------------------------------------
# Library modules import
#-------------------------------------------------------------------------------

import sys, unittest

#-------------------------------------------------------------------------------
# Application modules import
#-------------------------------------------------------------------------------

from code_saturne.Base.Common                     import *
from code_saturne.Base.XMLvariables               import Variables, Model
from code_saturne.Base.XMLmodel                   import ModelTest
from code_saturne.Pages.TurbulenceModel           import TurbulenceModel
from code_saturne.Pages.FluidCharacteristicsModel import FluidCharacteristicsModel

#-------------------------------------------------------------------------------
# Mobil Mesh model class
#-------------------------------------------------------------------------------

class GroundwaterModel(Variables, Model):
    """
    Manage the input/output markups in the xml doc about mobil mesh
    """
    def __init__(self, case):
        """
        Constructor.
        """
        self.case = case

        self.node_models  = self.case.xmlGetNode('thermophysical_models')
        self.node_darcy = self.node_models.xmlInitChildNode('groundwater_model', 'model')


    def __defaultValues(self):
        """
        Return in a dictionnary which contains default values.
        """
        default = {}
        default['permeability' ]     = 'isotropic'
        default['dispersion' ]       = 'isotropic'
        default['flow' ]             = 'steady'
        default['groundwater_model'] = 'off'
        default['gravity']           = 'off'
        default['unsaturated']       = 'true'

        return default


    @Variables.noUndo
    def getGroundwaterModel(self):
        """
        Get the Groundwater model
        """
        mdl = self.node_darcy['model']
        if mdl == "":
            mdl = self.__defaultValues()['groundwater_model']
            self.setGroundwaterModel(mdl)
        return mdl


    @Variables.undoLocal
    def setGroundwaterModel(self, choice):
        """
        Put the Groundwater model
        """
        self.isInList(choice, ['off', 'groundwater'])
        old_choice = self.node_darcy['model']
        self.node_darcy['model'] = choice

        self.node_models = self.case.xmlInitNode('thermophysical_models')

        if choice != "off":
            TurbulenceModel(self.case).setTurbulenceModel('off')
            FluidCharacteristicsModel(self.case).setPropertyMode('density', 'constant')
            FluidCharacteristicsModel(self.case).setInitialValue('density', 1.)

            node = self.node_models.xmlInitNode('velocity_pressure')
            nn =  node.xmlGetNode('property', name='total_pressure')
            if nn:
                nn.xmlRemoveNode()
            nn = node.xmlGetNode('property', name='yplus')
            if nn:
                nn.xmlRemoveNode()
            nn =  node.xmlGetNode('property', name='stress')
            if nn:
                nn.xmlRemoveNode()
            nn =  node.xmlGetNode('property', name='stress_normal')
            if nn:
                nn.xmlRemoveNode()
            nn =  node.xmlGetNode('property', name='stress_tangential')
            if nn:
                nn.xmlRemoveNode()
            node_control = self.case.xmlGetNode('analysis_control')
            node_time    = node_control.xmlInitNode('time_parameters')
            nn = node_time.xmlGetNode('property', name='courant_number')
            if nn:
                nn.xmlRemoveNode()
            nn = node_time.xmlGetNode('property', name='fourier_number')
            if nn:
                nn.xmlRemoveNode()

        elif old_choice and old_choice != "off":
            TurbulenceModel(self.case).setTurbulenceModel("k-epsilon-PL")
            node = self.node_models.xmlInitNode('velocity_pressure')
            self.setNewProperty(node, 'total_pressure')
            self.setNewProperty(node, 'yplus')
            n = self.setNewProperty(node, 'stress')
            n['support'] = 'boundary'
            n['label'] = 'Stress'
            if not node.xmlGetChildNode('property', name='stress_tangential'):
                n = self.setNewProperty(node, 'stress_tangential')
                n['label'] = 'Stress, tangential'
                n['support'] = 'boundary'
                n.xmlInitNode('postprocessing_recording')['status']= "off"
            if not node.xmlGetChildNode('property', name='stress_normal'):
                n = self.setNewProperty(node, 'stress_normal')
                n['label'] = 'Stress, normal'
                n['support'] = 'boundary'
                n.xmlInitNode('postprocessing_recording')['status']= "off"


    @Variables.noUndo
    def getPermeabilityType(self):
        """
        Get the permeability model
        """
        node = self.node_darcy.xmlInitChildNode('permeability')
        mdl = node['model']
        if mdl == None:
            mdl = self.__defaultValues()['permeability']
            self.setPermeabilityType(mdl)
        return mdl


    @Variables.undoLocal
    def setPermeabilityType(self, choice):
        """
        Put the permeability model
        """
        self.isInList(choice, ['isotropic', 'anisotropic'])
        node = self.node_darcy.xmlInitChildNode('permeability')
        oldchoice = node['model']

        node['model'] = choice

        if oldchoice != None and oldchoice != choice:
            node.xmlRemoveChild('formula')


    @Variables.noUndo
    def getDispersionType(self):
        """
        Get the dispersion model
        """
        node = self.node_darcy.xmlInitChildNode('dispersion')
        mdl = node['model']
        if mdl == None:
            mdl = self.__defaultValues()['dispersion']
            self.setDispersionType(mdl)
        return mdl


    @Variables.undoLocal
    def setDispersionType(self, choice):
        """
        Put the dispersion model
        """
        self.isInList(choice, ['isotropic', 'anisotropic'])
        node = self.node_darcy.xmlInitChildNode('dispersion')
        node['model'] = choice

        node_models  = self.case.xmlGetNode('thermophysical_models')
        noded   = node_models.xmlInitNode('groundwater')
        nodelist = noded.xmlGetNodeList('diffusion_coefficient')
        if choice == 'anisotropic':
            for n in nodelist:
                nn = n.xmlGetNode('isotropic')
                if nn:
                    nn.xmlRemoveNode()
        else:
            for n in nodelist:
                nn = n.xmlGetNode('longitudinal')
                if nn:
                    nn.xmlRemoveNode()
                nn = n.xmlGetNode('transverse')
                if nn:
                    nn.xmlRemoveNode()


    @Variables.noUndo
    def getFlowType(self):
        """
        Get flow type : steady or unsteady
        """
        node = self.node_darcy.xmlInitChildNode('flowType')
        mdl = node['model']
        if mdl == None:
            mdl = self.__defaultValues()['flow']
            self.setFlowType(mdl)
        return mdl


    @Variables.undoLocal
    def setFlowType(self, choice):
        """
        Put flow type : steady or unsteady
        """
        self.isInList(choice, ['steady', 'unsteady'])
        node = self.node_darcy.xmlInitChildNode('flowType')
        node['model'] = choice


    @Variables.noUndo
    def getUnsaturatedZone(self):
        """
        Get unsaturated zone status : True or False
        """
        node = self.node_darcy.xmlInitChildNode('unsaturatedZone')
        mdl = node['model']
        if mdl == None:
            mdl = self.__defaultValues()['unsaturated']
            self.setUnsaturatedZone(mdl)
        return mdl


    @Variables.undoLocal
    def setUnsaturatedZone(self, choice):
        """
        Get unsaturated zone status : True or False
        """
        self.isInList(choice, ['true', 'false'])
        node = self.node_darcy.xmlInitChildNode('unsaturatedZone')
        node['model'] = choice


    @Variables.noUndo
    def getGravity(self):
        """
        Return if gravity is taken into account
        """
        node = self.node_darcy.xmlInitChildNode('gravity', 'status')
        status = node['status']
        if not status:
            v = self.__defaultValues()['gravity']
            self.setGravity(v)
        return status


    @Variables.undoLocal
    def setGravity(self, v):
        """
        Put if gravity is taken into account
        """
        self.isOnOff(v)
        node = self.node_darcy.xmlInitChildNode('gravity', 'status')
        node['status'] = v