Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Setting a piecewise variable CoefficientFunction

More
4 years 7 months ago - 4 years 7 months ago #1752 by P. Sh
Hi,
I have a question about setting a piecewise variable CoefficientFunction. I know that it is possible for piecewise constant coefficients as follows:


" domain_values = {'inner': 3.7, 'outer': 1}
values_list = [domain_values[mat]
for mat in mesh.GetMaterials()]
cf = CoefficientFunction(values_list)
Draw(cf, mesh, 'piecewise') "


But I don't know that this way works for piecewise variable coefficients. Is it possible?
I was wondering if someone would possibly share his/her knowledge with me in this regard. Thanks.

Best,
Danial
Last edit: 4 years 7 months ago by P. Sh.
More
4 years 7 months ago #1753 by Guosheng Fu
Hi Danial,

I think you can simply change the first line as
domain_values = {'inner': fun1, 'outer': fun2}
where fun1 and fun2 are two coefficient functions.

Best,
Guosheng
More
4 years 7 months ago #1754 by P. Sh
Hi Guosheng,

Thank you very much for your quick reply and your helpful answer.

Best,
Danial
Time to create page: 0.146 seconds