Ejemplo n.º 1
0
    def marshall(self, md, fid):  # {{{

        yts = 365.0 * 24.0 * 3600.0

        WriteData(fid, 'enum', InversionTypeEnum(), 'data', 0, 'format',
                  'Integer')
        WriteData(fid, 'object', self, 'fieldname', 'iscontrol', 'format',
                  'Boolean')
        WriteData(fid, 'object', self, 'fieldname', 'incomplete_adjoint',
                  'format', 'Boolean')
        if not self.iscontrol:
            return
        WriteData(fid, 'object', self, 'fieldname', 'nsteps', 'format',
                  'Integer')
        WriteData(fid, 'object', self, 'fieldname', 'maxiter_per_step',
                  'format', 'DoubleMat', 'mattype', 3)
        WriteData(fid, 'object', self, 'fieldname',
                  'cost_functions_coefficients', 'format', 'DoubleMat',
                  'mattype', 1)
        WriteData(fid, 'object', self, 'fieldname', 'gradient_scaling',
                  'format', 'DoubleMat', 'mattype', 3)
        WriteData(fid, 'object', self, 'fieldname', 'cost_function_threshold',
                  'format', 'Double')
        WriteData(fid, 'object', self, 'fieldname', 'min_parameters', 'format',
                  'DoubleMat', 'mattype', 3)
        WriteData(fid, 'object', self, 'fieldname', 'max_parameters', 'format',
                  'DoubleMat', 'mattype', 3)
        WriteData(fid, 'object', self, 'fieldname', 'step_threshold', 'format',
                  'DoubleMat', 'mattype', 3)
        WriteData(fid, 'object', self, 'fieldname', 'vx_obs', 'format',
                  'DoubleMat', 'mattype', 1, 'scale', 1. / yts)
        WriteData(fid, 'object', self, 'fieldname', 'vy_obs', 'format',
                  'DoubleMat', 'mattype', 1, 'scale', 1. / yts)
        WriteData(fid, 'object', self, 'fieldname', 'vz_obs', 'format',
                  'DoubleMat', 'mattype', 1, 'scale', 1. / yts)
        WriteData(fid, 'object', self, 'fieldname', 'thickness_obs', 'format',
                  'DoubleMat', 'mattype', 1)
        WriteData(fid, 'object', self, 'fieldname', 'surface_obs', 'format',
                  'DoubleMat', 'mattype', 1)

        #process control parameters
        num_control_parameters = len(self.control_parameters)
        data = numpy.array([
            StringToEnum(control_parameter)[0]
            for control_parameter in self.control_parameters
        ]).reshape(1, -1)
        WriteData(fid, 'data', data, 'enum', InversionControlParametersEnum(),
                  'format', 'DoubleMat', 'mattype', 3)
        WriteData(fid, 'data', num_control_parameters, 'enum',
                  InversionNumControlParametersEnum(), 'format', 'Integer')

        #process cost functions
        num_cost_functions = numpy.size(self.cost_functions)
        data = marshallcostfunctions(self.cost_functions)
        WriteData(fid, 'data',
                  numpy.array(data).reshape(1, -1), 'enum',
                  InversionCostFunctionsEnum(), 'format', 'DoubleMat',
                  'mattype', 3)
        WriteData(fid, 'data', num_cost_functions, 'enum',
                  InversionNumCostFunctionsEnum(), 'format', 'Integer')
Ejemplo n.º 2
0
    def marshall(self, md, fid):  # {{{

        yts = 365. * 24. * 3600.

        WriteData(fid, 'object', self, 'fieldname', 'spcthickness', 'format',
                  'DoubleMat', 'mattype', 1, 'timeserieslength',
                  md.mesh.numberofvertices + 1)
        WriteData(fid, 'object', self, 'fieldname', 'isfreesurface', 'format',
                  'Boolean')
        WriteData(fid, 'object', self, 'fieldname', 'min_thickness', 'format',
                  'Double')
        WriteData(fid, 'data',
                  StringToEnum(self.hydrostatic_adjustment)[0], 'format',
                  'Integer', 'enum', MasstransportHydrostaticAdjustmentEnum())
        WriteData(fid, 'object', self, 'fieldname', 'stabilization', 'format',
                  'Integer')
        WriteData(fid, 'object', self, 'fieldname', 'vertex_pairing', 'format',
                  'DoubleMat', 'mattype', 3)
        WriteData(fid, 'object', self, 'fieldname', 'penalty_factor', 'format',
                  'Double')

        #process requested outputs
        outputs = self.requested_outputs
        indices = [i for i, x in enumerate(outputs) if x == 'default']
        if len(indices) > 0:
            outputscopy = outputs[0:max(0, indices[0] -
                                        1)] + self.defaultoutputs(
                                            md) + outputs[indices[0] + 1:]
            outputs = outputscopy
        WriteData(fid, 'data', outputs, 'enum',
                  MasstransportRequestedOutputsEnum(), 'format', 'StringArray')
