function pbeDefinition = nucleation

% nucleation rate is increasing from a negative to a large positive value
%   and back to below zero again. During this time, the growth rate is
%   switched from one direction to another. This shows the following 
%   phenomena:
%     * toggling on nucleation after some time
%     * transition from nucleation population to seeding population
%     * behavior on changing growth rates during nucleation
pbeDefinition.source = 'generic';

%% Preparation
% crystal
pbeDefinition.cdef = obtainCrystal('generic_potash_alum', 1);

% decomposition data
pbeDefinition.dec = obtainDec(pbeDefinition.cdef.A, 'mapping', ...
    pbeDefinition.cdef.groupMappingMatrix, 'verbose', 0);
pbeDefinition.dec = addMeasureDataDec(pbeDefinition.dec, 'volume');

% population balance equations
dec = pbeDefinition.dec;
pbeDefinition.growthRate = @(H, P, y, t)(...
    (t<300)*bsxfun(@plus, H - H, [0.01;0.01]*1e-7) + ...
    (t>=300)*bsxfun(@plus, H - H, [0.01;0.04]*1e-7));   % m/s

pbeDefinition.pivotProperty = @(H, up)(...
    computeMeasureDec(dec, 'hC', {up, H}, 'volume', [], 0)...
    );
pbeDefinition.bulkProperty = @(P, N, x, t)([...
    P.*N ...
    ]);

pbeDefinition.nucleationRate = @(y, t)(...
    ((t-20).^2-4e2).*((1000-t).^4-1e9) - 100);
% pbeDefinition.nucleationSize = []; % not required if zero

% time span for solution
pbeDefinition.timeSpan = 0:30:(1100);       %s