Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Inserting array in comsol model struct
Posted Dec 20, 2012, 3:33 p.m. EST 0 Replies
Please login with a confirmed email address before reporting spam
I wanted to solve 2D Poisson's equation in a structure and for this, I need to update position dependent concentration array/matrix (rho) in the model. What is the syntax of using external function/inserting processed matrix in comsol field?
I know the process for 1D problem. For example, to insert a position dependent array in the field " equ.f " of Poisson solver model (classical PDE>Poisson's equation), I use the following syntax:
equ.f = {{'getRho(x)'}};
Here, getRho(x) is a user defined external matlab function whose work is just to interpolate the data in finite element space.
for example: the user defined function getRho(x) definition:
--------------------------------------------------------------------
function y=getRho(x)
% Load device information: 'zi' is finite difference grid points and 'rho' is the array of values at those points
load device 'zi' 'rho'
% Interpolating for FEM space and returning
y=interp1(zi,rho,x,'nearest');
----------------------------------------------------------------------
As a result, the position dependent processed concentration data are fed to comsol field: equ.f.
I want a similar process of inserting 2D position dependent concentration data into the field: equ.f.
Can someone please help me?
Hello Rizvi Ahmed
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.