function G=Gnu(nu,type,param,dim)

default='torq';

if(nargin==1)
  type=default;
  dim=3;
  param=0;
end

mc=min(length(type),4);

if (dim==3)
  if (all(lower(type(1:mc))=='torq'))
    ii=find(nu>=0.49);
    G = nu.*(2 - nu)./( 2*(1 - nu).^3 );
    G(ii) = nu(ii).*5.6916 .*(0.64 - 0.49)./(0.64 - nu(ii)); % g0(0.49) = 5.6916
  elseif (all(lower(type(1:mc))=='carn'))
    G = nu.*(2 - nu)./( 2*(1 - nu).^3 );
  elseif (all(lower(type(1:mc))=='numa'))
    numax=param;
    G=nu./(1-(nu/numax).^(4*numax/3));
  else
    error('type=%s is not supported for %1dD',type,dim);
  end
elseif (dim==2)
  if (all(lower(type(1:mc))=='torq'))
    ii=find(nu>=0.69);
    G = nu.*(16 - 7*nu)./( 16*(1 - nu).^2 );
    G(ii) = nu(ii).*7.2646 .*(0.82 - 0.69)./(0.82 - nu(ii)); % g0(0.69) = 7.2646
  elseif (all(lower(type(1:mc))=='carn'))
    G = nu.*(16 - 7*nu)./( 16*(1 - nu).^2 );
  else
    error('type=%s is not supported for %1dD',type,dim);
  end
end