|
[Sponsors] |
Setting initial fields using a data file for positions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 9, 2013, 00:21 |
Setting initial fields using a data file for positions
|
#1 |
Member
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 13 |
Hi,
So I'm currently trying to set the initial conditions on my temperature and/or alpha1 fields using funkySetFields. The case is 2D (or at least, empty on the back and front) and is basically split horizontally in the middle, with a step function for alpha1, and possibly temperature if I try and use it (I have a modified interFoam solver that seems to be working) I want to perturb my interface based on a summation of cos waves at different wavenumbers. I have funkySetFields working if I want to use something like Code:
{ variables "Curve=cos ((2*pos().x*pi*1)/(max(pos().x)-min(pos().x)));"; field alpha1; condition "((pos().y - ((((max(pos().y)-min(pos().y))/2.0)+min(pos().y)) - 0.005*Curve)) < 0) I wrote a c++ program to sum up the effects of multiple wavenumbers, giving me a position for each value of x that OpenFoam will ask for (although I don't know how many decimal places that OF uses...), then tried to use those as variables - I have since realised this is likely flawed from the get-go since I would need funkySetFields to read in the pos().x variable, and then after that check for variables to substitute. Having decided that approach is unlikely to work, I now am trying to see if I can in some way write out my data to be interpreted as a vector, and index my vector by cell location. My thoughts are something like (for a 600 cell wide computational volume/area) datafile: Code:
defaultVariables ( "value[0 (or 1?)]=1.234;" "value[1]=1.252;" "value[2]=...;" "value[599 (or 600?)] = 1.102;" ); Code:
header... #include "../valuesfile" expressions ( sectiontobechanged { variables $defaultVariables; field alpha1; condition "((pos().y - value[(pos().x*600)]) < 0"; expression "1"; } ); If anyone knows of a way I could make this work, or alternatively, has some better implementation, please let me know Christian |
|
Tags |
funkysetfields, initial conditions, initialisation, openfoam 2.2, swak4foam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 02:22 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
Unstabil Simulation with chtMultiRegionFoam | mbay101 | OpenFOAM Running, Solving & CFD | 13 | December 28, 2013 14:12 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |