CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   varied vector component boundary conditions (http://www.cfd-online.com/Forums/openfoam/79236-varied-vector-component-boundary-conditions.html)

ziemowitzima August 17, 2010 13:22

varied vector component boundary conditions
 
Hello,
Does anyone know if there is already a defined boundary conditions for vectors which allows you to assign different types/values for each vector component? For example:
Suppose vector U=(u,v,w), I would need to define:
du/dn=const
dv/dn=0
but
w=0

Thanks for ur help
ZM

rezahemmat1985 March 5, 2012 04:51

hi dear
 
hi dear
as we know the temperature of of engine cylinder temperature is different in each point and it is difficult to set a temperature to each point . I have got an Abacus CAD file of the studying engine and it includes the temperature values in each point . I wamma to know how can I set temperature to each point . for example for point (1,4,0) T1=100'C , (3,0,2) T2=102'C , ..... tnx in advance
tnx dear
i will appreciate alot I need your experience

calim_cfd March 5, 2012 06:32

hello!

reza, i guess your looking for sth like this

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    location    "100";
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 1 0 0 0];

internalField  nonuniform List<scalar>
4000
(
350.064
350.062
350.065
350.071
350.071
350.071
350.076
350.076
350.073
...
);

thats for the volume value.. for patches is the same...
Code:

ceiling
    {
        type            externalWallHeatFluxTemperature;
        refValue        uniform 0;
        refGradient    nonuniform List<scalar>
400
(
12337.1
16255.5
17486.6
18193.3
20460.2
21914.4
23840.9
27023.1
29589.5
...
);

you only need to know the ordering rules in OpenFOAM and i guess you're done !

hope it helps!

ziemowitzima March 5, 2012 11:35

Hi,
But what do you mean exactly ?
Boundary Condition or some function (source term) ?
There is several way to do this.
I personally opt for modifying the original source code. There is easy way to set BC and any value or functions you want in the source code and the re-compile it again.
Some example is here:

/////////////added to chancge bc (in time, in space)
label inletPatchID = mesh.boundaryMesh().findPatchID("in");
const fvsPatchVectorField& centre = mesh.Cf().boundaryField()[inletPatchID];
const fvsPatchVectorField& normal = mesh.Sf().boundaryField()[inletPatchID];
fvPatchVectorField& uu = U.boundaryField()[inletPatchID];

deltaT=runTime.deltaT().value();
t=t+deltaT;

forAll(uu,faceI){
nx=normal[faceI].component(0);
ny=normal[faceI].component(1);
nz=normal[faceI].component(2);
magg=Foam::sqrt(nx*nx+ny*ny+nz*nz);
nx=nx/magg;ny=ny/magg;nz=nz/magg;
if (centre[faceI].component(2)>0.08){
uu[faceI].component(0)=-nx*(Foam::sin(2*3.14159*1.333*t)+0.3)*tt[faceI];
uu[faceI].component(1)=-ny*(Foam::sin(2*3.14159*1.333*t)+0.3)*tt[faceI];
uu[faceI].component(2)=-nz*(Foam::sin(2*3.14159*1.333*t)+0.3)*tt[faceI];
}
}

//////////END

This code make your BC on the patch "in" time and space dependent.
tt -- is some function of space.

In general you can read any data to your openFoam variables, the same way as you would do in C or C++.

But of course, there are some already done procedures in OF to do this, just check more carefully all examples which come with OF installation.

-Best
ZM


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