ABOUT READING A FILE STORING MATERIAL PARAMETERS DISTRIBUTION

50 views
Skip to first unread message

孙翔

unread,
May 8, 2020, 12:25:01 AM5/8/20
to deal.II User Group
Hi, I am using Dealii to do FE analysis. I have a .txt file which stores a permeability distribution in the z-direction as follows

z                 value
0                 0.1
1                 0.3
2                 0.5
3                 0.2
4                 0.8
5                 0.4
6                 0.7
7                 0.5
8                 0.6
......

Does Dealii have a function to read it into the code and apply the distribution in the model? Maybe, there is an interpolation function that can help me get the value at quadrature points. if there is no such a function, can I get the real coordinate at the quadrature point? I can wirte my own interpolation function to get the coefficient at the quadrature point. Thank you very much.

Best,

Xiang  

Wolfgang Bangerth

unread,
May 8, 2020, 9:03:04 AM5/8/20
to dea...@googlegroups.com
Xiang,
there is the InterpolatedTensorProductGridData that can do the interpolation
for you. It's meant for arbitrary dimensions, but of course also works in 1d.
But there are then two pieces missing that you need to provide yourself:

* You need to read the data into the arrays with which you create objects of
the class mentioned above.

* You will create an object of that type with dim==1. In your code, you will ask
fe_values.quadrature_point(q)
to get the coordinates of the q'th quadrature point, of which you will then
only use the last coordinate value to call the 1d function.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

孙翔

unread,
May 8, 2020, 5:10:51 PM5/8/20
to deal.II User Group
Hi, Wolfgang,

Thank you very much.

Best,
Xiang
Reply all
Reply to author
Forward
0 new messages