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

Transient boundary conditions

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 27, 2008, 13:25
Default Hi again, I am trying to under
  #81
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
Hi again, I am trying to understand how to specify phi, i took the liberty and choosing the structure of phi in Time.Running() catalogue, then changed wherever i found it suited, then it works fine during reading but stops later in,

error message: that "FvMesh" lack initiated phi variable, are the mesh movable?.

Now i am confused since the mesh indeed are movable and besides i am using dynamicFvMesh.H, my solver works fine apart the important fact the U field isnt correct with no-slip condition.

Anyone who have any idea for the reason of this, again, the settings on the patch is movingWallVelocity on the U, fixedValue on the cellDisplacement and calculated on pointDisplacement. The phi have calculated as well ( since the running.catalogue specified so ).

Best Regards

Johan
pi06jl6 is offline   Reply With Quote

Old   August 28, 2008, 09:10
Default Why does FvMesh::phi() complai
  #82
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
Why does FvMesh::phi() complain about that the mesh is not movable, when it actually move the mesh using update()? I am using above settings for U,celldisplacement and p. I have checked other codes, test printed the displacement field, the mesh is moving, however, while trying explicitly print out the U file on boundary it doesnt change at all. Anyone could shed some light into this matter? Thank you.
pi06jl6 is offline   Reply With Quote

Old   August 28, 2008, 11:02
Default The current score between FOAM
  #83
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
The current score between FOAM::error and me is 3 - 0, my latest test involves using motionU file with calculated option to trigger the change of the U.boundaryField().

If i am using movingWallVelocity, the solver complains about the Mesh::phi not created ( yes it is using createFields ), then asking wether the grid is movable ( yes it is cuz the points are moving) but the U field arent no-slip, instead set to ( 0 0 0) for stationary walls.

This gives 1-0 in score,

If i am changing the U in the automesh step which includes U.correctBoundaryConditions() in the update(), ( for this reason, i dont understand why repeat this call in icoDymFoam ), the changes are ignored due to the fixedValue type, despite the use of ==.

This gives 2-0 in score,

By porting the code of icoDymFoam into my code section, then the error repeats!

This gives 3-0 in score, and as a coach for this game i am doing Time out, for a tactic discussion, since the last score implicate error in the input files.

Anyone who can provide me with a working example? Btw i tried reading shipFoam but the links are broken. Get a *.unk file which i cannot read.

Best Regards

Johan
pi06jl6 is offline   Reply With Quote

Old   August 28, 2008, 13:02
Default Current score is 3-1, yes, you
  #84
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
Current score is 3-1, yes, you got it right,
pi06jl6 is offline   Reply With Quote

Old   August 29, 2008, 03:10
Default Thanks for the response Gavin!
  #85
New Member
 
Ken Mattsson
Join Date: Mar 2009
Posts: 7
Rep Power: 17
kenson70 is on a distinguished road
Thanks for the response Gavin!

Due to my limited knowledge of OpenFOAM I have not been able to resolve my issue with transient boundary conditions. I have analytic functions U(x,y,t), V(x,y,t) (and p(x,y,t)) for the velocity and pressure (although I will not need p if I specify dirichlet BC). I would like to use these functions to generate 1) the initial conditions (data) and 2) to impose the dirichlet boundary data at the boundaries (at runtime). What I'm aiming at is to meassure the accuracy of the incompressible solver (a grid-convergence study), when having transient (non-constant along the boundary) boundary conditions, using an analytic 2-D solution.

I should say that I will update the entire boundary (all patches) with the same analytic data (I will treat all 4 boundaries the same way, there is no specific inlet or outlet, as a matter of fact there will be both inflow and outflow on all boundaries).


I'm greatful for any comments on this, especially from people who have used this approach of using analytic functions to specify initial and boundary data directly in the code. I'm even more greatful for as much details as possible (due to my limited knowledge at this stage).

Best regards Ken
kenson70 is offline   Reply With Quote

Old   September 5, 2008, 05:30
Default I have checked the forum for s
  #86
New Member
 
Ken Mattsson
Join Date: Mar 2009
Posts: 7
Rep Power: 17
kenson70 is on a distinguished road
I have checked the forum for some insight on how to set time and space dependent boundaryconditions using a function (i.e., not a list). Gavin sent me this reply:

