Skip to content

Commit

Permalink
Merge pull request #125 from jrmaddison/remove_static
Browse files Browse the repository at this point in the history
Remove use of 'static'
  • Loading branch information
bearecinos authored Sep 13, 2023
2 parents a45ee0d + db82d00 commit 95a49c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions fenics_ice/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def __init__(self, mesh_in, input_data, param_in, init_fields=True,
# Define control functions
# Note - these are potentially distinct from solver.alpha, .beta
# because solver may use either two CG spaces or a mixed CGxCG space
self.alpha = Function(self.Qp, name='alpha', static=True)
self.beta = Function(self.Qp, name='beta', static=True)
self.alpha = Function(self.Qp, name='alpha')
self.beta = Function(self.Qp, name='beta')
self.beta_bgd = Function(self.Qp, name='beta_bgd')

# Default velocity mask and Beta fields
Expand Down Expand Up @@ -119,9 +119,9 @@ def init_fields_from_data(self):

min_thick = self.params.ice_dynamics.min_thickness

self.bed = self.field_from_data("bed", self.Q, static=True)
self.bmelt = self.field_from_data("bmelt", self.M, default=0.0, static=True)
self.smb = self.field_from_data("smb", self.M, default=0.0, static=True)
self.bed = self.field_from_data("bed", self.Q)
self.bmelt = self.field_from_data("bmelt", self.M, default=0.0)
self.smb = self.field_from_data("smb", self.M, default=0.0)
self.H_np = self.field_from_data("thick", self.M, min_val=min_thick)

if self.params.melt.use_melt_parameterisation:
Expand Down Expand Up @@ -348,17 +348,17 @@ def interpolate(values, vtx, wts):
M_coords)

# Define new functions to hold results
self.u_obs_Q = Function(self.Q, name="u_obs", static=True)
self.v_obs_Q = Function(self.Q, name="v_obs", static=True)
self.u_std_Q = Function(self.Q, name="u_std", static=True)
self.v_std_Q = Function(self.Q, name="v_std", static=True)
self.u_obs_Q = Function(self.Q, name="u_obs")
self.v_obs_Q = Function(self.Q, name="v_obs")
self.u_std_Q = Function(self.Q, name="u_std")
self.v_std_Q = Function(self.Q, name="v_std")
# self.mask_vel_Q = Function(self.Q)

self.u_obs_M = Function(self.M, name="u_obs", static=True)
self.v_obs_M = Function(self.M, name="v_obs", static=True)
self.u_obs_M = Function(self.M, name="u_obs")
self.v_obs_M = Function(self.M, name="v_obs")
# self.u_std_M = Function(self.M)
# self.v_std_M = Function(self.M)
self.mask_vel_M = Function(self.M, name="mask_vel", static=True)
self.mask_vel_M = Function(self.M, name="mask_vel")

# Fill via interpolation
self.u_obs_Q.vector()[:] = interpolate(self.vel_obs['u_comp'], vtx_Q, wts_Q)
Expand Down
6 changes: 3 additions & 3 deletions fenics_ice/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ def gen_control_fns(self):
if self.mixed_space:
assert self.params.inversion.dual # only need mixed space for 2 controls
self.QQ = self.get_mixed_space()
self._alphaXbeta = Function(self.QQ, name="alphaXbeta", static=True)
self._alphaXbeta = Function(self.QQ, name="alphaXbeta")
self._cntrl_assigner = FunctionAssigner(self.QQ, [self.Qp]*2)

self._alpha = None
self._beta = None
else:
self._alpha = Function(self.Qp, name='alpha', static=True)
self._beta = Function(self.Qp, name='beta', static=True)
self._alpha = Function(self.Qp, name='alpha')
self._beta = Function(self.Qp, name='beta')

self.QQ = None
self._alphaXbeta = None
Expand Down

0 comments on commit 95a49c9

Please sign in to comment.