Changeset 27035 for issm/trunk/src/m/classes/fourierlove.py
- Timestamp:
- 06/01/22 05:01:48 (3 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 26745-26955,26957-27031
- Property svn:mergeinfo changed
-
issm/trunk/src
- Property svn:mergeinfo changed
-
issm/trunk/src/m/classes/fourierlove.py
r26744 r27035 22 22 self.mu0 = 0 23 23 self.Gravitational_Constant = 0 24 self.chandler_wobble = 0 24 25 self.allow_layer_deletion = 0 25 26 self.underflow_tol = 0 27 self.pw_threshold = 0 26 28 self.integration_steps_per_layer = 0 27 29 self.istemporal = 0 … … 51 53 s += '{}\n'.format(fielddisplay(self, 'allow_layer_deletion', 'allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)')) 52 54 s += '{}\n'.format(fielddisplay(self, 'Gravitational_Constant', 'Newtonian constant of gravitation (default: 6.67259e-11 [m^3 kg^-1 s^-2])')) 55 s += '{}\n'.format(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)')) 53 56 s += '{}\n'.format(fielddisplay(self, 'allow_layer_deletion', 'allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)')) 54 s += '{}\n'.format(fielddisplay(self, 'underflow_tol', 'threshold of deep to surface love number ratio to trigger the deletion of layers (default: 1e-16)')) 57 s += '{}\n'.format(fielddisplay(self, 'pw_threshold', 'if relative variation across frequencies is smaller than this ratio, the post-widder transform for time-dependent love numbers is bypassed (default (1e-3)')) 58 s += '{}\n'.format(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)')) 55 59 s += '{}\n'.format(fielddisplay(self, 'integration_steps_per_layer', 'number of radial steps to propagate the yi system from the bottom to the top of each layer (default: 100)')) 56 60 s += '{}\n'.format(fielddisplay(self, 'istemporal', ['1 for time-dependent love numbers, 0 for frequency-dependent or elastic love numbers (default: 0)', 'If 1: use fourierlove function build_frequencies_from_time to meet consistency'])) … … 88 92 self.mu0 = 1e11 # Pa 89 93 self.Gravitational_Constant = 6.67259e-11 # m^3 kg^-1 s^-2 94 self.chandler_wobble = 0 90 95 self.allow_layer_deletion = 1 91 96 self.underflow_tol = 1e-16 # Threshold of deep to surface love number ratio to trigger the deletion of layer 97 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 92 98 self.integration_steps_per_layer = 100 93 99 self.istemporal = 0 … … 113 119 md = checkfield(md, 'fieldname', 'love.mu0', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0) 114 120 md = checkfield(md, 'fieldname', 'love.Gravitational_Constant', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0) 121 md = checkfield(md, 'fieldname', 'love.chandler_wobble', 'values', [0, 1]) 115 122 md = checkfield(md, 'fieldname', 'love.allow_layer_deletion', 'values', [0, 1]) 116 123 md = checkfield(md, 'fieldname', 'love.underflow_tol', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0) 124 md = checkfield(md, 'fieldname', 'love.pw_threshold', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0) 117 125 md = checkfield(md, 'fieldname', 'love.integration_steps_per_layer', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0) 118 126 md = checkfield(md, 'fieldname', 'love.love_kernels', 'values', [0, 1]) … … 127 135 raise RuntimeError('Degree 1 not supported for forcing type {}. Use sh_min >= 2 for this kind of calculation.'.format(md.love.forcing_type)) 128 136 137 if md.love.chandler_wobble == 1: 138 print('Warning: Chandler wobble in Love number calculator has not been validated yet') 139 129 140 # Need 'litho' material 130 if not hasattr(md.materials, 'materials')or 'litho' not in md.materials.nature:141 if md.materials.__class__.__name__ != 'materials' or 'litho' not in md.materials.nature: 131 142 raise RuntimeError('Need a \'litho\' material to run a Fourier Love number analysis') 132 143 133 mat = np.where(np.array( nature) == 'litho')[0]144 mat = np.where(np.array(md.materials.nature) == 'litho')[0] 134 145 if md.love.forcing_type <= 4: 135 146 md = checkfield(md, 'fieldname', 'love.inner_core_boundary', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0, '<=', md.materials[mat].numlayers) … … 149 160 WriteData(fid, prefix, 'object', self, 'fieldname', 'mu0', 'format', 'Double') 150 161 WriteData(fid, prefix, 'object', self, 'fieldname', 'Gravitational_Constant', 'format', 'Double') 162 WriteData(fid, prefix, 'object', self, 'fieldname', 'chandler_wobble', 'format', 'Boolean') 151 163 WriteData(fid, prefix, 'object', self, 'fieldname', 'allow_layer_deletion', 'format', 'Boolean') 152 164 WriteData(fid, prefix, 'object', self, 'fieldname', 'underflow_tol', 'format', 'Double') 165 WriteData(fid, prefix, 'object', self, 'fieldname', 'pw_threshold', 'format', 'Double') 153 166 WriteData(fid, prefix, 'object', self, 'fieldname', 'integration_steps_per_layer', 'format', 'Integer') 154 167 WriteData(fid, prefix, 'object', self, 'fieldname', 'istemporal', 'format', 'Boolean') … … 171 184 print('Temporal love numbers: Overriding md.love.nfreq and md.love.frequencies') 172 185 self.nfreq = len(self.time) * 2 * self.n_temporal_iterations 173 self.frequencies = np.zeros((self.nfreq, 1))186 self.frequencies = np.zeros((self.nfreq,)) 174 187 for i in range(len(self.time)): 175 188 for j in range(2 * self.n_temporal_iterations): 176 self.frequencies[(i - 1) * 2 * self.n_temporal_iterations + j] = j * np.log(2) / self.time[i] / 2 / np.pi 189 if self.time[i] == 0: 190 self.frequencies[(i - 1) * 2 * self.n_temporal_iterations + j] = 0 # Convention to avoid marshalling infinite numbers 191 else: 192 self.frequencies[(i - 1) * 2 * self.n_temporal_iterations + j] = j * np.log(2) / self.time[i] / 2 / np.pi 193 return self 177 194 #}}}
Note:
See TracChangeset
for help on using the changeset viewer.