CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Snippet for redefining fixedGradient boundary condition for a patch inside solver

Register Blogs Community New Posts Updated Threads Search

Like Tree12Likes

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 3, 2017, 18:36
Default Snippet for redefining fixedGradient boundary condition for a patch inside solver
  #1
Senior Member
 
Bobby
Join Date: Oct 2012
Location: Michigan
Posts: 454
Rep Power: 15
babakflame is on a distinguished road
Dear Fellows

I want to redifine fixedGradient boundary condition for a specified patch inside my source code. i.e. whenever the code sees "fixedGradient" in 0/cPlus file (cPlus is a volScalarField and a dependent variable)

My snippet now looks like:

Code:
const polyPatchList& patches = mesh.boundaryMesh();
   forAll (patches,patchI){
     
      if(cPlus.boundaryField()[patchI].type() == 'fixedGradient'){


           fixedGradientPatchField& fgPatchField
         (
          refCast<fixedGradientPatchField>(cPlus.boundaryField()[patchI])
         );
          fgPatchField.gradient() = fvc::snGrad(cPlus) + cPlus * fvc::snGrad(Ue);
       }
    }
In above snippet, I want to tell the code that whenever it saw "fixedGradient" for a patch inside 0/cPlus file calculate the following relation at the boundary surface and assign it as boundary condition:

\frac{d c^+}{d n} + c^+ \frac{d \varphi}{d n} in which c^+ & \varphi are dependent scalar variables that should be calculated at the boundary patch from previous time step.

However the code compilation returns this error:

Code:
createFields.H:501:3: error: ‘fgPatchField’ was not declared in this scope
In file included from interFoamEHDIon.C:79:0:
My first question is How should I declare fgPatchField ? since I tried volScalarField or volVectorField but did not work. Moreover it does not accept fvc::snGrad. Should I try fvc::reconstruct(snGrad(cPlus))?


The second error is:
Code:
createFields.H:532:12: error: ‘fixedGradientFvPatchVectorField’ was not declared in this scope

createFields.H:533:74: error: no matching function for call to ‘refCast(Foam::fvPatchField<Foam::Vector<double> >&)’
By the way, My OpenFoam version is 2.1.x

Last edited by babakflame; March 4, 2017 at 17:17.
babakflame is offline   Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
Problem with cyclic boundaries in Openfoam 1.5 fs82 OpenFOAM 36 January 7, 2015 00:31
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
[blockMesh] Cyclic BC's: Possible face ordering problem? (Channel flow) sega OpenFOAM Meshing & Mesh Conversion 3 September 28, 2010 12:46
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 08:19


All times are GMT -4. The time now is 02:24.