Ejemplo n.º 3
0
    def marshall(self, md, fid):  # {{{

        enums = np.zeros(len(self.definitions), )

        for i in range(len(self.definitions)):
            self.definitions[i].marshall(md, fid)
            classdefinition = self.definitions[i].__class__.__name__
            classdefinition = classdefinition[0].upper() + classdefinition[1:]
            enums[i] = StringToEnum(classdefinition)[0]

        enums = np.unique(enums)

        WriteData(fid, 'data', enums, 'enum', OutputdefinitionListEnum(),
                  'format', 'DoubleMat', 'mattype', 1)
Ejemplo n.º 4
0
Archivo: damage.py Proyecto: pf4d/issm
    def marshall(self, md, fid):  # {{{

        WriteData(fid, 'object', self, 'fieldname', 'isdamage', 'format',
                  'Boolean')
        if self.isdamage:
            WriteData(fid, 'object', self, 'fieldname', 'D', 'format',
                      'DoubleMat', 'mattype', 1)
            WriteData(fid, 'object', self, 'fieldname', 'law', 'format',
                      'Integer')
            WriteData(fid, 'object', self, 'fieldname', 'spcdamage', 'format',
                      'DoubleMat', 'mattype', 1, 'timeserieslength',
                      md.mesh.numberofvertices + 1)
            WriteData(fid, 'object', self, 'fieldname', 'max_damage', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'stabilization',
                      'format', 'Integer')
            WriteData(fid, 'object', self, 'fieldname', 'maxiter', 'format',
                      'Integer')
            WriteData(fid, 'enum', DamageElementinterpEnum(), 'data',
                      StringToEnum(self.elementinterp)[0], 'format', 'Integer')
            WriteData(fid, 'object', self, 'fieldname', 'stress_threshold',
                      'format', 'Double')
            WriteData(fid, 'object', self, 'fieldname', 'kappa', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'c1', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'c2', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'c3', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'c4', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'healing', 'format',
                      'Double')
            WriteData(fid, 'object', self, 'fieldname', 'equiv_stress',
                      'format', 'Integer')

        #process requested outputs
        outputs = self.requested_outputs
        indices = [i for i, x in enumerate(outputs) if x == 'default']
        if len(indices) > 0:
            outputscopy = outputs[0:max(0, indices[0] -
                                        1)] + self.defaultoutputs(
                                            md) + outputs[indices[0] + 1:]
            outputs = outputscopy
        WriteData(fid, 'data', outputs, 'enum',
                  DamageEvolutionRequestedOutputsEnum(), 'format',
                  'StringArray')
Ejemplo n.º 5
0
Archivo: matice.py Proyecto: pf4d/issm
    def marshall(self, md, fid):  # {{{
        WriteData(fid, 'enum', MaterialsEnum(), 'data', MaticeEnum(), 'format',
                  'Integer')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'rho_ice', 'format', 'Double')
        WriteData(fid, 'object', self, 'class',
                  'materials', 'fieldname', 'rho_water', 'enum',
                  MaterialsRhoSeawaterEnum(), 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'rho_freshwater', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'mu_water', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'heatcapacity', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'latentheat', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'thermalconductivity', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'temperateiceconductivity', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'meltingpoint', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'beta', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'mixed_layer_capacity', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'thermal_exchange_velocity', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'rheology_B', 'format', 'DoubleMat', 'mattype', 1,
                  'timeserieslength', md.mesh.numberofvertices + 1)
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'rheology_B', 'format', 'DoubleMat', 'mattype', 1)
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'rheology_n', 'format', 'DoubleMat', 'mattype', 2)
        WriteData(fid, 'data',
                  StringToEnum(self.rheology_law)[0], 'enum',
                  MaterialsRheologyLawEnum(), 'format', 'Integer')

        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'lithosphere_shear_modulus', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'lithosphere_density', 'format', 'Double', 'scale', 10.**3.)
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'mantle_shear_modulus', 'format', 'Double')
        WriteData(fid, 'object', self, 'class', 'materials', 'fieldname',
                  'mantle_density', 'format', 'Double', 'scale', 10.**3.)
Ejemplo n.º 6
0
 def marshall(self, md, fid):  # {{{
     WriteData(fid, 'data',
               StringToEnum(self.migration)[0], 'enum',
               GroundinglineMigrationEnum(), 'format', 'Integer')