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

1 次查看(过去 30 天)
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