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

19 Ansichten (letzte 30 Tage)
Jaime Esteban
Jaime Esteban am 9 Mär. 2018
Kommentiert: alok dhaundiyal am 24 Nov. 2020
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])?

Antworten (3)

Ravi Kumar
Ravi Kumar am 12 Mär. 2018
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 Kommentar
Jaime Esteban
Jaime Esteban am 12 Mär. 2018
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?

Melden Sie sich an, um zu kommentieren.


Alan Weiss
Alan Weiss am 12 Mär. 2018
Perhaps some older documentation would help.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Kommentare
Jaime Esteban
Jaime Esteban am 13 Mär. 2018
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 am 24 Nov. 2020
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?

Melden Sie sich an, um zu kommentieren.


MarionJ
MarionJ am 19 Apr. 2018

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.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by