CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Manually modifying boundary condition (https://www.cfd-online.com/Forums/openfoam/74264-manually-modifying-boundary-condition.html)

johndeas March 29, 2010 04:03

Manually modifying boundary condition
 
Hi,

I would like to change the value of a Dirichlet boundary condition at just one point. I already know the label of the face at which I would like the change (in the global numbering of faces).

I would like an overall idea of the logic of what to do: which classes, members function to use.

Thanks

johndeas April 5, 2010 16:16

Hi,

Based on the information provided on post http://www.cfd-online.com/Forums/ope...tml#post190696 , I used the following piece of code to fix the temperature at a specific point at the boundary:

Code:

vector locFace(0.2,0,0.02);

label patchID = mesh.boundaryMesh().findPatchID("down");
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];
const vectorField& FaceCentres = cPatch.faceCentres();

label T2Face=0;
scalar currDist=mag(FaceCentres[0] - locFace);   

forAll(FaceCentres,i) // in each proc, local loop over boundary faces of "inlet"
{
    if (mag(FaceCentres[i] - locFace) < currDist)
    {
        currDist = mag(FaceCentres[i] - locFace);
        T2Face = i;
    }
}

T.boundaryField()[patchID][T2Face]=350;

Now, I would like to use a fixedGradient condition, which value won't be set using T.boundaryField()[patchID][T2Face]. How can I fix the value of the gradient at a particular point ?

Thanks


All times are GMT -4. The time now is 17:25.