MCPcopy Create free account
hub / github.com/cselab/aphros / GetDiff

Function GetDiff

deploy/scripts/aphros/plot.py:745–763  ·  view source on GitHub ↗
(pp, fld, ue)

Source from the content-addressed store, hash-verified

743# u1: l1 norm
744# u2: l2 norm
745def GetDiff(pp, fld, ue):
746 umax = []
747 u1 = []
748 u2 = []
749 for i, p in enumerate(pp):
750 # read volume fraction
751 v = ReadArray(p)
752 # read field
753 u = ReadField(GetPathTemplate(p), fld)
754 # difference
755 du = abs(u - ue)
756 # norms
757 umax.append((du * v).max())
758 u1.append((du * v).sum() / v.sum())
759 u2.append(((du**2 * v).sum() / v.sum())**0.5)
760 umax = np.array(umax)
761 u1 = np.array(u1)
762 u2 = np.array(u2)
763 return umax, u1, u2
764
765
766# Writes line as x,y columns.

Callers 1

UnivelFunction · 0.85

Calls 5

ReadArrayFunction · 0.85
ReadFieldFunction · 0.85
GetPathTemplateFunction · 0.85
maxMethod · 0.80
sumMethod · 0.80

Tested by

no test coverage detected