0001 function pbeDefinition = checkInputSolver(pbeDefinition)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 if ~isfield(pbeDefinition, 'option')
0024 pbeDefinition.option = struct();
0025 end
0026
0027
0028
0029 if ~isfield(pbeDefinition,'timeSpan')
0030 error('elk:pbeSolver:wrongInput', ...
0031 'pbeDefinition must contain a field ''timeSpan''');
0032 end
0033
0034
0035 if ~isfield(pbeDefinition,'dec') && (...
0036 isfield(pbeDefinition, 'seeding') || ...
0037 isfield(pbeDefinition, 'nucleationRate'))
0038 error('elk:pbeSolver:wrongInput', ...
0039 'pbeDefinition must contain a field ''dec'' if seeding or nucleation is used');
0040 elseif ~isfield(pbeDefinition,'dec')
0041
0042 pbeDefinition.dec = obtainCrystalDec('generic_potash_alum', 0);
0043 end
0044
0045 if ~isfield(pbeDefinition, 'nDecCoordinate')
0046 pbeDefinition.nDecCoordinate = pbeDefinition.dec.nC;
0047 end
0048 if ~isfield(pbeDefinition, 'nExtraCoordinate')
0049 pbeDefinition.nExtraCoordinate = 0;
0050 end
0051 if ~isfield(pbeDefinition, 'extraZeroBound')
0052 pbeDefinition.extraZeroBound = [];
0053 elseif size(pbeDefinition.extraZeroBound, 2) ~= pbeDefinition.nExtraCoordinate
0054 error('elk:pbeSolver:inputError', ['Please correct the number of columns '...
0055 ' for the extra condition matrix, it must match the number of ' ...
0056 ' extra property coordinates']);
0057 end
0058
0059
0060
0061 if ~isfield(pbeDefinition,'growthRate')
0062 pbeDefinition.growthRate = @(H, P, x, y, t)(H-H);
0063 pbeDefinition.growthGrad = @(H, P, x, y, t)([]);
0064 else
0065 if ~isfield(pbeDefinition,'growthGrad')
0066 pbeDefinition.growthGrad = @(H, P, x, y, t)([]);
0067 end
0068 end
0069
0070
0071 if ~isfield(pbeDefinition, 'nucleationRate')
0072 pbeDefinition.nucleationRate = @(x, y, t)(-1);
0073 pbeDefinition.nucleationSize = zeros([...
0074 pbeDefinition.nDecCoordinate + ...
0075 pbeDefinition.nExtraCoordinate, 1]);
0076 else
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 warning('elk:pbeSolver:wrongInput', ['Handling of nucleation ' ...
0088 'is not yet fully supported. Calculation of integral properties ' ...
0089 'will yield wrong error estimated. See more in code comments.']);
0090
0091 if ~isfield(pbeDefinition, 'nucleationSize')
0092 pbeDefinition.nucleationSize = zeros([...
0093 pbeDefinition.nDecCoordinate + ...
0094 pbeDefinition.nExtraCoordinate, 1]);
0095 end
0096 end
0097
0098
0099 if (~isfield(pbeDefinition, 'bulkRate') && ...
0100 isfield(pbeDefinition, 'bulkInitial')...
0101 ) || (...
0102 isfield(pbeDefinition, 'bulkRate') && ...
0103 ~isfield(pbeDefinition, 'bulkInitial')...
0104 )
0105 error('elk:pbeSolver:wrongInput', ...
0106 'pbeDefinition must contain both fields ''bulkRate'' and ''bulkInitial''');
0107 elseif ~isfield(pbeDefinition, 'bulkRate') && ...
0108 ~isfield(pbeDefinition, 'bulkInitial')
0109
0110
0111 pbeDefinition.bulkInitial = 0;
0112 pbeDefinition.bulkRate = @(x, y, t)(1);
0113 end
0114
0115
0116 if ~isfield(pbeDefinition, 'pivotProperty')
0117 pbeDefinition.pivotProperty = @(H, up)(H);
0118 elseif ischar(pbeDefinition.pivotProperty) || ...
0119 iscell(pbeDefinition.pivotProperty)
0120
0121 pbeDefinition.pivotProperty = @(H, up)(computeMeasureDec(...
0122 pbeDefinition.dec, 'hC', {up, H}, ...
0123 pbeDefinition.pivotProperty, [], 0, 1));
0124 end
0125
0126
0127 if ~isfield(pbeDefinition, 'bulkProperty')
0128 pbeDefinition.bulkProperty = @(P, N, x, t)([]);
0129 end
0130
0131
0132 if ~isfield(pbeDefinition, 'seeding')
0133 pbeDefinition.seeding = struct('');
0134 end