Page 1 of 1

import boundary condition

Posted: 12 May 2011, 10:09
by razor
Dear All,

I'm looking for a solution to import a boundary condition into Elmer, e.g. a pressure distribution, calculated in Octave.
Is there any possibility to do this? I'm using Elmer 6.2 under Windows.

Kind regards,
razor

Re: import boundary condition

Posted: 30 May 2011, 19:28
by raback
Hi

You could try saving the profile, e.g. for pressure, to a [x,y] ascii file, say profile.dat. Then you can use this is ElmerSolver Input File (*.sif file) by the following syntax

Code: Select all

External Pressure = Variable Coordinate 1
  Real 
    include profile.dat
  End 
This applies to all real valued boundary condition definitions. Here "Coordinate 1" refers to the 1st coordinate which is x, 2 is y and 3 is z. Hope this helps. Note that x should be monotonically growing in the file profile.dat. If this kind of simple 1d lookup table doesn't work then importing may be more difficult.

-Peter

Re: import boundary condition

Posted: 31 Jan 2014, 05:05
by Hal
Hey,

I realize this thread is really old, but I'm having trouble implementing the solution. Could I see an example line from an acceptable .dat file to write? Every time I run this, I get "At line 1349 of file ModelDescription.f90
Fortran runtime error: Bad real number in item 0 of list input", which makes me think something is wrong for the .dat file. Do I actually need to include brackets, and is it csv or tab delimeted? Should I write "1" or "1.0" or "1.00000000E+000"?

Thanks!

Re: import boundary condition

Posted: 31 Jan 2014, 09:42
by raback
HI, the talble should be just two columns of numbers separated by empty space (blancos, not tabs). -Peter

Re: import boundary condition

Posted: 04 Feb 2014, 04:39
by Hal
Thanks, it works!

Re: import boundary condition

Posted: 18 Feb 2014, 13:01
by tetraeder
Hi,

does it also works with 4 column tables? For example the first 3 columns contain x y and z coordinates and the 4. the value.

I have tried to do it this way

Code: Select all

  Temp = Variable Coordinate 1, Coordinate 2, Coordinate 3
  Real
    include InterfaceTemperature.dat
  End
But unfortunately elmer uses just the 2. column for the value.

The file looks as follows:

Code: Select all

  1.610726743950E-002  1.101451605330E-002  8.500000000000E-002  1.651263048466E+002
  1.692164574290E-002  1.229013327310E-002  8.500000000000E-002  1.651076522925E+002
  1.609047916440E-002  1.184654450670E-002  8.500000000000E-002  1.650885177115E+002
  1.523116229860E-002  1.145130676930E-002  8.500000000000E-002  1.650789519459E+002
  1.608369408280E-002  1.017610525350E-002  8.500000000000E-002  1.651466357616E+002
  1.522820863990E-002  1.061403029870E-002  8.500000000000E-002  1.651031371611E+002
  1.697736968150E-002  1.143793901680E-002  8.500000000000E-002  1.651397393005E+002
  1.782964671100E-002  1.196998634970E-002  8.500000000000E-002  1.651221016186E+002
  1.697318269210E-002  1.055925721270E-002  8.500000000000E-002  1.651580707618E+002
  1.691509164930E-002  9.692438778420E-003  8.500000000000E-002  1.651800387649E+002
  1.768681378140E-002  1.302730872060E-002  8.500000000000E-002  1.650816542641E+002
  1.673836090940E-002  1.303592753760E-002  8.500000000000E-002  1.650770076339E+002
  1.603065613020E-002  1.265976243920E-002  8.500000000000E-002  1.650569911832E+002
  1.521803228570E-002  1.228657211950E-002  8.500000000000E-002  1.650667489113E+002
  1.435837699100E-002  1.189707905690E-002  8.500000000000E-002  1.650418746296E+002
  1.435740360350E-002  1.104635196370E-002  8.500000000000E-002  1.650519616482E+002
  1.347801440830E-002  1.148062751840E-002  8.500000000000E-002  1.649769152466E+002
  1.259591037230E-002  1.191871653500E-002  8.500000000000E-002  1.649182538844E+002
  1.172744066130E-002  1.237018046480E-002  8.500000000000E-002  1.648099160710E+002
  1.672844395800E-002  8.918727284020E-003  8.500000000000E-002  1.651964823625E+002
  1.601682428910E-002  9.340510412680E-003  8.500000000000E-002  1.651744177489E+002
  1.520660275660E-002  9.764108891680E-003  8.500000000000E-002  1.651155227909E+002
  1.435495402440E-002  1.018778774550E-002  8.500000000000E-002  1.650738667022E+002
Or is the problem, that it contains two spaces as separator?

Re: import boundary condition

Posted: 18 Feb 2014, 13:06
by raback
Hi

The dependence table must only have two columns (x,y). What would be the logic when having more columns? If you define values for one line in 3D space that does not provide suffient information for arbitrary coordinates.

-Peter

Re: import boundary condition

Posted: 18 Feb 2014, 13:10
by tetraeder
Ah okay i understand. Thanks.

And what if the coordinates represent existing nodes? Is there way to use the node id's?

Re: import boundary condition

Posted: 18 Feb 2014, 14:11
by raback
Hi

There is a way to directly set BCs so certain nodes using "Target Nodes" instead of "Target Boundaries". However, if you have multiple & variable values it is not the smoothest strategy.

You could also write a small UDF where you would at the 1st instance load the [nodeind,value] table and thereafter just return the correct value for given node. However, if the [coord,value] dependence works for you I would not bother.

Now the problem with the dependence of type [coord,value] is that it might not always be a bijection. For example, given a circular boundary there is no unique dependence on x or y. Then you could create an additional variable, such as the angle, which has some other problems though. If this is the case maybe the UDF would be ok after all.

-Peter

Re: import boundary condition

Posted: 18 Feb 2014, 20:38
by tetraeder
Hi,

thank you. Using the UDF worked.