# Entries for April 2012

 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

## Set (Initial) Internal Fields Using #codeStream

Posted April 23, 2012 at 13:55 by Hisham (Notes for OpenFOAM!)
Tags

To set up (initial) internal fields of variables according to an expression, one can use the #codeStream feature as:
Code:
```internalField  #codeStream
{
code
#{
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
const fvMesh& mesh = refCast<const fvMesh>(d.db());
scalarField fld(mesh.nCells(), 12.34);// uniform value of the field as 12.34 or just fld(mesh.nCells())```
...
Senior Member
Posted in Uncategorized

## codedFixedValue Boundary Condition

Posted April 11, 2012 at 16:57 by Hisham (Notes for OpenFOAM!)
Tags

This is an example of using codedFixedValue boundary condition to input expressions that are time and position dependent.

Code:
```    PatchName
{
type               codedFixedValue;
value              uniform (0 0 0); //\$internalField;
redirectType    BC_Given_Name;
code
#{
fixedValueFvPatchVectorField myPatch (*this);
forAll(myPatch, celli)
{
myPatch[celli]```
...
Senior Member
Posted in Uncategorized

## Cyclic (Periodic) Boundary Condition

Posted April 11, 2012 at 16:57 by Hisham (Notes for OpenFOAM!)
Updated April 12, 2012 at 06:12 by Hisham

OF V.2.x
Cyclic (periodic) boundary condition is used to model repetitive geometries by joining two patches as if they were physically attached to each other!
The "simplest" way to apply a cyclic BC is to have two patches that are identical and define them in the ./constant/polyMesh/boundary as:
Code:
``` RightPatch
{
type            cyclic;
nFaces          49;
startFace       9506;
neighbourPatch```
...
Senior Member
Posted in Uncategorized