Read in boundary conditions from other program

Numerical methods and mathematical models of Elmer
Post Reply
michiw
Posts: 7
Joined: 02 Mar 2011, 11:43
Antispam: Yes

Read in boundary conditions from other program

Post by michiw »

Hi,

I want to read in BC from an other program and want to use the interpolation feature.

I know that a variable can be declacred like this

Code: Select all

 Heat Flux = Variable Coordinate 1
  Real
    1.2 288.0
    3.4 303.0
  End 
and the values gets interpolated on the boundary mesh. Theses values I want to read in from a file generated by the other program and maybe scalled by elmer with a constant factor. Is this possible?

Or is it possible to include a SIF file into another, then I could write the BC from the other program?

Thanks
Michael
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Read in boundary conditions from other program

Post by mzenker »

Hi,

if there is no way to include an external file in the sif file (which I don't know), my first attempt would be to try to process the sif-file with a tool like (g)awk which would read the output from your BC calculation program and write it into the sif file.

HTH,

Matthias
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Read in boundary conditions from other program

Post by raback »

Try with

Code: Select all

Heat Flux = Variable Coordinate 1
  Real
    include myxydep.dat
  End 
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Read in boundary conditions from other program

Post by mzenker »

Oops, sorry, I forgot that one...
michiw
Posts: 7
Joined: 02 Mar 2011, 11:43
Antispam: Yes

Re: Read in boundary conditions from other program

Post by michiw »

Thank you for the fast reply!!!

the "include" statement solve me a lot of work!

Michael
michiw
Posts: 7
Joined: 02 Mar 2011, 11:43
Antispam: Yes

Re: Read in boundary conditions from other program

Post by michiw »

The interpolation along a boundary seems to be not correct in every case.

I have set a temperature BC like this:

Code: Select all

Boundary Condition 12
  Target Boundaries(1) = 53
  Name = "feed_temp"
Temperature = Variable Coordinate 2
Real
0.037760 847.650862
0.013508 1094.183737
0.006900 1211.000000
End
  Noslip wall BC = True
End
Everything is okay.

If I use much more points (a temperature value for every lattice point) in between the three given in the example I get a wrong calculation result. The temperature around the point where 1211K is set has then a temperature of around 1300K. Everything else is the same in the simulation. All boundaries have a Dirichlet condition.

Is it a problem if every mesh point of a boundary is set to a temperature? It seems as.

By the way is it possible to use the node number as variable instead of Coordinate 2?

Thanks,
Michael

P.S. I'm using an axi-symmetric case
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Read in boundary conditions from other program

Post by raback »

Hi

I doubt that there is no bug since this feature has been used extensively over the years. However, note that when you give [x,y] dependence the values in x should be monotonically growing. Othewise you end up doing an extrapolation from the first value - which for some linear cases may give reasonable results.

-Peter
michiw
Posts: 7
Joined: 02 Mar 2011, 11:43
Antispam: Yes

Re: Read in boundary conditions from other program

Post by michiw »

Hi Peter,

yes it work!!! It need to be monotonically growing, I thought it only needs to be monotonically :oops:

By the way where can I find which variables are available? Is there something like the node number available ?

I tried

Code: Select all

 
Temperature = Variable # 
Real
 123 1211.
 ...
End
and

Code: Select all

 
Temperature = Variable 
Real
 123 1211.
 ...
End
which are both accepted by the solver, but does not give me the expected results. At least the first one (#=NodeNumber).

Thanks,
Michael
raback
Site Admin
Posts: 4832
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Read in boundary conditions from other program

Post by raback »

Hi

Available variables for expressions are all the fields that you've solved for and Coordinate i, i=1,2,3 (i.e. x,y,z). Additionally some scalar variables such as time, timestep size, nonlin iter, coupled iter, etc. are available. Node number is not available. In User Defined Functions the node number is one of the input paramaters so there it is directly available.

-Peter
Post Reply