Generates pdetoolbox c-tensor for the isotropic case 1. cij12=cij21=0 (no (x,y)-mixed derivative terms) 2. cij11=cij22 (isotropic diffusion) Hence, c is only a N-by-N tensor, where the i-th component of grad(c tensor grad u) is div(divmat_i dot grad u), where divmat_i ist i-th row of divmat. divmat is a neq-by-neq matrix of vectors with nt components In particular, if diffusion/fluxes are space-independent then use nt=1 and divmat an neq-by-neq matrix.
0001 function c=isoc(divmat,neq,nt) 0002 % Generates pdetoolbox c-tensor for the isotropic case 0003 % 1. cij12=cij21=0 (no (x,y)-mixed derivative terms) 0004 % 2. cij11=cij22 (isotropic diffusion) 0005 % Hence, c is only a N-by-N tensor, where the i-th component of 0006 % grad(c tensor grad u) is div(divmat_i dot grad u), 0007 % where divmat_i ist i-th row of divmat. 0008 % 0009 % divmat is a neq-by-neq matrix of vectors with nt components 0010 % In particular, if diffusion/fluxes are space-independent then use 0011 % nt=1 and divmat an neq-by-neq matrix. 0012 0013 c=[]; 0014 dz=zeros(1,nt); 0015 for j=0:neq-1 0016 for i=1:neq 0017 cij11=divmat(i,1+j*nt:(j+1)*nt); 0018 cij22=cij11; 0019 cij12=dz; 0020 cij21=dz; 0021 c=[c;cij11;cij21;cij12;cij22]; 0022 end 0023 end 0024 0025 % ordering example: (3 compo system, i.e. 4*9=36 entries in c) 0026 %c=[c1111; c1121; c1112; c1122; c2111; c2121; c2112; c2122; ... 0027 % c3111; c3121; c3112; c3122; ... 0028 % c1211; c1221; c1212; c1222; c2211; c2221; c2212; c2222;... 0029 % c3211; c3221; c3212; c3222; ... 0030 % c1311; c1321; c1312; c1322; c2311; c2321; c2312; c2322;... 0031 % c3311; c3321; c3312; c3322];