diff --git a/DefineAGlenDistribution.m b/DefineAGlenDistribution.m
index 3579e432..4034b109 100755
--- a/DefineAGlenDistribution.m
+++ b/DefineAGlenDistribution.m
@@ -1,15 +1,15 @@
-function [UserVar,AGlen,n]=DefineAGlenDistribution(UserVar,CtrlVar,MUA,time,s,b,h,S,B,rho,rhow,GF)
+function [UserVar,AGlen,n]=DefineAGlenDistribution(UserVar,CtrlVar,MUA,F)
%%
%
% User input m-file to define A and n in the Glenn-Steinemann flow law
%
+% [UserVar,AGlen,n]=DefineAGlenDistribution(UserVar,CtrlVar,MUA,F)
+%
% [UserVar,AGlen,n]=DefineAGlenDistribution(UserVar,CtrlVar,MUA,time,s,b,h,S,B,rho,rhow,GF)
%
-% Usually A is defined on the nodes (but sometimes in an inverse run A might be
-% defined as an element variable.)
%
%%
diff --git a/DefineCalving.m b/DefineCalving.m
index 6dc06875..12826224 100644
--- a/DefineCalving.m
+++ b/DefineCalving.m
@@ -10,6 +10,11 @@
%
% Both the Level-Set Field (LSF) and the Calving-Rate Field (c) must be defined over the whole computational domain.
%
+% The level-set option must be activated by setting
+%
+% CtrlVar.LevelSetMethod=1;
+%
+% in DefineInitialInputs.m
%
% The LSF should, in general, only be defined in the beginning of the run and set the initial value for the LSF. However, if
% required, the user can change LSF at any time step. The LSF is evolved by solving the Level-Set equation, so any changes
@@ -31,6 +36,9 @@
% then the level-set is NOT evolved in time using by solving the level-set equation. This can be usefull if, for example, the
% user simply wants to manually prescribe the calving front position at each time step.
%
+%
+% See more information in Ua2D_DefaultParameters.
+%
%%
%% initialize LSF
diff --git a/DefineCalvingAtIntegrationPoints.m b/DefineCalvingAtIntegrationPoints.m
index b81cf5ea..614d14ff 100755
--- a/DefineCalvingAtIntegrationPoints.m
+++ b/DefineCalvingAtIntegrationPoints.m
@@ -1,16 +1,57 @@
function [c,dcddphidx,dcddphidy]=DefineCalvingAtIntegrationPoints(UserVar,CtrlVar,dphidx,dphidy,F)
-% function [c,dcDdphidx,dcDdphidy]=DefineCalvingAtIntegrationPoints(UserVar,CtrlVar,dfdx,dfdy,u,v,h,s,S,x,y)
-
+%%
+%
+% Defines calving at integration points.
%
% phi is the level set function
%
-
% dcddphidx is dc/d (dphidx) = \frac{ d c]{d (dphidx)}, ie it is the derivative of c with respect to dphidx
% where dphidx is in turn d(phi)/dx
%
-% cint=DefineCalvingAtIntegrationPoints(UserVar,CtrlVar,nx,ny,uint,vint)
-
+% Note: F is here provided at the integration points, i.e. this is not the usual F variable provided at nodes!
+% Not all the usual fields of F are available. The fields available include:
+% u,v,h,s,S,rho,exx,exy,eyy.
+%
+% Also note that F.x,F.y are here the (x,y) coordinates of the integration points, ie not the (x,y) nodal coordinates.
+%
+% The level-set option must be activated by setting
+%
+% CtrlVar.LevelSetMethod=1;
+%
+% in DefineInitialInputs.m
+%
+% If the calving rate is a function of the gradients of the level-set, the calving rate must be defined at the element
+% integration points using this function as:
+%
+%
+% [c,dcddphidx,dcddphidy]=DefineCalvingAtIntegrationPoints(UserVar,CtrlVar,dphidx,dphidy,F)
+%
+% which provies dphi/dx and dphi/dy where phi is the level-set function
+%
+% This option is activated by the usuer by setting
+%
+%
+% CtrlVar.CalvingLaw.Evaluation="-int-" ;
+%
+% in DefineInitialInputs.m
+%
+% The default is to prescribe the calving rate at the nodes, i.e. by default we have
+%
+% CtrlVar.CalvingLaw.Evaluation="-node-" ;
+%
+% Prescribing the calving rate at the integration points is, for example, required if the calving rate is a function of velocities normal to the calving front.
+%
+% The user must then also return derivatives of the calving rate, c, with respect to x and y derivatives of the level set,
+% ie
+%
+% $$\frac{dc}{d (d \phi/dx)}$$
+%
+% $$\frac{dc}{d (d \phi/dy)}$$
+%
+% More details are provided in the UaCompendium
+%
+%%
narginchk(5,5)
diff --git a/DefineMassBalance.m b/DefineMassBalance.m
index f22374d5..b8766b44 100755
--- a/DefineMassBalance.m
+++ b/DefineMassBalance.m
@@ -18,7 +18,7 @@
% dasdh and dabdh only need to be specified if the mass-balance feedback option is
% being used.
%
-% In Úa the mass balance, as returned by this m-file, is multiplied internally by the local ice density.
+% In Úa the mass balance, as returned by this m-file, is multiplied internally by the local ice density.
%
% The units of as and ab are water equivalent per time, i.e. usually
% as and ab will have the same units as velocity (something like m/yr or m/day).
@@ -41,24 +41,32 @@
% These fields need to be returned at the nodal coordinates. The nodal
% x and y coordinates are stored in MUA.coordinates, and also in F as F.x and F.y
%
-% Examples:
%
-% To set upper surface mass balance to zero, and melt along the lower ice
-% surface to 10 over all ice shelves:
+% *Examples* :
+%
+% *To set upper surface mass balance to zero, and melt along the lower ice
+% surface to 10 over all ice shelves:*
%
% as=zeros(MUA.Nnodes,1);
% ab=-(1-F.GF.node)*10
%
%
-% To set upper surface mass balance as a function of local surface elevation and
-% prescribe mass-balance feedback for the upper surface:
+% *To set upper surface mass balance as a function of local surface elevation and
+% prescribe mass-balance feedback for the upper surface:*
%
% as=0.1*F.h+F.b;
% dasdh=zeros(MUA.Nnodes,1)+0.1;
% ab=F.s*0;
% dabdh=zeros(MUA.Nnodes,1);
%
+% *To add basal melt due to sliding as a mass-balance term:*
+%
+% [tbx,tby,tb,beta2] = CalcBasalTraction(CtrlVar,MUA,F.ub,F.vb,F.C,F.m,F.GF);
+% L=333.44 ; % Enthalpy of fusion = L = [J/gramm = kJ/kg] Make sure that the units are correct.
+% F.ab=-(tbx.*F.ub+tby.*F.vb)./(F.rho.*L); % Ablation (Melt) is always negative, accumulation is positive
+%
%
+%
%%
diff --git a/DefineSlipperyDistribution.m b/DefineSlipperyDistribution.m
index 9e8e226a..dfe560a3 100755
--- a/DefineSlipperyDistribution.m
+++ b/DefineSlipperyDistribution.m
@@ -1,9 +1,11 @@
-function [UserVar,C,m,q,muk]=DefineSlipperyDistribution(UserVar,CtrlVar,MUA,time,s,b,h,S,B,rho,rhow,GF)
+function [UserVar,C,m,q,muk]=DefineSlipperyDistribution(UserVar,CtrlVar,MUA,F)
%%
%
+ % [UserVar,C,m,q,muk]=DefineSlipperyDistribution(UserVar,CtrlVar,MUA,F)
+ %
% [UserVar,C,m,q,muk]=DefineSlipperyDistribution(UserVar,CtrlVar,MUA,time,s,b,h,S,B,rho,rhow,GF)
%
%
diff --git a/ReleaseNotes.m b/ReleaseNotes.m
index 6847f5e3..6ede1d44 100644
--- a/ReleaseNotes.m
+++ b/ReleaseNotes.m
@@ -2,12 +2,18 @@
%%
%
+%
+%
+% *Release Notes* _October 2023_
+%
+% A (rare) case where the Cauchy direction is not a direction of descent was incorrectly updated. This has now been addressed.
+%
+%
% *Release Notes* _September 2023_
%
% * Thanks to Sebastian Rosier for providing an example where the backtracking algorithm failed. This has now been corrected.
%
%
-%
% *Release Notes* _July 2023_
%
% * uv and uvh solver now uses dog-leg seach if Newton back-tracking results in small steps.
@@ -235,7 +241,7 @@
%
% CtrlVar.DefineOutputsDt
%
-% If you define these old fields in your (new) DefineInitialInputs.m, Úa will spot this and complain bitterly.
+% If you define these old fields in your (new) DefineInitialInputs.m, �a will spot this and complain bitterly.
%
% Those using Unix might want to systematically change names of some of the CtrlVar fields
% in there old input files. You might be able to use something like:
@@ -272,7 +278,7 @@
% _February 2020_
%
%
-% * Úa can now be called with CtrlVar as second argument, e.g
+% * �a can now be called with CtrlVar as second argument, e.g
%
% Ua([],CtrlVar)
%
diff --git a/html/DefineAGlenDistribution.html b/html/DefineAGlenDistribution.html
index 8f4620f8..e597bd7e 100755
--- a/html/DefineAGlenDistribution.html
+++ b/html/DefineAGlenDistribution.html
@@ -1,13 +1,18 @@
-
-
-
-
- DefineAGlenDistribution
function [UserVar,AGlen,n]=DefineAGlenDistribution(UserVar,CtrlVar,MUA,time,s,b,h,S,B,rho,rhow,GF)
-
User input m-file to define A and n in the Glenn-Steinemann flow law