I often think the easiest (although not the most elegant) way of doing this is just to set the boundary to be fixedValue and then grab the data and modify it inside the code. Thus, you can get the patch face centre points thus:

vectorField inletFaceCentres(mesh.C().boundaryField()[patchNo]);

and the X, Y and Z components of the velocity as

scalarField UInletX(U.boundaryField()[patchNo].component(vector::X));
scalarField UInletY(U.boundaryField()[patchNo].component(vector::Y));
scalarField UInletZ(U.boundaryField()[patchNo].component(vector::Z));

You can then manipulate the values in these scalarFields (the ordering is the same), and then replace them

U.boundaryField()[patchNo].replace(vector::X,UInletX);
---------------------

This seems to be a nice solution. But can someone tell me how to set the values of UInletX and UInletY. I know the velocity field as a function (x,y,t). I have checked the funkySetFields approach, but that is only for time-independent data (unfortunately). I assume that yopu have to loop over all boundary points and set them pointwise using my function expression (and then I need to find the corresponding x,y values at the bounadry, and I'm not sure how to do that). You have to excuse me for my limited knowledge!

Best regards Ken
kenson70 is offline   Reply With Quote

Old   September 9, 2008, 11:13
Default Hello to everybody, I'm a new
  #87
New Member
 
Veronica Ricciardi
Join Date: Mar 2009
Posts: 1
Rep Power: 0
veronica_ricciardi is on a distinguished road
Hello to everybody,
I'm a new user of OpenFOAM 1.4.1.
I'm trying to simulate a compressible flow in a chocked nozzle with sonicFoam.
In order to simulate a fluctuation over the mean flow, I'm using the timeVaryingUniformFixedValue for the p, U, T fields.
But when I run the simulation the solver gives me this error:

Exec : sonicFoam . case1Bis
Date : Sep 09 2008
Time : 15:21:31
Host : vega
PID : 1174
Root : /home/cluster/OpenFOAM/cluster-1.4.1/run/tutorials/sonicFoam
Case : case1Bis
Nprocs : 1
Create time

Create mesh for time = 0

Reading thermodynamicProperties

Reading transportProperties

Reading field p

Reading field T

Calculating field e from T

Reading field U

Reading/calculating face flux field phi


Starting time loop

Time = 0.0001

Courant Number mean: 0 max: 0.686527
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 6.92725e-17, No Iterations 1
DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 3.97853e-17, No Iterations 1
DILUPBiCG: Solving for Uz, Initial residual = 1, Final residual = 1.77402e-16, No Iterations 1


--> FOAM FATAL IO ERROR : file "" does not exist

file: at line 1.

From function IFstream::operator()
in file db/IOstreams/Fstreams/IFstream.C at line 171.

FOAM exiting

I'm quite sure that the solver is correctly reading the input files for the b.c., and the error seems to be confined to the T field, as if I change the T b.c to fixedValue and the other fields to timeVarying everything works fine.
Could anyone explain me what's happening?
Thank you in advance.
veronica_ricciardi is offline   Reply With Quote

Old   September 10, 2008, 10:32
Default Hi, I have got exactly the
  #88
New Member
 
Soeren Brot
Join Date: Mar 2009
Posts: 3
Rep Power: 17
soeren_brot is on a distinguished road
Hi,

I have got exactly the same problem as many others here, for example as Ken.
I just want to implement a BC which I would like to specify as U=(u,v)=f(x,y,t) (it is 2-dimensional). I am able to set the f(x,y) (not time-varying) BC and I am able to use the timeVaryingUniformFixedValue BC to set it as an f(t) BC (but only one value on the complete patch).
Is there an easy way to do this (f(x,y,t)) or should I derive my own BC for this case? If there is no other way than deriving a new BC, is there anywhere a detailed Wiki or a tutorial how to do that? I did not find anything like that anywhere in the web, and I have been looking for it for at least two weeks...

Thanks a lot in advance

Sören
soeren_brot is offline   Reply With Quote

Old   September 11, 2008, 04:54
Default Ken, Soeren, I've dug out s
  #89
Senior Member
 
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17
grtabor is on a distinguished road
Ken, Soeren,

I've dug out some more of the code I use to do this;

// get hold of the inlet face centre vectors
vectorField inletFaceCentres(mesh.C().boundaryField()[patchNo]);

// and the y and z coordinates (the inlet plane here is a yz plane)
scalarField inletY(inletFaceCentres.component(vector::Y));
scalarField inletZ(inletFaceCentres.component(vector::Z));


for (int i=0; i<inletFieldSize; i++)
{
scalar Ypos(inletY[i]-1.0);
scalar Ymag(inletY[i]);
//double Zmag(inletZ[i]);
if (Ymag>LY) Ymag = 2.0*LY-Ymag;
scalar shape = Foam::pow((Ymag/LY),(1.0/7.0));//shape of the mean profile

UInletX[i] = maxSpeedX*(shape + uxSeries.uprime(Ypos));
UInletY[i] = maxSpeedY*(uySeries.uprime(Ypos));
UInletZ[i] = maxSpeedZ*(uzSeries.uprime(Ypos));
}

U.boundaryField()[patchNo].replace(vector::X,UInletX);
U.boundaryField()[patchNo].replace(vector::Y,UInletY);
U.boundaryField()[patchNo].replace(vector::Z,UInletZ);


The bit inside the loop sets the values of the X, Y and Z components of the velocity for each cell. If you have a time-dependent function you could implement it here (runTime.time() should get you this). The .replace() function reinserts the field into the boundaryField.

Please note I wrote this bit of code a while back - the exact syntax might have changed, but the general idea is OK I think - and easier than writing a fresh bc (which would be based on this anyway).

Gavin
grtabor is offline   Reply With Quote

Old   September 24, 2008, 05:56
Default Thanks Gavin, I have tried
  #90
New Member
 
Ken Mattsson
Join Date: Mar 2009
Posts: 7
Rep Power: 17
kenson70 is on a distinguished road
Thanks Gavin,

I have tried to follow your suggestion. I have made a copy of icoFoam.C and put it into custom_utils directory. I have renamed it (to icoTaylorFoam.C)and made corrections to the Make directory.

This is what I add (in the time-loop):
for (runTime++; !runTime.end(); runTime++)
{
Info<< "Time = " << runTime.timeName() << nl << endl;

# include "readPISOControls.H"
# include "CourantNo.H"
double pi=3.14;

label patchID = mesh.boundaryMesh().findPatchID("Taylor");
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];
vectorField inletFaceCentres(mesh.C().boundaryField()[patchID]);
scalarField inletY(inletFaceCentres.component(vector::Y));
scalarField inletX(inletFaceCentres.component(vector::X));
forAll(cPatch, faceI)
{
vector faceU(vector::zero);
scalar Ypos(inletY[faceI]);
scalar Xpos(inletX[faceI]);

faceU.x() = sqrt(Ypos*pi);

U.boundaryField()[patchID][faceI] = faceU;
}

However, I get an error message when I type wmake (concerning the usage of various standard-functions, such as: cos, sqrt, ...) (there are a few characters that does not come out correct below):

Making dependency list for source file icoTaylorFoam.C
SOURCE=icoTaylorFoam.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I/home/kmn/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/kmn/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/kmn/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/icoTaylorFoam.o
icoTaylorFoam.C: In function â&euro;&tilde;int main(int, char**)â&euro;&trade;:
icoTaylorFoam.C:74: error: call of overloaded â&euro;&tilde;sqrt(Foam::scalar)â&euro;&trade; is ambiguous
/usr/include/bits/mathcalls.h:157: note: candidates are: double sqrt(double)
/home/kmn/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedScalar.H:65: note: Foam::dimensionedScalar Foam::sqrt(const Foam::dimensionedScalar&)
/home/kmn/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:217: note: Foam::doubleScalar Foam::sqrt(Foam::doubleScalar)
/home/kmn/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:217: note: Foam::floatScalar Foam::sqrt(Foam::floatScalar)
icoTaylorFoam.C:72: warning: unused variable â&euro;&tilde;Xposâ&euro;&trade;
make: *** [Make/linux64GccDPOpt/icoTaylorFoam.o] Error 1


I can not understand the cause of this. What am I missing here? cos and sqrt are after all defined for scalars!?

Best regards Ken
kenson70 is offline   Reply With Quote

Old   September 24, 2008, 06:30
Default Hi Ken. OF reimplements cer
  #91
Senior Member
 
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17
grtabor is on a distinguished road
Hi Ken.

OF reimplements certain functions such as sqrt which are already available from the standard C++ libraries. It also allows conversion from OF classes such as Scalar to standard types such as double. Thus when you ask for

sqrt(q)

where q is a scalar, the compiler has two possible options:

1. use the OF sqrt operator on this scalar, or
2. convert q to a double, then use the usual sqrt operator

The compiler can't make this decision for you, so it yelps! What you need to do is something like

Foam::sqrt(q)

which specifies the use of the sqrt function from the Foam namespace.

Gavin
grtabor is offline   Reply With Quote

Old   September 24, 2008, 07:24
Default Thanks Gavin, that solved it!
  #92
New Member
 
Ken Mattsson
Join Date: Mar 2009
Posts: 7
Rep Power: 17
kenson70 is on a distinguished road
Thanks Gavin, that solved it!

What I really would like to implement is a time- and space-dependent boundary condition using the analytic Tylor-vortex problem. In order to do this numerically correct i need to specify velocity (U) when there is inflow and use zero gradient on pressure (p) when there is outflow (there will be both inflow and outflow along the boundary). For that I would like to 'simulate' the inletOutlet boundary condition.

(By using FunkySetFields and the inletOulet boundary condition I have manage to run the Taylor-vortex case, and chosing a parameter setting yielding a steady-state solution. But now I would like to do the timedependent setting and then FunkySetFields does not work)

I specify p to have a zeroGradient in the startup file for p (in the 0 directory), for U I will use fixedValue. I'm doing a long-shoot here where my first attempt will be to just set the velocity components (like I currently do in the timeloop), but only when there is inflow. But I guess that will not inforce zero pressure gradient for the cases when there is outflow!?

If you know how to do this properly within this setting I will be very greatful. I'm going to take a 2-day course in OpenFoam (in October), hopefully I will be better equiped after that. My C++ is not up to date.

Best regards Ken
kenson70 is offline   Reply With Quote

Old   October 14, 2008, 09:30
Default Gavin or anybody, How do I
  #93
New Member
 
Ken Mattsson
Join Date: Mar 2009
Posts: 7
Rep Power: 17
kenson70 is on a distinguished road
Gavin or anybody,

How do I get hold of the actual value of time inside the code, and use that value in a mathematical expression like cos(t), where t is time. If you print out runTime.timeName() it will print the actual value. Gavin, you said that runTime.time() would get you that, but that is not true. Say I would like to compute cos(t). How would I do that?

Best regards Ken
kenson70 is offline   Reply With Quote

Old   October 14, 2008, 10:23
Default Using the value of the dimensi
  #94
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Using the value of the dimensioned scalar should work - ie, runTime.value()
If you are using engineTime, you might look at using runTime.theta()
olesen is offline   Reply With Quote

Old   October 22, 2008, 11:08
Default Hi, I'd like to know how to
  #95
New Member
 
Jordi Fradera
Join Date: Mar 2009
Posts: 1
Rep Power: 0
jordiff is on a distinguished road
Hi,

I'd like to know how to convert a Foam::GeometricField<double> to just a simple double in order to use it in fuctions like modf().

I'm trying to use the c++ modf(), but there is a type error when I try to compile. double modf(double,&double) but the arguments I'm calculating are dimensioned scalar fields, so ::modf() gives a type error.

As far as I know functions like sqrt() have already implemented in OF, but what about ceil,floor,trunc and modf?

Thanks in advance.
mm.abdollahzadeh likes this.
jordiff is offline   Reply With Quote

Old   January 16, 2009, 16:44
Default Hi All, I am using coupled
  #96
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Hi All,

I am using coupled Transport equations... I would like to add flux boundary condition at the walls of my geometry (which is square channel).

This is the equation i would like to add...

-D1*grad(C1) - K1*C1*grad(Phi) = 0
-D1*grad(C2) - K1*C2*grad(Phi) = 0

where C1 C2 and Phi are concentrations and potential respectively which I have obtained from solving my transport equation and poison equation (for Phi)...These equations are coupled...

I solved them using simple boundary conditions but I would like to solve them using the above mentioned flux boundary condition.. can anyone help me out with regard to this...

Thanks

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   January 21, 2009, 21:39
Default Hello, I am interested in a
  #97
New Member
 
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17
prjohnston is on a distinguished road
Hello,

I am interested in applying a transient velocity boundary condition of the form w(x,y,t) = f(x,y)*g(t) in the z=0 plane. In my example f(x,y) is a paraboloidal velocity field for which I wrote the following piece of code:

void paraboloidalVelocityFvPatchVectorField::updateCoef fs()
{
// Get range and orientation
boundBox bb(patch().patch().localPoints(), false);

vector ctr = 0.5*(bb.max() + bb.min());

const vectorField& c = patch().Cf();

// Calculate local 2-D coordinate for the paraboloidal profile
scalarField coordx = 2*((c - ctr) & x_)/((bb.max() - bb.min()) & x_);
scalarField coordy = 2*((c - ctr) & y_)/((bb.max() - bb.min()) & y_);

vectorField::operator=(n_*maxValue_*(1.0 - sqr(coordx) - sqr(coordy)));
}

(based heavily on the setParabolicInlet code previously mentioned).

For my application g(t) is based on data from an input file which I have used successfully with timeVaryingUniformFixedValue, from which the updateCoeffs() code is:

template<class>
void Foam::timeVaryingUniformFixedValueFvPatchField<typ e>::updateCoeffs()
{
if (this->updated())
{
return;
}

fvPatchField<type>::operator==
(
timeSeries_(this->db().time().timeOutputValue())
);
fixedValueFvPatchField<type>::updateCoeffs();
}

My question is: is there some neat way to merge these two ideas together to create a new boundary condition type?

Thank you, any insights would be much appreciated.

Peter.
prjohnston is offline   Reply With Quote

Old   February 9, 2009, 12:55
Default Hello All, I am new to Open
  #98
Member
 
Gautami Erukulla
Join Date: Mar 2009
Posts: 71
Rep Power: 17
gautami is on a distinguished road
Hello All,

I am new to OpenFOAM software.I have installed OpenFOAM-1.5 on suse linux 10.3.

I am trying to implement velocity transient boundary condition at the inlet using interFoam solver.

The initial field is defined as (/0/U):

inlet
{
type timeVaryingUniformFixedValue;
timeDataFileName "inlet.dat";
value uniform 1e5;
}

When I run interFoam I get the following error.

Reading environmentalProperties
Reading field pd

Reading field gamma

Reading field U



keyword outOfBounds is undefined in dictionary "/home/gali/OpenFOAM/gali-1.5/run/tutorials/interFoam/transientsb/0/U::inlet"

file: /home/gali/OpenFOAM/gali-1.5/run/tutorials/interFoam/transientsb/0/U::inlet from line 26 to line 28.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 213.

FOAM exiting

Can someone please help me out.

Thank You,
Gautami.
gautami is offline   Reply With Quote

Old   March 4, 2009, 18:33
Default Hi All, I have a simple re
  #99
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 208
Rep Power: 18
nandiganavishal is on a distinguished road
Hi All,

I have a simple rectangular geometry and I would like to incorporate boundary conditions at the outlet for one of the variables as

Phi = A *sin(wt)

where w = 2*pi*f
A - Amplitude
f - frequency of the AC electric field and t - time

Can anyone give some insight on how to incorporate such a boundary condition..

Thanks

Regards

Vishal
nandiganavishal is offline   Reply With Quote

Old   March 5, 2009, 03:39
Default Hi Vishal Search the forum
  #100
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Vishal

Search the forum for groovyBC. It will definitely do the trick (though I haven't used it before myself).

Best regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Reply


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
Transient boundary conditions Dave FLUENT 5 October 30, 2011 08:58
Transient boundary conditions in CFX Sohail Ahmed CFX 2 December 11, 2007 13:01
Transient boundary conditions Yannick FLUENT 6 November 6, 2007 07:47
Transient Boundary Conditions James Date CFX 5 September 13, 2004 11:34


All times are GMT -4. The time now is 13:29.