Register Blogs Members List Search Today's Posts Mark Forums Read

In this blog, quick reference notes about OpenFOAM are posted in a form of a summary to address a specific topic per post, which I think could be helpful as a reminder for my Alzheimer condition
1. ## Set (Initial) Internal Fields Using #codeStream

### set initial vector field

Hi Hisham,

I was interested to read this post of yours.

Here is how you do the same for a vector field: put the following in a file called "initialCondition" and then #include it in the file 0/U and set internalField as \$velocity. NB, it sets a Poiseuille profile for a parallel plate channel with the walls at +/- h/2.

=====

velocity #codeStream
{
code
#{
double h = 1;
double Umax = 0.5;
const IOdictionary& d = dynamicCast<const IOdictionary>(dict);
const objectRegistry& db = d.db();

volVectorField& fld =
const_cast<volVectorField&>(db.lookupObject<volVec torField>("U"));

const fvMesh& mesh = fld.mesh();

// to set a position-dependent value
forAll(mesh.C(), i)
{
double yloc = mesh.C()[i].y();
fld[i] = vector(Umax * (1.0 - pow(2.0 * yloc / h, 2)), 0.0, 0.0);
}
os << fld.internalField();
#};

codeInclude
#{
#include "fvCFD.H"
#};

codeOptions
#{
-I\$(LIB_SRC)/finiteVolume/lnInclude
#};
codeLibs
#{
-lfiniteVolume
#};
};

#inputMode merge

=====

Cheers,

Sam
Posted February 5, 2015 at 02:21 by SamMallinson
Updated February 24, 2015 at 19:25 by SamMallinson (Figured out how to do what I asked)
2. ## Gnuplot Vector Probes from the funtionObject

Quote:
Originally Posted by Hisham
Hi

I think it should be something like:
Code:
`plot 'File' using "%lf (%lf %*lf %*lf) (%*lf %*lf %*lf)"`
for plotting the X component of the first vector and so on!
Hello Hisham

Thank you very much for this helpful idea. I have one question: I want to plot the velocity vector compnonest(Ux , Uy and Uz) vs time for three points but there is small problem:
My case looks like this:
Time
1 (1 -4 4) (2 1 3) (0 1 7)
2 (1 -2 0) (1 3 6) (2 1 9)
...

I can plot (Ux1, Uy1, Uz1) and also (Ux2, Uy2, Uz2) ,or in other words datas till column 7, using plot 'File' using "%lf (%lf %*lf %*lf) (%*lf %*lf %*lf)"
BUT when I use 1:8 '%lf (%lf %lf %lf) (%lf %lf %lf) (%lf %lf %lf)' title 'Ux3' to plot the vlocity components of third point I get this ERROR:

"U3plot", line 6: Please use between 1 and 7 conversions, of type double (%lf)

Does anyone have any IDea???
Posted April 22, 2014 at 03:25 by jeicek
3. ## OpenFOAM Installation for Multiple Users

Thanks a lot Bruno. The post has been corrected
Posted March 10, 2013 at 10:48 by Hisham
4. ## OpenFOAM Installation for Multiple Users

Hi Hisham,

Nice blog post! I've been meaning to do a blog post similar to this one (actually, to write a wiki page on the topic), but I haven't found the time for it yet.
• The alias command you're mentioning:
Code:
`OFver=source /home/MrX/openfoamver/etc/bashrc`
Should in fact be:
Code:
`alias OFver='source /home/MrX/openfoamver/etc/bashrc'`
• The following links are for some of my posts on the topic of transferring a personal installation to a global installation:
Best regards,
Bruno
Posted March 10, 2013 at 08:14 by wyldckat
5. ## Gnuplot Vector Probes from the funtionObject

Quote:
Originally Posted by iznal
Hi Hisham
Thanks for your Post. Right now I got a Problem with plotting those vectors.

My file looks like:
# Time vector01 vector02 1.20 (2.14 8.512 1.005) (2.15 0.23 1.24))Could you please give me some tipps?
Hi

I think it should be something like:
Code:
`plot 'File' using "%lf (%lf %*lf %*lf) (%*lf %*lf %*lf)"`

for plotting the X component of the first vector and so on!
Posted September 4, 2012 at 09:01 by Hisham
6. ## Gnuplot Vector Probes from the funtionObject

Hi Hisham
Thanks for your Post. Right now I got a Problem with plotting those vectors.

My file looks like:
# Time vector01 vector02 1.20 (2.14 8.512 1.005) (2.15 0.23 1.24))Could you please give me some tipps?
Posted August 8, 2012 at 08:19 by iznal

All times are GMT -4. The time now is 23:25.