From 341b98d23a6afdf7d6ca6cf273bd1122df65a950 Mon Sep 17 00:00:00 2001 From: Lindsey Heagy Date: Sat, 28 May 2016 13:06:19 -0700 Subject: [PATCH] use layer center and layer thickness to parametrize layer --- SimPEG/Maps.py | 196 ++++++++++++++++++++++++++----------------------- 1 file changed, 106 insertions(+), 90 deletions(-) diff --git a/SimPEG/Maps.py b/SimPEG/Maps.py index cc541ba0..be789a2a 100644 --- a/SimPEG/Maps.py +++ b/SimPEG/Maps.py @@ -1101,6 +1101,12 @@ class ParametrizedBlockInLayer(IdentityMap): """ Parametrized Block in a Layered Space + For 2D: + m = [val_background, val_layer, val_block, layer_center, layer_thickness, block_x0, block_dx] + + For 3D: + m = [val_background, val_layer, val_block, layer_center, layer_thickness, block_x0, block_y0, block_dx, block_dy] + .. plot:: :include-source: @@ -1111,7 +1117,7 @@ class ParametrizedBlockInLayer(IdentityMap): mesh = Mesh.TensorMesh([50,50],x0='CC') mapping = Maps.ParametrizedBlockInLayer(mesh) - m = np.hstack(np.r_[1., 2., 3., -0.2, 0.0, 0.3, 0.2]) + m = np.hstack(np.r_[1., 2., 3., -0.1, 0.2, 0.3, 0.2]) rho = mapping._transform(m) mesh.plotImage(rho, ax=ax) @@ -1127,13 +1133,14 @@ class ParametrizedBlockInLayer(IdentityMap): """ - slope_fact = 1e3 # slope factor of the arctan function - will be scaled by the mesh. - slope = None # slope of the arctan functions - indActive = None # bool array of the active indicies + slope_fact = 1e2 # will be scaled by the mesh. + slope = None + indActive = None def __init__(self, mesh, **kwargs): - IdentityMap.__init__(self, mesh, **kwargs) + super(ParametrizedBlockInLayer, self).__init__(mesh, **kwargs) + if self.slope is None: self.slope = self.slope_fact / np.hstack(self.mesh.h).min() @@ -1156,9 +1163,9 @@ class ParametrizedBlockInLayer(IdentityMap): def _validate_m(self, m): # TODO: more sanity checks here if self.mesh.dim == 2: - assert len(m) == 7, 'm must be length 5: [val_back, val_layer, val_block, layer_bottom, layer_top, x0_block, dx_block]' + assert len(m) == 7, 'm must be length 7 not {0}: [val_back, val_layer, val_block, layer_center, layer_thickness, x0_block, dx_block'.format(len(m)) elif self.mesh.dim == 3: - assert len(m) == 9, 'm must be length 7: [val_back, val_layer, val_block, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block]' + assert len(m) == 9, 'm must be length 9 not {0}: [val_back, val_layer, val_block, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block]'.format(len(m)) else: raise NotImplementedError('Only 2D and 3D meshes are implemented for the Parametrized_Block_in_Layer Map') @@ -1171,51 +1178,62 @@ class ParametrizedBlockInLayer(IdentityMap): dx = - slope return (1./(1 + x**2))/np.pi * dx - def _atanlayer(self, layer_bottom, layer_top): + def _atanlayer(self, layer_center, layer_thickness): if self.mesh.dim == 2: z = self.y elif self.mesh.dim == 3: z = self.z + layer_bottom = layer_center - layer_thickness / 2. + layer_top = layer_center + layer_thickness / 2. return self._atanfct(z, layer_bottom, self.slope)*self._atanfct(z, layer_top, -self.slope) - def _atanlayerDeriv_layer_bottom(self, layer_bottom, layer_top): + def _atanlayerDeriv_layer_center(self, layer_center, layer_thickness): if self.mesh.dim == 2: z = self.y elif self.mesh.dim == 3: z = self.z - return self._atanfctDeriv(z, layer_bottom, self.slope)*self._atanfct(z, layer_top, -self.slope) + layer_bottom = layer_center - layer_thickness / 2. + layer_top = layer_center + layer_thickness / 2. - def _atanlayerDeriv_layer_top(self, layer_bottom, layer_top): + return (self._atanfctDeriv(z, layer_bottom, self.slope)*self._atanfct(z, layer_top, -self.slope) + + self._atanfct(z, layer_bottom, self.slope)*self._atanfctDeriv(z, layer_top, -self.slope)) + + def _atanlayerDeriv_layer_thickness(self, layer_center, layer_thickness): if self.mesh.dim == 2: z = self.y elif self.mesh.dim == 3: z = self.z - return self._atanfct(z, layer_bottom, self.slope)*self._atanfctDeriv(z, layer_top, -self.slope) + layer_bottom = layer_center - layer_thickness / 2. + layer_top = layer_center + layer_thickness / 2. - def _atanblock2d(self, layer_bottom, layer_top, x0_block, dx_block): + return (-0.5*self._atanfctDeriv(z, layer_bottom, self.slope)*self._atanfct(z, layer_top, -self.slope) + + 0.5*self._atanfct(z, layer_bottom, self.slope)*self._atanfctDeriv(z, layer_top, -self.slope)) - return (self._atanlayer(layer_bottom, layer_top) + def _atanblock2d(self, layer_center, layer_thickness, x0_block, dx_block): + + return (self._atanlayer(layer_center, layer_thickness) * self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope)) - def _atanblock2dDeriv_layer_bottom(self, layer_bottom, layer_top, x0_block, dx_block): + def _atanblock2dDeriv_layer_center(self, layer_center, layer_thickness, x0_block, dx_block): - return (self._atanlayerDeriv_layer_bottom(layer_bottom, layer_top) + return (self._atanlayerDeriv_layer_center(layer_center, layer_thickness) * self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope)) - def _atanblock2dDeriv_layer_top(self, layer_bottom, layer_top, x0_block, dx_block): + def _atanblock2dDeriv_layer_thickness(self, layer_center, layer_thickness, x0_block, dx_block): - return (self._atanlayerDeriv_layer_top(layer_bottom, layer_top) + return (self._atanlayerDeriv_layer_thickness(layer_center, layer_thickness) * self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope)) - def _atanblock2dDeriv_x0(self, layer_bottom, layer_top, x0_block, dx_block): - return self._atanlayer(layer_bottom, layer_top) * ( + def _atanblock2dDeriv_x0(self, layer_center, layer_thickness, x0_block, dx_block): + + return self._atanlayer(layer_center, layer_thickness) * ( (self._atanfctDeriv(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope)) + @@ -1223,9 +1241,9 @@ class ParametrizedBlockInLayer(IdentityMap): * self._atanfctDeriv(self.x, x0_block + 0.5*dx_block, -self.slope)) ) - def _atanblock2dDeriv_dx(self, layer_bottom, layer_top, x0_block, dx_block): + def _atanblock2dDeriv_dx(self, layer_center, layer_thickness, x0_block, dx_block): - return self._atanlayer(layer_bottom, layer_top) * ( + return self._atanlayer(layer_center, layer_thickness) * ( (self._atanfctDeriv(self.x, x0_block - 0.5*dx_block, self.slope) * -0.5 * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope)) + @@ -1233,35 +1251,35 @@ class ParametrizedBlockInLayer(IdentityMap): * self._atanfctDeriv(self.x, x0_block + 0.5*dx_block, -self.slope) * 0.5) ) - def _atanblock3d(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3d(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return (self._atanlayer(layer_bottom, layer_top) + return (self._atanlayer(layer_center, layer_thickness) * self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfct(self.y, y0_block - 0.5*dy_block, self.slope) * self._atanfct(self.y, y0_block + 0.5*dy_block, -self.slope)) - def _atanblock3dDeriv_layer_bottom(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3dDeriv_layer_center(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return (self._atanlayerDeriv_layer_bottom(layer_bottom, layer_top) + return (self._atanlayerDeriv_layer_center(layer_center, layer_thickness) * self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfct(self.y, y0_block - 0.5*dy_block, self.slope) * self._atanfct(self.y, y0_block + 0.5*dy_block, -self.slope)) - def _atanblock3dDeriv_layer_top(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3dDeriv_layer_thickness(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return (self._atanlayerDeriv_layer_top(layer_bottom, layer_top) + return (self._atanlayerDeriv_layer_thickness(layer_center, layer_thickness) * self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfct(self.y, y0_block - 0.5*dy_block, self.slope) * self._atanfct(self.y, y0_block + 0.5*dy_block, -self.slope)) - def _atanblock3dDeriv_x0(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3dDeriv_x0(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return self._atanlayer(layer_bottom, layer_top) * ( + return self._atanlayer(layer_center, layer_thickness) * ( (self._atanfctDeriv(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfct(self.y, y0_block - 0.5*dy_block, self.slope) @@ -1273,9 +1291,9 @@ class ParametrizedBlockInLayer(IdentityMap): * self._atanfct(self.y, y0_block + 0.5*dy_block, -self.slope)) ) - def _atanblock3dDeriv_y0(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3dDeriv_y0(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return self._atanlayer(layer_bottom, layer_top) * ( + return self._atanlayer(layer_center, layer_thickness) * ( (self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfctDeriv(self.y, y0_block - 0.5*dy_block, self.slope) @@ -1287,9 +1305,9 @@ class ParametrizedBlockInLayer(IdentityMap): * self._atanfctDeriv(self.y, y0_block + 0.5*dy_block, -self.slope)) ) - def _atanblock3dDeriv_dx(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3dDeriv_dx(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return self._atanlayer(layer_bottom, layer_top) * ( + return self._atanlayer(layer_center, layer_thickness) * ( (self._atanfctDeriv(self.x, x0_block - 0.5*dx_block, self.slope) * -0.5 * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfct(self.y, y0_block - 0.5*dy_block, self.slope) @@ -1301,9 +1319,9 @@ class ParametrizedBlockInLayer(IdentityMap): * self._atanfct(self.y, y0_block + 0.5*dy_block, -self.slope)) ) - def _atanblock3dDeriv_dy(self, layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block): + def _atanblock3dDeriv_dy(self, layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block): - return self._atanlayer(layer_bottom, layer_top) * ( + return self._atanlayer(layer_center, layer_thickness) * ( (self._atanfct(self.x, x0_block - 0.5*dx_block, self.slope) * self._atanfct(self.x, x0_block + 0.5*dx_block, -self.slope) * self._atanfctDeriv(self.y, y0_block - 0.5*dy_block, self.slope) * -0.5 @@ -1320,14 +1338,14 @@ class ParametrizedBlockInLayer(IdentityMap): # parse model vals = m[:3] # model values - layer_bottom = m[3] - layer_top = m[4] + layer_center = m[3] + layer_thickness = m[4] x0_block = m[5] # x-center of the block dx_block = m[6] # block width # assemble the model - layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_bottom, layer_top) # contribution from the layered background - block_cont = (vals[2]-layer_cont)*self._atanblock2d(layer_bottom, layer_top, x0_block, dx_block) # perturbation due to the block + layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_center, layer_thickness) # contribution from the layered background + block_cont = (vals[2]-layer_cont)*self._atanblock2d(layer_center, layer_thickness, x0_block, dx_block) # perturbation due to the block return layer_cont + block_cont @@ -1335,66 +1353,66 @@ class ParametrizedBlockInLayer(IdentityMap): # [val_back, val_layer, val_block, x0_block, dx_block] # parse model vals = m[:3] # model values - layer_bottom = m[3] - layer_top = m[4] + layer_center = m[3] + layer_thickness = m[4] x0_block = m[5] # x-center of the block dx_block = m[6] # block width - layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_bottom, layer_top) # contribution to background from layer + layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_center, layer_thickness) # contribution to background from layer # background value - d_layer_dval0 = np.ones_like(self.x) + (-1.)*self._atanlayer(layer_bottom, layer_top) - d_block_dval0 = (-d_layer_dval0)*self._atanblock2d(layer_bottom, layer_top, x0_block, dx_block) + d_layer_dval0 = np.ones_like(self.x) + (-1.)*self._atanlayer(layer_center, layer_thickness) + d_block_dval0 = (-d_layer_dval0)*self._atanblock2d(layer_center, layer_thickness, x0_block, dx_block) val0_deriv = d_layer_dval0 + d_block_dval0 # layer value - d_layer_dval1 = self._atanlayer(layer_bottom, layer_top) - d_block_dval1 = (-d_layer_dval1)*self._atanblock2d(layer_bottom, layer_top, x0_block, dx_block) + d_layer_dval1 = self._atanlayer(layer_center, layer_thickness) + d_block_dval1 = (-d_layer_dval1)*self._atanblock2d(layer_center, layer_thickness, x0_block, dx_block) val1_deriv = d_layer_dval1 + d_block_dval1 # block value d_layer_dval2 = Zero() - d_block_dval2 = (1.-d_layer_dval2)*self._atanblock2d(layer_bottom, layer_top, x0_block, dx_block) + d_block_dval2 = (1.-d_layer_dval2)*self._atanblock2d(layer_center, layer_thickness, x0_block, dx_block) val2_deriv = d_layer_dval2 + d_block_dval2 - # layer_bottom - d_layer_dlayer_bottom = (vals[1]-vals[0])*self._atanlayerDeriv_layer_bottom(layer_bottom, layer_top) - d_block_dlayer_bottom = ((vals[2]-layer_cont)*self._atanblock2dDeriv_layer_bottom(layer_bottom, layer_top, x0_block, dx_block) - - d_layer_dlayer_bottom*self._atanblock2d(layer_bottom, layer_top, x0_block, dx_block)) - layer_bottom_deriv = d_layer_dlayer_bottom + d_block_dlayer_bottom + # layer_center + d_layer_dlayer_center = (vals[1]-vals[0])*self._atanlayerDeriv_layer_center(layer_center, layer_thickness) + d_block_dlayer_center = ((vals[2]-layer_cont)*self._atanblock2dDeriv_layer_center(layer_center, layer_thickness, x0_block, dx_block) + - d_layer_dlayer_center*self._atanblock2d(layer_center, layer_thickness, x0_block, dx_block)) + layer_center_deriv = d_layer_dlayer_center + d_block_dlayer_center - # layer_top - d_layer_dlayer_top = (vals[1]-vals[0])*self._atanlayerDeriv_layer_top(layer_bottom, layer_top) - d_block_dlayer_top = ((vals[2]-layer_cont)*self._atanblock2dDeriv_layer_top(layer_bottom, layer_top, x0_block, dx_block) - - d_layer_dlayer_top*self._atanblock2d(layer_bottom, layer_top, x0_block, dx_block)) - layer_top_deriv = d_layer_dlayer_top + d_block_dlayer_top + # layer_thickness + d_layer_dlayer_thickness = (vals[1]-vals[0])*self._atanlayerDeriv_layer_thickness(layer_center, layer_thickness) + d_block_dlayer_thickness = ((vals[2]-layer_cont)*self._atanblock2dDeriv_layer_thickness(layer_center, layer_thickness, x0_block, dx_block) + - d_layer_dlayer_thickness*self._atanblock2d(layer_center, layer_thickness, x0_block, dx_block)) + layer_thickness_deriv = d_layer_dlayer_thickness + d_block_dlayer_thickness # x0 of the block d_layer_dx0 = Zero() - d_block_dx0 = (vals[2]-layer_cont)*self._atanblock2dDeriv_x0(layer_bottom, layer_top, x0_block, dx_block) + d_block_dx0 = (vals[2]-layer_cont)*self._atanblock2dDeriv_x0(layer_center, layer_thickness, x0_block, dx_block) x0_deriv = d_layer_dx0 + d_block_dx0 # dx of the block d_layer_ddx = Zero() - d_block_ddx = (vals[2]-layer_cont)*self._atanblock2dDeriv_dx(layer_bottom, layer_top, x0_block, dx_block) + d_block_ddx = (vals[2]-layer_cont)*self._atanblock2dDeriv_dx(layer_center, layer_thickness, x0_block, dx_block) dx_deriv = d_layer_ddx + d_block_ddx - return np.vstack([val0_deriv, val1_deriv, val2_deriv, layer_bottom_deriv, layer_top_deriv, x0_deriv, dx_deriv]).T + return np.vstack([val0_deriv, val1_deriv, val2_deriv, layer_center_deriv, layer_thickness_deriv, x0_deriv, dx_deriv]).T def _transform3d(self, m): # parse model vals = m[:3] # model values - layer_bottom = m[3] - layer_top = m[4] + layer_center = m[3] + layer_thickness = m[4] x0_block = m[5] # x-center of the block y0_block = m[6] # y-center of the block dx_block = m[7] # block x-width dy_block = m[8] # block y-width # assemble the model - layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_bottom, layer_top) # contribution from the layered background - block_cont = (vals[2]-layer_cont)*self._atanblock3d(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) # perturbation due to the block + layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_center, layer_thickness) # contribution from the layered background + block_cont = (vals[2]-layer_cont)*self._atanblock3d(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) # perturbation due to the block return layer_cont + block_cont @@ -1402,63 +1420,63 @@ class ParametrizedBlockInLayer(IdentityMap): # parse model vals = m[:3] # model values - layer_bottom = m[3] - layer_top = m[4] + layer_center = m[3] + layer_thickness = m[4] x0_block = m[5] # x-center of the block y0_block = m[6] # y-center of the block dx_block = m[7] # block x-width dy_block = m[8] # block y-width - layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_bottom, layer_top) # contribution to background from layer + layer_cont = vals[0] + (vals[1]-vals[0])*self._atanlayer(layer_center, layer_thickness) # contribution to background from layer # background value - d_layer_dval0 = np.ones_like(self.x) + (-1.)*self._atanlayer(layer_bottom, layer_top) - d_block_dval0 = (-d_layer_dval0)*self._atanblock3d(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_layer_dval0 = np.ones_like(self.x) + (-1.)*self._atanlayer(layer_center, layer_thickness) + d_block_dval0 = (-d_layer_dval0)*self._atanblock3d(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) val0_deriv = d_layer_dval0 + d_block_dval0 # layer value - d_layer_dval1 = self._atanlayer(layer_bottom, layer_top) - d_block_dval1 = (-d_layer_dval1)*self._atanblock3d(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_layer_dval1 = self._atanlayer(layer_center, layer_thickness) + d_block_dval1 = (-d_layer_dval1)*self._atanblock3d(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) val1_deriv = d_layer_dval1 + d_block_dval1 # block value d_layer_dval2 = Zero() - d_block_dval2 = (1.-d_layer_dval2)*self._atanblock3d(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_block_dval2 = (1.-d_layer_dval2)*self._atanblock3d(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) val2_deriv = d_layer_dval2 + d_block_dval2 - # layer_bottom - d_layer_dlayer_bottom = (vals[1]-vals[0])*self._atanlayerDeriv_layer_bottom(layer_bottom, layer_top) - d_block_dlayer_bottom = ((vals[2]-layer_cont)*self._atanblock3dDeriv_layer_bottom(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) - - d_layer_dlayer_bottom*self._atanblock3d(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block)) - layer_bottom_deriv = d_layer_dlayer_bottom + d_block_dlayer_bottom + # layer_center + d_layer_dlayer_center = (vals[1]-vals[0])*self._atanlayerDeriv_layer_center(layer_center, layer_thickness) + d_block_dlayer_center = ((vals[2]-layer_cont)*self._atanblock3dDeriv_layer_center(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) + - d_layer_dlayer_center*self._atanblock3d(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block)) + layer_center_deriv = d_layer_dlayer_center + d_block_dlayer_center - # layer_top - d_layer_dlayer_top = (vals[1]-vals[0])*self._atanlayerDeriv_layer_top(layer_bottom, layer_top) - d_block_dlayer_top = ((vals[2]-layer_cont)*self._atanblock3dDeriv_layer_top(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) - - d_layer_dlayer_top*self._atanblock3d(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block)) - layer_top_deriv = d_layer_dlayer_top + d_block_dlayer_top + # layer_thickness + d_layer_dlayer_thickness = (vals[1]-vals[0])*self._atanlayerDeriv_layer_thickness(layer_center, layer_thickness) + d_block_dlayer_thickness = ((vals[2]-layer_cont)*self._atanblock3dDeriv_layer_thickness(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) + - d_layer_dlayer_thickness*self._atanblock3d(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block)) + layer_thickness_deriv = d_layer_dlayer_thickness + d_block_dlayer_thickness # x0 of the block d_layer_dx0 = Zero() - d_block_dx0 = (vals[2]-layer_cont)*self._atanblock3dDeriv_x0(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_block_dx0 = (vals[2]-layer_cont)*self._atanblock3dDeriv_x0(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) x0_deriv = d_layer_dx0 + d_block_dx0 # y0 of the block d_layer_dy0 = Zero() - d_block_dy0 = (vals[2]-layer_cont)*self._atanblock3dDeriv_y0(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_block_dy0 = (vals[2]-layer_cont)*self._atanblock3dDeriv_y0(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) y0_deriv = d_layer_dy0 + d_block_dy0 # dx of the block d_layer_ddx = Zero() - d_block_ddx = (vals[2]-layer_cont)*self._atanblock3dDeriv_dx(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_block_ddx = (vals[2]-layer_cont)*self._atanblock3dDeriv_dx(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) dx_deriv = d_layer_ddx + d_block_ddx # dy of the block d_layer_ddy = Zero() - d_block_ddy = (vals[2]-layer_cont)*self._atanblock3dDeriv_dy(layer_bottom, layer_top, x0_block, y0_block, dx_block, dy_block) + d_block_ddy = (vals[2]-layer_cont)*self._atanblock3dDeriv_dy(layer_center, layer_thickness, x0_block, y0_block, dx_block, dy_block) dy_deriv = d_layer_ddy + d_block_ddy - return np.vstack([val0_deriv, val1_deriv, val2_deriv, layer_bottom_deriv, layer_top_deriv, x0_deriv, y0_deriv, dx_deriv, dy_deriv]).T + return np.vstack([val0_deriv, val1_deriv, val2_deriv, layer_center_deriv, layer_thickness_deriv, x0_deriv, y0_deriv, dx_deriv, dy_deriv]).T def _transform(self, m): @@ -1478,5 +1496,3 @@ class ParametrizedBlockInLayer(IdentityMap): elif self.mesh.dim == 3: return self._deriv3d(m) - -