Solving PDEs: time dependent c coefficient
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am solving a PDE to simulate current flow through a conductive medium in 2D.
My geometry is as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/202113/image.png)
With Neumann boundary conditions applied to edges E2 and E4, like so:
applyBoundaryCondition(model,'neumann','Edge',1:model.Geometry.NumEdges,'q',0,'g',0);
applyBoundaryCondition(model,'neumann','Edge',2,'q',0,'g',1);
applyBoundaryCondition(model,'neuman','Edge',4,'q',0,'g',-1);
I am only interested in solving the PDE in the form of the Laplace equation:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/202114/image.png)
where
is electric potential (which we are solving for) and σ is the conductivity tensor, which is represented as the c coefficient in our PDE model.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/202115/image.png)
I want to apply a time-dependent c coefficient to the subdomain, F2, whereby the conductivity changes in time such that c = t/(t+constant).
I have tried the following lines of code:
c1 = [1;0;0;1];
specifyCoefficients(model,'m',0,'d',0,'c',c1,'a',0,'f',0,'Face',1);
c2 = @(location,state)(repmat([1;0;0;1].*state.time./(state.time + 1),1,length(location.x))); % Conductivity tensor for Face 2.
specifyCoefficients(model,'m',0,'d',0,'c',c2,'a',0,'f',0,'Face',2);
However, I am unsure about how to specify the time scale as the rest of the PDE is time-independent. I have found that
tlist = 0:0.01:1;
results = solvepde(model,tlist);
does not work.
Any help is appreciated.
Additional, but less urgent:
Once this step is completed, I aim to have the conductivity tensor also non-constant in x and y, so that it has something resembling a normal distribution (smallest conductivity in the centre of Face 2 and parabolically tending towards equilibrium at the edges. If anyone has any ideas on how to tackle this, that would be great.
0 commentaires
Réponse acceptée
Alan Weiss
le 1 Fév 2019
Modifié(e) : Alan Weiss
le 1 Fév 2019
If I understand you correctly, you have a sequence of independent problems; the solution at one time t does not depend on or influence the solution at a different time.
As such, you do not have a time-dependent model. I believe that all you need to do is solve a set of time-independent models, where each model uses the same geometry but a different c coefficient. Solve the problems in a loop, something like
tspan = linspace(0,5,20); % 20 times from 0 through 5, just for example
for i = 1:length(tspan)
c2 = tspan(i)/(1 + tspan(i));
specifyCoefficients(model,'m',0,'d',0,'c',c2,'a',0,'f',0,'Face',2);
results{i} = solvepde(model);
end
As for your second question, I am not sure exactly what you need, but if you can write out the equations for your conductivity, then I would imagine that the c coefficient documentation would lead you to the correct formulation.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Eigenvalue Problems dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!