


REDUCERIGHTSIDE [p_f]= Reducerightside( p_g, G_mn, K_fs, y_s, flag_y_s )
Reduces right hand side vectors from g-size to f-size (p_g to p_f).
Partition p_g into p_n and p_m, then modify p_n
p_n = p_n + G_mn^T * p_m
where G_mn is the reduction matrix from multi-point constraints
Partition p_n into p_f and p_s, then modify p_f if flag_y_s > 0
p_f = p_f - K_fs * y_s
where y_s are enforced displacements/temperatures,
The g-set is partitioned as follows
g = n + m
n = f + s
g all system degrees of freedom (dof)
m multi-point constraint dofs to be condensed out
n remaining dof after m-set is condensed from the g-set
s boundary condition dofs (single point constraints)
f remaining free dofs after s-set is eliminated from the n-set
Input: p_g right hand side vectors (g size)
G_mn Reduction matrix from constraints (m x n)
K_fs Partitioned stiffness matrix (f x s)
y_s enforced displacements / temperatures s size
flag_y_s flag for enforced displacement / temperature
> 0 K_fs * y_s is subtracted
<= 0 no action
Output: p_f reduced right hand side vectors (f-size)
Called by sol101 (ms), Normalmodes (ms), Residualheat (mf)
Calls none
where ms= m-script, mf= m-function, mex= executable function (c-code)
All input and output variables are assumed to be in the Matlab workspace.
The load vectors p_g and y_s must have the same number of columns.
Input from global workspace:
uset uset.pv_* partitioning vector
uset.*size size
*=n,m etc., see Builduset
uset.pv_m and uset.pv_n index vectors are wrt the g- set
uset.pv_s and uset.pv_f index vectors are wrt the n- set
etc.

0001 function [p_f]= reducerightside( p_g, G_mn, K_fs, y_s, flag_y_s, uset ) 0002 % REDUCERIGHTSIDE [p_f]= Reducerightside( p_g, G_mn, K_fs, y_s, flag_y_s ) 0003 % Reduces right hand side vectors from g-size to f-size (p_g to p_f). 0004 % 0005 % Partition p_g into p_n and p_m, then modify p_n 0006 % 0007 % p_n = p_n + G_mn^T * p_m 0008 % 0009 % where G_mn is the reduction matrix from multi-point constraints 0010 % 0011 % Partition p_n into p_f and p_s, then modify p_f if flag_y_s > 0 0012 % 0013 % p_f = p_f - K_fs * y_s 0014 % 0015 % where y_s are enforced displacements/temperatures, 0016 % 0017 % The g-set is partitioned as follows 0018 % g = n + m 0019 % n = f + s 0020 % g all system degrees of freedom (dof) 0021 % m multi-point constraint dofs to be condensed out 0022 % n remaining dof after m-set is condensed from the g-set 0023 % s boundary condition dofs (single point constraints) 0024 % f remaining free dofs after s-set is eliminated from the n-set 0025 % 0026 % Input: p_g right hand side vectors (g size) 0027 % G_mn Reduction matrix from constraints (m x n) 0028 % K_fs Partitioned stiffness matrix (f x s) 0029 % y_s enforced displacements / temperatures s size 0030 % flag_y_s flag for enforced displacement / temperature 0031 % > 0 K_fs * y_s is subtracted 0032 % <= 0 no action 0033 % 0034 % Output: p_f reduced right hand side vectors (f-size) 0035 % 0036 % Called by sol101 (ms), Normalmodes (ms), Residualheat (mf) 0037 % Calls none 0038 % where ms= m-script, mf= m-function, mex= executable function (c-code) 0039 % 0040 % All input and output variables are assumed to be in the Matlab workspace. 0041 % The load vectors p_g and y_s must have the same number of columns. 0042 % 0043 % Input from global workspace: 0044 % 0045 % uset uset.pv_* partitioning vector 0046 % uset.*size size 0047 % *=n,m etc., see Builduset 0048 % 0049 % uset.pv_m and uset.pv_n index vectors are wrt the g- set 0050 % uset.pv_s and uset.pv_f index vectors are wrt the n- set 0051 % etc. 0052 0053 % Reduce p_g to p_f if not empty 0054 0055 if ~isempty(p_g) 0056 0057 % Reduce p_g to p_n 0058 0059 if ( uset.msize > 0 ) 0060 p_n = p_g( uset.pv_n, :); 0061 p_m = p_g( uset.pv_m, :); 0062 p_n = p_n + G_mn' * p_m; 0063 else 0064 p_n = p_g; 0065 end 0066 0067 % Reduce p_n to p_f 0068 0069 if ( uset.ssize > 0 ) 0070 p_f = p_n( uset.pv_f, :); 0071 else 0072 p_f = p_n; 0073 end 0074 0075 % Create a p_f if p_g is empty 0076 0077 else 0078 0079 if isempty(y_s) 0080 disp('No right hand side found...'); 0081 p_f=[]; 0082 return; 0083 else 0084 ncols= size( y_s, 2); 0085 p_f= sparse([],[],[],uset.fsize, ncols); 0086 end 0087 0088 end 0089 0090 % for nonzero boundary conditions, subtract coupling forces, 0091 % this operation is only executed if flag_y_s > 0, 0092 % the flag is set in the calling script for linear analysis 0093 % and the first iteration step in nonlinear analysis 0094 0095 if ( flag_y_s > 0 ) & ( ~isempty(y_s) ) 0096 % check if p_f and y_s have the same number of columns 0097 0098 ncolp= size(p_f,2); 0099 ncoly= size(y_s,2); 0100 0101 if ncolp ~= ncoly 0102 disp('Right hand side can not be calculated...'); 0103 return; 0104 end 0105 0106 p_f = p_f - K_fs * y_s; 0107 0108 end 0109 0110 0111 end