Skip to content

Commit

Permalink
Merge pull request #137 from dngoldberg/branch_vaf_mask_multiple
Browse files Browse the repository at this point in the history
new change to have multiple mask values
  • Loading branch information
dngoldberg authored Jun 5, 2024
2 parents 27090ed + a8accc9 commit c2ea8b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions fenics_ice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ class ErrorPropCfg(ConfigPrinter):
"""
qoi: str = 'vaf'
qoi_apply_vaf_mask: bool = False
qoi_vaf_mask_usecode: bool = False
qoi_vaf_mask_code: int = 1
phase_name: str = 'error_prop'
phase_suffix: str = ''

Expand Down
10 changes: 7 additions & 3 deletions fenics_ice/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,10 +1458,14 @@ def comp_Q_vaf(self, verbose=False):
HAF = ufl.Max(b_ex * (H + (rhow/rhoi)*bed) + (1-b_ex)*(H), 0.0)

if self.params.error_prop.qoi_apply_vaf_mask:
msk_ex = conditional(self.vaf_mask > 0.0, 1.0, 0.0)
Q_vaf = msk_ex * HAF * dx
if self.params.error_prop.qoi_vaf_mask_usecode:
code = float(self.params.error_prop.qoi_vaf_mask_code)
msk_ex = conditional(abs(self.vaf_mask-code)<1.e-10, 1.0, 0.0)
else:
msk_ex = conditional(self.vaf_mask > 0.0, 1.0, 0.0)
Q_vaf = msk_ex * HAF * dx
else:
Q_vaf = HAF * dx
Q_vaf = HAF * dx

if verbose:
info(f"Q_vaf: {assemble(Q_vaf)}")
Expand Down

0 comments on commit c2ea8b9

Please sign in to comment.