Changeset 27327


Ignore:
Timestamp:
10/24/22 20:23:59 (2 years ago)
Author:
jdquinn
Message:

CHG: Python translations; cleanup

Location:
issm/trunk-jpl
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/fourierlove.py

    r26840 r27327  
    11import numpy as np
    22
     3from checkfield import checkfield
    34from fielddisplay import fielddisplay
    4 from checkfield import checkfield
    55from WriteData import WriteData
    66
     
    4343        # - Correct display to match MATLAB
    4444        #
    45         s = '   Fourier Love class:\n'
    46         s += '{}\n'.format(fielddisplay(self, 'nfreq', 'number of frequencies sampled (default: 1, elastic) [Hz]'))
     45        s = '{}\n'.format(fielddisplay(self, 'nfreq', 'number of frequencies sampled (default: 1, elastic) [Hz]'))
    4746        s += '{}\n'.format(fielddisplay(self, 'frequencies', 'frequencies sampled (convention defaults to 0 for the elastic case) [Hz]'))
    4847        s += '{}\n'.format(fielddisplay(self, 'sh_nmax', 'maximum spherical harmonic degree (default: 256, .35 deg, or 40 km at equator)'))
     
    6463        s += '{}\n'.format(fielddisplay(self, 'forcing_type', 'integer indicating the nature and depth of the forcing for the Love number calculation (default: 11):'))
    6564        s += '{}\n'.format('                                                     1:  Inner core boundary -- Volumic Potential')
    66         s += '{}\n'.format('                                                     2:  Inner core boundary --  Pressure')
    67         s += '{}\n'.format('                                                     3:  Inner core boundary --  Loading')
    68         s += '{}\n'.format('                                                     4:  Inner core boundary --  Tangential traction')
    69         s += '{}\n'.format('                                                     5:  Core mantle boundary --  Volumic Potential')
    70         s += '{}\n'.format('                                                     6:  Core mantle boundary --  Pressure')
    71         s += '{}\n'.format('                                                     7:  Core mantle boundary --  Loading')
    72         s += '{}\n'.format('                                                     8:  Core mantle boundary --  Tangential traction')
    73         s += '{}\n'.format('                                                     9:  Surface-- Volumic Potential')
    74         s += '{}\n'.format('                                                     10: Surface-- Pressure')
    75         s += '{}\n'.format('                                                     11: Surface-- Loading')
    76         s += '{}\n'.format('                                                     12: Surface-- Tangential traction ')
     65        s += '{}\n'.format('                                                     2:  Inner core boundary -- Pressure')
     66        s += '{}\n'.format('                                                     3:  Inner core boundary -- Loading')
     67        s += '{}\n'.format('                                                     4:  Inner core boundary -- Tangential traction')
     68        s += '{}\n'.format('                                                     5:  Core mantle boundary -- Volumic Potential')
     69        s += '{}\n'.format('                                                     6:  Core mantle boundary -- Pressure')
     70        s += '{}\n'.format('                                                     7:  Core mantle boundary -- Loading')
     71        s += '{}\n'.format('                                                     8:  Core mantle boundary -- Tangential traction')
     72        s += '{}\n'.format('                                                     9:  Surface -- Volumic Potential')
     73        s += '{}\n'.format('                                                     10: Surface -- Pressure')
     74        s += '{}\n'.format('                                                     11: Surface -- Loading')
     75        s += '{}\n'.format('                                                     12: Surface -- Tangential traction ')
    7776        s += '{}\n'.format(fielddisplay(self, 'inner_core_boundary', 'interface index in materials.radius locating forcing. Only used for forcing_type 1--4 (default: 1)'))
    7877        s += '{}\n'.format(fielddisplay(self, 'core_mantle_boundary', 'interface index in materials.radius locating forcing. Only used for forcing_type 5--8 (default: 2)'))
     
    8786        self.sh_nmax = 256 # .35 degree, 40 km at the equator
    8887        self.sh_nmin = 1
    89         # Work on matlab script for computing g0 for given Earth's structure
     88        # Work on Python script for computing g0 for given Earth's structure
    9089        self.g0 = 9.81 # m/s^2
    9190        self.r0 = 6371 * 1e3 # m
     
    129128
    130129        md = checkfield(md, 'fieldname', 'love.istemporal', 'values', [0, 1])
     130
    131131        if md.love.istemporal:
    132132            md = checkfield(md, 'fieldname', 'love.n_temporal_iterations', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0)
    133133            md = checkfield(md, 'fieldname', 'love.time', 'NaN', 1, 'Inf', 1, 'numel', md.love.nfreq / 2 / md.love.n_temporal_iterations)
    134         if md.love.sh_nmin <= 1 and (md.love.forcing_type == 9 or md.love.forcing_type == 5 or md.love.forcing_type == 1):
     134        if md.love.sh_nmin <= 1 and (md.love.forcing_type == 1 or md.love.forcing_type == 5 or md.love.forcing_type == 9):
    135135            raise RuntimeError('Degree 1 not supported for forcing type {}. Use sh_min >= 2 for this kind of calculation.'.format(md.love.forcing_type))
    136136
  • issm/trunk-jpl/src/m/classes/love.m

    r27308 r27327  
    3333                hypergeom_table1=0;
    3434                hypergeom_table2=0;
    35                 hypergeom_nalpha=0;
     35                hypergeom_table1=0;
    3636                hypergeom_nz=0;
    3737                hypergeom_z=0;
     
    6868                        self.underflow_tol=1e-16; %threshold of deep to surface love number ratio to trigger the deletion of layer
    6969                        self.pw_threshold=1e-3; %if relative variation across frequencies is smaller than this ratio, the post-widder transform for time-dependent love numbers is bypassed
    70                         self.min_integration_steps      = 50;
    71                         self.max_integration_dr = 10e3;
     70                        self.min_integration_steps=50;
     71                        self.max_integration_dr=1e4;
    7272                        self.integration_scheme=1;
    7373                        self.istemporal=0;
     
    9696                        fielddisplay(self,'mu0','adimensioning constant for stress (default: 10^11) [Pa]');
    9797                        fielddisplay(self,'Gravitational_Constant','Newtonian constant of gravitation (default: 6.67259e-11 [m^3 kg^-1 s^-2])');
    98                         fielddisplay(self,'chandler_wobble','includes the inertial terms for the chandler wobble in the rotational feedback love numbers, only for forcing_type=11 (default: 0) (/!\ 1 is untested yet)');
     98                        fielddisplay(self,'chandler_wobble','includes the inertial terms for the chandler wobble in the rotational feedback love numbers, only for forcing_type=11 (default: 0) (/!\ 1 has not been validated yet)');
    9999                        fielddisplay(self,'allow_layer_deletion','allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)');                   
    100100                        fielddisplay(self,'underflow_tol','threshold of deep to surface love number ratio to trigger the deletion of layers (default: 1e-16)');
     
    111111                        fielddisplay(self,'core_mantle_boundary','interface index in materials.radius locating forcing. Only used for forcing_type 5--8 (default: 2)');
    112112                        fielddisplay(self,'complex_computation','return love numbers as 0: real (useful for elastic or temporal forms), 1: complex numbers (useful for Fourier spectral form) (default: 0)');
    113                         fielddisplay(self,'quad_precision','toogle computation love numbers and post-widder transform with 32 digit precision, useful for temporal form (default: 1)');
     113                        fielddisplay(self,'quad_precision','toggle computation love numbers and post-widder transform with 32 digit precision, useful for temporal form (default: 1)');
    114114                        fielddisplay(self,'debug','outputs yi system matrix prior to solving (default: 0)');
    115115                        fielddisplay(self,'hypergeom_table1','table 1 for hypergeometric function, only for EBM rheology (default: [1])');
  • issm/trunk-jpl/src/m/classes/model.py

    r26928 r27327  
    271271        self.calving = calving()
    272272        self.frontalforcings = frontalforcings()
    273         self.love = fourierlove()
     273        self.love = love()
    274274        self.esa = esa()
    275275        self.sampling = sampling()
  • issm/trunk-jpl/src/m/classes/sealevelmodel.py

    r26358 r27327  
    8888    def checkconsistency(slm, solutiontype):  # {{{
    8989        # Is the coupler turned on?
    90         for i in range(len(slm.icecaps)):
    91             if not slm.icecaps[i].transient.iscoupler:
    92                 print('Warning: sealevelmodel.py::checkconsistency: icecap model {} should have the transient coupler option turned on!'.format(slm.icecaps[i].miscellaneous.name))
    93 
    94         if not slm.earth.transient.iscoupler:
    95             print('Warning: sealevelmodel.py::checkconsistency: earth model should have the transient coupler option turned on!')
     90        #for i in range(len(slm.icecaps)):
     91        #    if not slm.icecaps[i].transient.iscoupler:
     92        #        print('Warning: sealevelmodel.py::checkconsistency: icecap model {} should have the transient coupler option turned on!'.format(slm.icecaps[i].miscellaneous.name))
     93
     94        #if not slm.earth.transient.iscoupler:
     95        #    print('Warning: sealevelmodel.py::checkconsistency: earth model should have the transient coupler option turned on!')
    9696
    9797        # Check that the transition vectors have the right size
    98         for i in range(len(slm.icecaps)):
    99             if slm.icecaps[i].mesh.numberofvertices != len(slm.earth.slr.transitions[i]):
    100                 raise Exception('sealevelmodel.py::checkconsistency: issue with size of transition vector for ice cap: {} name: {}'.format(i, slm.icecaps[i].miscellaneous.name))
     98        if slm.earth.mesh.numberofvertices != len(slm.earth.solidearth.transfercount):
     99            raise Exception('sealevelmodel.py::checkconsistency: earth.solidearth.transfercount should be of size earth.mesh.numberofvertices')
    101100
    102101        # Check that run frequency is the same everywhere
     
    108107        for i in range(len(slm.icecaps)):
    109108            md = slm.icecaps[i]
    110             if np.nonzero(md.dsl.steric_rate - slm.earth.dsl.steric_rate[slm.earth.dsl.transitions[i]]) != []:
     109            if np.nonzero(md.dsl.sea_surface_height_above_geoid - slm.earth.dsl.sea_surface_height_above_geoid[slm.transitions[i]]) != []:
    111110                raise Exception('sealevelmodel.py::checkconsistency: steric rate on ice cap {} is not the same as for the earth'.format(md.miscellaneous.name))
    112111
     
    114113        for i in range(len(slm.icecaps)):
    115114            md = slm.icecaps[i]
    116             if md.solidearthsettings.isgrd != slm.earth.solidearthsettings.isgrd:
     115            if md.solidearth.settings.isgrd != slm.earth.solidearth.settings.isgrd:
    117116                raise RuntimeError('sealevelmodel.py::checkconsistency: isgrd on ice cap {} is not the same as for the earth\n'.format(md.miscellaneous.name))
    118117
     
    221220        self.transitions = []
    222221        self.eltransitions = []
     222        self.earth.solidearth.transfercount = np.zeros(self.earth.mesh.numberofvertices)
    223223
    224224        # For elements
     
    240240            self.transitions.append(meshintersect3d(self.earth.mesh.x, self.earth.mesh.y, self.earth.mesh.z, mdi.mesh.x, mdi.mesh.y, mdi.mesh.z, 'force', force))
    241241            self.eltransitions.append(meshintersect3d(xe, ye, ze, xei, yei, zei, 'force', force))
     242
     243            self.earth.solidearth.transfercount[self.transitions[i]] = self.earth.solidearth/transfercount[self.transitions[i]] + 1
     244
     245        for i in range(len(self.icecaps)):
     246            self.icecaps[i].solidearth.transfercount = self.earth.solidearth.transfercount[self.transitions[i]]
    242247    # }}}
    243248
     
    246251        for i in range(len(self.basins)):
    247252            flags[self.transitions[i]] = i
    248         plotmodel(self.earth, 'data', flags, 'coastline', 'on')
     253        plotmodel(self.earth, 'data', flags, 'coastlines', 'on')
    249254    # }}}
    250255
  • issm/trunk-jpl/src/m/solve/solveslm.py

    r26358 r27327  
    7777        nps.append(slm.earth.cluster.np)
    7878
    79     BuildQueueScriptMultipleModels(cluster, slm.private.runtimename, slm.miscellaneous.name, slm.private.solution, valgrind, privateruntimenames, miscellaneousnames, nps)
     79    BuildQueueScriptMultipleModels(cluster, slm.private.runtimename, slm.miscellaneous.name, slm.private.solution, privateruntimenames, miscellaneousnames, nps)
    8080
    8181    # Upload all required files, given that each individual solution for icecaps and earth model already did
  • issm/trunk-jpl/test/NightlyRun/test2084.py

    r26881 r27327  
    5656md.love.pw_threshold = 1e-3
    5757md.love.Gravitational_Constant = 6.6732e-11
    58 md.love.integration_steps_per_layer = 100
    5958md.love.allow_layer_deletion = 1
    6059md.love.forcing_type = 11
Note: See TracChangeset for help on using the changeset viewer.