C coefficients in PDE toolbox on different domains
    조회 수: 6 (최근 30일)
  
       이전 댓글 표시
    
I am solving a system of 3 PDE on a domain and I managed to do it successfully when my coefficient are the same on the whole domain. Now I am having a problem that the C coefficients are changing on the domain based on the solution. So I am gonna have two subdomains, and on each of them I have different c matrices. My code for C is as follows
function cmatrix  = ccoefPsiPrincipalRev1(region,state)
% global Ineg  Ipos  
n1 = 36;
 nr = numel(region.x);
state.u
   region.x
if ~isnan(state.u)
variable=state;
save ('v1' , 'variable')
 dpsixdy=state.uy(1,:) ;
 dpsixdx=state.ux(1,:) ;
 dpsiydy=state.uy(2,:) ;
 dpsiydx=state.ux(2,:) ;
sigma1=(dpsixdy-dpsiydx)/2+sqrt(((dpsixdy+dpsiydx)/2).^2+dpsixdx.^2) ;
sigma2=(dpsixdy-dpsiydx)/2-sqrt(((dpsixdy+dpsiydx)/2).^2+dpsixdx.^2) ;
sign=sigma1.*sigma2 ;
indp=find(sign>0) ;
indn=find(sign<=0) ;
cmatrix = zeros(n1,nr);
normrev= (sqrt(10^-12+ (state.uy(1,indn)+state.ux(2,indn)).^2+4*(state.ux(1,indn)).^2  ) ) ;
cmatrix(1,indn) =   4./normrev;
cmatrix(4,indn) =   1./normrev;
cmatrix(7,indn) =     1./normrev;
cmatrix(10,indn) =    -region.y(indn);
cmatrix(11,indn) =     region.y(indn);
cmatrix(14,indn) =  1./normrev;
cmatrix(17,indn) =  1./normrev;
cmatrix(22,indn) =     region.x(indn);
cmatrix(23,indn) =    -region.x(indn);
cmatrix(26,indn) =   -region.y(indn);
cmatrix(27,indn) =    region.y(indn);
cmatrix(30,indn) =     region.x(indn);
cmatrix(31,indn) =    -region.x(indn);
normrev= (sqrt(10^-12+ (state.uy(1,indp)+state.ux(2,indp)).^2+4*(state.ux(1,indp)).^2  ) );
cmatrix(10,indp) =    region.y(indp);
cmatrix(11,indp) =     -region.y(indp);
cmatrix(22,indp) =     -region.x(indp);
cmatrix(23,indp) =    region.x(indp);
cmatrix(26,indp) =   -region.y(indp);
cmatrix(27,indp) =    region.y(indp);
cmatrix(30,indp) =     region.x(indp);
cmatrix(31,indp) =    -region.x(indp);
else
 cmatrix = NaN(n1,nr);   
end
I think so many thing are wrong with it , I get this error
Error using pde.EquationModel/solveStationaryNonlinear (line 99) Nonlinear solution failed due to singular Jacobian matrix.
How can I do this?
댓글 수: 0
채택된 답변
  Mudambi Srivatsa
    
 2017년 6월 27일
        The following post might be helpful in understanding the "Nonlinear solution failed due to singular Jacobian matrix" error:
https://www.mathworks.com/matlabcentral/answers/120468-why-do-i-receive-an-error-about-a-singular-jacobian-when-i-use-the-bvp4c-function-within-matlab
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!