Create a 2D functional

Numerical methods and mathematical models of Elmer
Post Reply
Andrea_P
Posts: 176
Joined: 22 Mar 2021, 18:39
Antispam: Yes
Location: POLYTHECNIC UNIVERSITY OF TURIN

Create a 2D functional

Post by Andrea_P »

Hi,
Is there a way for Elmer to create a 2D functional? I explain my case with a simple example. I have three functions: V, B,h

Code: Select all

B=3y^2 +1
h=4y+6
V=cosh(Bh)+sinh(x)
I know that I must use the notation tx, but in this case, how can I specify the functions B and h before calling V?
it's just an example, they aren't my real functions. Thanks in advance for your help.
Kind regards,
Andrea
POLYTECHNIC UNIVERSITY OF TURIN-DIMEAS
DGEckold
Posts: 10
Joined: 10 May 2021, 18:09
Antispam: Yes

Re: Create a 2D functional

Post by DGEckold »

In MATC?

You can refer to other defined MATC functions in your MATC.

Code: Select all

$ function B(y) { _B = 3*y+1 }
$ function h(y) { _h = 4*y+6 }
$ function V(x,y) { _V = cosh(B(y)*h(y)) + sinh(x) }
....
Boundary Condition
....
	var = Variable Coodinate 1, Coordinate 2
		Real MATC " V( tx(0), tx(1) ) "
....
End

Andrea_P
Posts: 176
Joined: 22 Mar 2021, 18:39
Antispam: Yes
Location: POLYTHECNIC UNIVERSITY OF TURIN

Re: Create a 2D functional

Post by Andrea_P »

DGEckold wrote: 06 Aug 2021, 17:55 In MATC?

You can refer to other defined MATC functions in your MATC.

Code: Select all

$ function B(y) { _B = 3*y+1 }
$ function h(y) { _h = 4*y+6 }
$ function V(x,y) { _V = cosh(B(y)*h(y)) + sinh(x) }
....
Boundary Condition
....
	var = Variable Coodinate 1, Coordinate 2
		Real MATC " V( tx(0), tx(1) ) "
....
End

Thanks for your answer. I try right now
POLYTECHNIC UNIVERSITY OF TURIN-DIMEAS
Andrea_P
Posts: 176
Joined: 22 Mar 2021, 18:39
Antispam: Yes
Location: POLYTHECNIC UNIVERSITY OF TURIN

Re: Create a 2D functional

Post by Andrea_P »

DGEckold wrote: 06 Aug 2021, 17:55 In MATC?

You can refer to other defined MATC functions in your MATC.

Code: Select all

$ function B(y) { _B = 3*y+1 }
$ function h(y) { _h = 4*y+6 }
$ function V(x,y) { _V = cosh(B(y)*h(y)) + sinh(x) }
....
Boundary Condition
....
	var = Variable Coodinate 1, Coordinate 2
		Real MATC " V( tx(0), tx(1) ) "
....
End

there is this error message

Code: Select all


Solver input file error: MATC ERROR: Function not created [B], identifier in use.

...offending input line:  function B(y) { _B =  3*y+3}
I attach my case.sif
Attachments
case.sif
(6.83 KiB) Downloaded 127 times
POLYTECHNIC UNIVERSITY OF TURIN-DIMEAS
DGEckold
Posts: 10
Joined: 10 May 2021, 18:09
Antispam: Yes

Re: Create a 2D functional

Post by DGEckold »

You already have B defined on line 22

Code: Select all

$ B= 0.5 ! tesla
Post Reply