nonlinear coefficient in custom PDE.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to solve a variation of 2D steady state heat conduction PDE using PDE toolbox
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1032135/image.png)
Here
, to simulate nonlinear behaviour.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1032140/image.png)
Here is my code.
syms T(x,y)
syms k
pdeeq = diff(diff(T,x),x) + k*diff(diff(T,y),y)
symCoeffs = pdeCoefficients(pdeeq,T,'Symbolic',true)
symVars = [k]
symVals = [@(~,state) 0.01+1*state.u];
symCoeffs = subs(symCoeffs,symVars,symVals);
I get the following error, which does make sense
Error using sym/subs>normalize
Substitution expression X must be a symbolic, cell, or numeric array.
Error in sym/subs>mupadsubs (line 165)
[X2,Y2,symX,symY] = normalize(X,Y); %#ok
Error in sym/subs (line 153)
G = mupadsubs(F,X,Y);
Error in sym/subs>@(value)subs(value,X,Y) (line 64)
G = structfun(@(value) subs(value, X, Y), F, 'UniformOutput', false);
Error in sym/subs (line 64)
G = structfun(@(value) subs(value, X, Y), F, 'UniformOutput', false);
In case of standard heat transfer I can write this.
k = @(~,state) 0.01+1*state.u
thermalProperties(model,'ThermalConductivity', k);
How to do the same with my custom PDE?
0 comentarios
Respuestas (1)
Brahmadev
el 25 de Sept. de 2023
Hi Prakhar,
I understand that you would like to model a custom PDE. The error "Substitution expression X must be a symbolic, cell, or numeric array." is caused due to the passing of a function handle instead of a Symbolic Variable to the "subs" function. An alternate way to model this PDE is as shown below:
syms T(x,y)
syms k
pdeeq = diff(diff(T,x),x) + k*diff(diff(T,y),y) == 0
symCoeffs = pdeCoefficients(pdeeq,T,'Symbolic',true)
symVars = k
symVals = x+10*y^2 % Assuming the variable 'k' is some nonlinear function of x and y
pdeeq = subs(pdeeq,symVars,symVals) % Directly updating the equation pdeeq with new variable
Post this, the PDE can be solved using the "solve" function with appropriate boundary conditions. You can refer to the following documentation to know more about “solve” function..
Hope this helps in resolving your issue.
0 comentarios
Ver también
Categorías
Más información sobre Boundary Conditions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!