CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Notes for OpenFOAM!

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
Old

Gnuplot Vector Probes from the funtionObject

Posted June 9, 2012 at 15:27 by Hisham (Notes for OpenFOAM!)

When using the functionObject to probe a vector (e.g. velocity) at a location, the output is in the format:
Code:
# Time  vector
1.20   (2.14   8.512   1.005)
.
.
.
Unlike sampling or using probeLocations, until now AFAIK it is not possible to use U.component(0) to spit only the X-component. To resolve that using gnuplot, one can use:
Code:
plot 'probeFile' using "%lf (%lf %*lf %*lf)"
to plot the Ux component...
Hisham's Avatar
Senior Member
Posted in Uncategorized
Views 1045 Comments 3 Hisham is offline Edit Tags
Old

The directionMixed Boundary Condition

Posted June 7, 2012 at 10:53 by Hisham (Notes for OpenFOAM!)
Updated June 7, 2012 at 13:45 by Hisham

A mixed boundary condition is a combination of a fixedValue (Drichilet) and a fixedGradient (Neumann) boundaries determined by a fraction value. When fraction = 1, the BC is fixedValue and when it is set to zero the BC is fixedGradient. Values in between calculate a value in between (see code).

The directionMixed BC allows changing the fraction value for different directions. Assuming a plane-strain stress analysis that needs fixation in X-direction (Dx = 0) and free Y-direction...
Hisham's Avatar
Senior Member
Posted in Uncategorized
Views 507 Comments 0 Hisham is offline Edit Tags
Old

Set (Initial) Internal Fields Using #codeStream

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

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())
...
Hisham's Avatar
Senior Member
Posted in Uncategorized
Views 605 Comments 0 Hisham is offline Edit Tags
Old

codedFixedValue Boundary Condition

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

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]
...
Hisham's Avatar
Senior Member
Posted in Uncategorized
Views 851 Comments 0 Hisham is offline Edit Tags
Old

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
...
Hisham's Avatar
Senior Member
Posted in Uncategorized
Views 370 Comments 0 Hisham is offline Edit Tags

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