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

Setting patch field values equal to internal field values

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2014, 15:38
Default Setting patch field values equal to internal field values
  #1
Member
 
Vincent Leroy
Join Date: Jul 2012
Location: Rhode-Saint-Genèse, Belgium
Posts: 43
Rep Power: 13
leroyv is on a distinguished road
Dear foamers,

I am trying to set patch values of a given field equal to the corresponding internal field values. This shouldn't be too complicated, but it seems to be not as trivial as I would have expected.

Here is what I wrote (let's name our volScalarField 'myField'):

Code:
const fvPatchList & patches = mesh.boundary();
forAll(patches, iPatch)
{
    UList<scalar> myList(myField.boundaryField()[iPatch].patchInternalField());

    forAll(myField.boundaryField()[iPatch], iCell)
    {   
        myField.boundaryField()[iPatch][iCell] = myList[iCell];
    }
}
I end up with all patch values set as expected, except a few ones. I guess I must have done something wrong. Any ideas?
leroyv is offline   Reply With Quote

Old   October 21, 2014, 15:49
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

what's wrong with fixedInternalValue patch type? It does the thing this way:

Code:
template<class Type>
void Foam::fixedInternalValueFvPatchField<Type>::manipulateMatrix
(
    fvMatrix<Type>& matrix
)
{
    // Apply the patch internal field as a constraint in the matrix
    matrix.setValues(this->patch().faceCells(), this->patchInternalField());
}
alexeym is offline   Reply With Quote

Reply

Tags
boundary, internal field, patch field


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
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 15:33
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Interpolate internal field onto patch / boundary Jonas OpenFOAM Programming & Development 0 October 22, 2013 14:12
CheckMeshbs errors ivanyao OpenFOAM Running, Solving & CFD 2 March 11, 2009 02:34
[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 11:08.