Page 1 of 1
MATC expression in 2D array definition
Posted: 09 Mar 2018, 12:26
by wmiller
I like to have the elastic coefficients to be temperature dependent,
i.e Youngs modulus (4,4) should to be set with temperature dependent coefficients.
I tried
Youngs modulus (4,4) = Variable Temperature
Real MATC " 1.19e11 " MATC " 2.18e10 " MATC " 1.81e10 " MATC " 0 " \
MATC " 2.18e10 " MATC " 1.15e11 " MATC " 2.18e10 " MATC " 0 " \
MATC " 1.81e10 " MATC " 2.18e10 " MATC " 1.19e11 " MATC " 0 " \
MATC " 0 " MATC " 0 " MATC " 0 " MATC " 4.55e10 "
as a simple test (later I want to use tx in the expression)
but when updating I got the error
Solver input file error: MATC ERROR: Undeclared identifier: [matc].
...offending input line: 1.19e11 matc 2.18e10 matc 1.81e10 matc 0 matc 2.18e10 matc 1.15e11 matc 2.18e10 matc 0 matc 1.81e10 matc 2.18
Is there a workaround ?
Wolfram
Re: MATC expression in 2D array definition
Posted: 09 Mar 2018, 13:44
by mzenker
Hi,
you don't need MATC just for a table. This should work:
Code: Select all
Youngs modulus
size 4 4
Real 1.19e11 2.18e10 1.81e10 0 \
2.18e10 1.15e11 2.18e10 0 \
1.81e10 2.18e10 1.19e11 0 \
0 0 0 4.55e10 \
End
The MATC keyword needs to be written only once, like in
Code: Select all
myvar = Variable Temperature
Real MATC "5.67e-8 * tx^4"; End
For details see the MATC manual, e.g. chapter 2 for array syntax...
HTH,
Matthias
Re: MATC expression in 2D array definition
Posted: 09 Mar 2018, 14:01
by wmiller
this was only the first trivial test case.
In principle I like to have something like
Code: Select all
Youngs modulus (4,4) = Variable Temperature
Real MATC " 1.19e11-1.7e7*tx " MATC " 2.18e10-1.1e7*tx " MATC " 1.81e10-1.1e6*tx " MATC " 0 " \
MATC " 2.18e10-1.1e7*tx " MATC " 1.15e11/5e6*tx " MATC " 2.18e10-1.1e7*tx " MATC " 0 " \
MATC " 1.81e10-1.1e6*tx " MATC " 2.18e10-1.7e7*tx " MATC " 1.19e11-1.7e7*tx " MATC " 0 " \
MATC " 0 " MATC " 0 " MATC " 0 " MATC " 4.55e10-5e-6*tx "
Or is it possible to create the vector in MATC and MATC is returning the vector (or matrix) ?
Wolfram
Re: MATC expression in 2D array definition
Posted: 09 Mar 2018, 16:01
by raback
Hi Wolfram
As it happens I had some similar needs and created 4 test cases for unisotropic heat conductivity: constant, MATC, table, UDF. See the test cases HeatUniso* at devel branch since three minutes.
-Peter
Re: MATC expression in 2D array definition
Posted: 10 Mar 2018, 12:43
by annier
Hi Wolfram,
You can also observe a MATC expression written to describe the variation of anisotropic thermal conductivity with coordinate (variable)
at
https://github.com/anilkunwar/elmerfem/ ... oKthml.sif.
Code: Select all
...
$function test(x) {z=0.0;k=34.2;o=0.01; _test= k z (k*o*x(1)/(x(0)*x(0)+x(1)*x(1)+0.0000005)) z k (-k*o*x(0)/(x(0)*x(0)+x(1)*x(1)+0.0000005)) (k*o*x(1)/(x(0)*x(0)+x(1)*x(1)+0.0000005)) (-k*o*x(0)/(x(0)*x(0)+x(1)*x(1)+0.0000005)) (k*(1.0+o*o/(x(0)*x(0)+x(1)*x(1)+0.0000005))) }
! Use a non-zero very small number (0.0000005) to prevent numerical instability of division by zero when x = 0 and y = 0.
Material 1
...
Heat conductivity(3,3) = Variable Coordinate 1, Coordinate 2
Real MATC "test(tx)"
...
End
The mathematical equation is described as Eq. 12 in
https://www.sciencedirect.com/science/a ... 9517309354.
The solver input file is similar to the example:
https://github.com/ElmerCSC/elmerfem/bl ... C/case.sif quoted by Peter , with the addition of function to describe the MATC expressions that are longer than 128 characters.
Peter, I would like to thank you for uploading the examples of UDF, Table and Constants.
https://github.com/ElmerCSC/elmerfem/bl ... o/case.sif
https://github.com/ElmerCSC/elmerfem/bl ... e/case.sif
https://github.com/ElmerCSC/elmerfem/bl ... F/case.sif
Yours Sincerely,
Anil Kunwar
Re: MATC expression in 2D array definition
Posted: 17 Aug 2018, 11:55
by wmiller
Thank's Anil.
The following works
Code: Select all
$function elastconst(x) {_elastconst = (1.36e11-1.65e7*x) (2.80e10-6.20e6*x) (2.43e10-6.20e6*x) 0 \
(2.80e10-6.20e6*x) (1.32e11-1.70e7*x) (2.80e10-6.20e6*x) 0 \
(2.43e10-6.20e6*x) (2.80e10-6.20e6*x) (1.36e11-1.65e7*x) 0 \
0 0 0 (5.22e10-5.40e6*x) }
......
Youngs modulus (4,4) = Variable Temperature
MATC "elastconst(tx)"