function cellnorm = normCellVector(cellvec)
% this function calculates the second norm of a cell vector field
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
%

% Written by Ali A. Eftekhari
% See the license file

% check the size of the variable and the mesh dimension
d = cellvec.domain.dimension;

if (d ==1) || (d==1.5) || (d==1.8)
	cellnormval = abs(cellvec.xvalue);
elseif (d == 2) || (d == 2.5) || (d==2.8)
	cellnormval = realsqrt(cellvec.xvalue.*cellvec.xvalue+ ...
        cellvec.yvalue.*cellvec.yvalue);
elseif (d == 3) || (d==3.2)
    cellnormval = realsqrt(cellvec.xvalue.*cellvec.xvalue+ ...
        cellvec.yvalue.*cellvec.yvalue+ ...
        cellvec.zvalue.*cellvec.zvalue);
end
BC = createBC(cellvec.domain);
c=cellBoundary(cellnormval, BC);
cellnorm=CellVariable(cellvec.domain, c);

simulkade
github-repos/MATLAB/simulkade-FVTool/FVTool-49f5cb9ee8a5ff0befebd9fa71a99feae7c724d6/Utilities/normCellVector.m
FVTool
github-repos/MATLAB/simulkade-FVTool
49f5cb9ee8a5ff0befebd9fa71a99feae7c724d6