필터 지우기
필터 지우기

Doubts on specifying 2-D "c" coefficients in Function Form

조회 수: 2 (최근 30일)
Jaime Esteban
Jaime Esteban 2018년 3월 9일
댓글: alok dhaundiyal 2020년 11월 24일
Matlab help seems a bit confusing to me. At the "Specify 2-D Scalar Coefficients in Function Form" page it says:
================
A coefficient in function form for 2-D geometry has the syntax coeff = coeffunction(p,t,u,time)
coeff represents any coefficient: c, a, f, or d.
Your program evaluates the return coeff as a row vector of the function values at the centroids of the triangles t.
=================
However, coefficient "c" is a 2x2 tensor.
How can I define the "c" tensor value at each centroid and return it as a row vector? Is the use of the Function Form restricted to scalar "c" values (i.e., a scalar value "c" is provided and computation is carried out with the matrix [c 0;0 c])?

답변 (3개)

Ravi Kumar
Ravi Kumar 2018년 3월 12일
You might be referring to the old workflow. Please refer to the "Functional Form" section of this documentation page, which gives an example to specify non-scalar (tensor) c-coefficient.
Also, Solve Problems Using PDEModel Objects document page shows the new workflow to solve using a model object.
  댓글 수: 1
Jaime Esteban
Jaime Esteban 2018년 3월 12일
Yes, I do refer to the old workflow. In fact I need to use the old workflow, since I need to be able to modify the mesh points and I cannot do it with the new workflow (model.Mesh.Nodes is a read-only property).
Your suggested documentation requires the use of a pde 'model' and, thus, the inability to modify the mesh. Then, the question remains open: how should I specify the "c" coefficient in Function Form when using the old workflow?

댓글을 달려면 로그인하십시오.


Alan Weiss
Alan Weiss 2018년 3월 12일
Perhaps some older documentation would help.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 2
Jaime Esteban
Jaime Esteban 2018년 3월 13일
I am afraid that the documentation you pointed to is no much more detailed. But I close with the idea of searching old documentation. Thanks.
alok dhaundiyal
alok dhaundiyal 2020년 11월 24일
Mr Alan, will it automatically assume 't' as time? Since in the main script, tlist is defined as a time. What is the difference between f = 'framp(t)' and f = framp(t)? Upon execution of function, the value of f would be 'char'. Is it correct?

댓글을 달려면 로그인하십시오.


MarionJ
MarionJ 2018년 4월 19일

I have exactly the same Problem with the mesh. And I do not understand why Matlab unabled the possibility to refine the mesh for specific subdomains in the new workflow. However there seems to exist a Workaround, which I have not tried yet, but planned to do so: https://de.mathworks.com/matlabcentral/answers/346410-is-there-a-way-to-import-2d-meshes-nodes-and-triangles-into-pde-model-objects

Concerning your question:

You specify your coefficient in the function form by

coeff = sprintf('Coeffunc(u)');

When solving, the solver enters this function e.g.

u = parabolic(u0,tList,b,p,e,t,c,a,f,d);

The function has the form:

function coeff=Coeffunc(u)

You can give the mesh to the function or you declare the mesh global and call the mesh by global p,e,t. Than you have to calculate the positions of the centroids of the triangles. For each centroid you can define the values. The values are scalar, but the function is not only called once by the solver, so the values can change with time or anything. The Output coeff is than the value of the coefficient at each centroid.

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by