Hi, I am trying to sketch the domain for PDE solver. It is similar to the example function CIRCLEFUNCTION.m.
My domain has four edges. Left and right edges are parallel to the y-axis. Top and bottom edges are curves:
I have following so far:
________________________
function [x,y]= dom(bs,s)
if nargin = = 0
x=4;
end
if nargin = = 1
A=[ 0, 1, 1, 0 ;
1, 1, 0 , 0 ;
1, 1, 1, 1 ;
0, 0, 0, 0]
I don't know where to go from there. I read examples online, but they are complicated.
You could choose curves connecting top vertices and bottom vertices to be simple quadratic curves, vertices are (0,0), (1,0), (1,1), (0,1).
Thank you!
Sandy

2 件のコメント

darova
darova 2020 年 3 月 21 日
Can you make a simple drawing of the geometry?
Sarinthree Udchachone
Sarinthree Udchachone 2020 年 3 月 21 日

サインインしてコメントする。

 採用された回答

darova
darova 2020 年 3 月 21 日

0 投票

Try pdepoly
x = 0:0.1:1;
y = x.^2-x+1;
x = [0 x 1];
y = [0 y 0];
pdepoly(x,y)

9 件のコメント

Sarinthree Udchachone
Sarinthree Udchachone 2020 年 3 月 21 日
Thank you! It solves the problem of drawing, but since i change the method I am not sure how to add the mesh to it. Could you help with it if possible?
Thank you so much!
~Sandy
darova
darova 2020 年 3 月 21 日
Can you attach your project/code?
Sarinthree Udchachone
Sarinthree Udchachone 2020 年 3 月 21 日
This code is from Matlab page, how would I be able to add the geometry using pdepoly instead of "torus.stl"
importGeometry(model,'Torus.stl');
applyBoundaryCondition(model,'dirichlet','face',1,'u',0);
specifyCoefficients(model,'m',0,...
'd',0,...
'c',1,...
'a',0,...
'f',1);
Thank you!
~Sandy
darova
darova 2020 年 3 月 21 日
編集済み: darova 2020 年 3 月 21 日
Sorry, i don't understand where is the problem. Can't you just import your geometry and run this script?
Sarinthree Udchachone
Sarinthree Udchachone 2020 年 3 月 22 日
I know that the label for pdepoly is P1 by default, but I can not add mesh or include it to importGeometry(?,?). My code is iterative, so one time plot isn’t going to save me. The only issue for now is how to refer to pdepoly in creating the mesh and use it to solve some pde. If I could see it in an example that would definitely help.
Sorry for bothering! Thank you! ~Sandy
darova
darova 2020 年 3 月 22 日
Can you make a simple drawing? How should the result look like?
Sarinthree Udchachone
Sarinthree Udchachone 2020 年 3 月 22 日
Thanks a lot for your suggestions. It works well.
~Sandy
darova
darova 2020 年 3 月 22 日
What about this?
x= 0:0.1:1;
y= x.^2-x+1;
x=[0 x 1];
y=[0 y 0];
pdepoly(x,y);
pdetool('initmesh')
% pdetool('refine')
darova
darova 2020 年 3 月 22 日
Maybe it would be helpful
x= 0:0.1:1;
y= x.^2-x+1;
x=[0 x 1];
y=[0 y 0];
gd = [2;length(x);x(:);y(:)]; % geometry description matrix
dl = decsg(gd); % decompose matrix
[p,e,t] = initmesh(dl); % create mesh
subplot(121)
pdemesh(p,e,t)
axis equal
subplot(122)
[p1,e1,t1] = refinemesh(dl,p,e,t);
pdemesh(p1,e1,t1)
axis equal

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by