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

codedFixedValue Boundary Condition

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.
Rate this Entry

codedFixedValue Boundary Condition

Posted April 11, 2012 at 17:57 by Hisham

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] = (this->db().time().value()/*TIME*/ * this->patch().Cf()[celli]/*centers of patch faces (for x-value use  this->patch().Cf()[celli][0])*/ );
	       }
	    operator==(myPatch); 
	#}; 
    }
Posted in Uncategorized
Views 4194 Comments 1 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    vsammartano's Avatar
    Dear Hisham,
    thank you for your little template. I would ask you something. If I need to use inside the code block a constant from a file how can I proceed? I tried different ways, but any of these have had good results.
    Do you have any idea to perform this?
    Thank you in advance,
    Vincenzo

    PS:
    Here an example:

    #include "<fileIncludingVariables>"
    boundaryField
    {
    PatchName
    {
    type codedFixedValue;
    value uniform (0 0 0); //$internalField;
    redirectType BC_Given_Name;
    code
    #{
    fixedValueFvPatchVectorField myPatch (*this);
    forAll(myPatch, celli)
    {
    myPatch[celli] = $amplitude*(this->db().time().value()/*TIME*/ * this->patch().Cf()[celli]/*centers of patch faces (for x-value use this->patch().Cf()[celli][0])*/ );
    }
    operator==(myPatch);
    #};
    }
    .
    .
    .
    .
    .
    }
    permalink
    Posted July 5, 2017 at 08:11 by vsammartano vsammartano is offline
 

All times are GMT -4. The time now is 08:15.