Modelling anisotropic materials in PDE Toolbox

12 visualizaciones (últimos 30 días)
Domantas
Domantas el 19 de Mayo de 2024
Comentada: Domantas el 20 de Jun. de 2024
Hi I'm using the PDE toolbox (unified workflow) to model electromagnetics (DC conduction). I'm working with a material that is anisotropic in its conductivity, ie. it has a conductivity of σ = 0.6 S/m in the x-direction and σ = 0.087 S/m in the y-direction. Right now it seems I can only set isotropic conductivity using the code below, where the conductivity is set to 0.6 S/m in all directions:
model.MaterialProperties(1) = materialProperties(ElectricalConductivity=0.6,RelativePermittivity=4.96e4);
I know you can use function handles to alter the way that the material property is applied spatially, but how would someone do this for properties that depend on the direction (x or y)?
Thanks for the help.

Respuestas (1)

surya venu
surya venu el 19 de Jun. de 2024
Hi,
To model anisotropic materials in the context of the PDE toolbox using MATLAB, especially for electromagnetic (DC conduction) simulations where the material's conductivity varies with direction, you can indeed use function handles to define direction-dependent properties. However, for anisotropic conductivity, you will typically represent the conductivity as a tensor rather than a scalar. This tensor allows you to define different conductivities in different directions.
In MATLAB, you can define this tensor as a function that returns a matrix representing the conductivity in the required form. Here's how you might adjust your code to include anisotropic conductivity:
function defineAnisotropicMaterial(model)
sigma_x = 0.6;
sigma_y = 0.087;
% Define a function handle that returns the conductivity tensor
% The function must accept at least two arguments (even if not used)
conductivityTensor = @(region,state) deal(...
[sigma_x, 0; 0, sigma_y],...
[]);
model.MaterialProperties(1).ElectricalConductivity = conductivityTensor;
model.MaterialProperties(1).RelativePermittivity = 4.96e4;
end
"conductivityTensor" is a function handle that, when called, returns a 2x2 matrix representing the anisotropic conductivity tensor. This function is designed to be compatible with the PDE toolbox, which expects function handles for spatially varying properties to accept two arguments: "region" and "state". Even though they are not used in this simple example (since the conductivity is constant and not spatially varying), they must be included to match the expected signature.
To know more about the "deal" function, check out: https://www.mathworks.com/help/matlab/ref/deal.html
Hope it helps.
  1 comentario
Domantas
Domantas el 20 de Jun. de 2024
Thanks for the very helpful answer. I'm not sure the deal() function works as expected though because it errors with "The number of outputs should match the number of inputs" when it gets to the solve(model) line. It might be because deal() seems to require an output array with the same number of elements as were input to the function.
model.MaterialProperties(1).ElectricalConductivity = conductivityTensor;
It expects 2 outputs but model.MaterialProperties(1).ElectricalConductivity is an empty array.
Any ideas on how to improve this solution? Thanks!

Iniciar sesión para comentar.

Productos


Versión

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by