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

User defined bc

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2006, 09:28
Default Hi, I've written an applica
  #1
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi,

I've written an application ("vprofil") which defines a 3D velocity profile for an inlet patch (or at least I hope it will turn out like that).

The application is situated in: ~OpenFOAM/Anja-1.2/applications/vprofil

I've also created a new case in FoamX and have already choosen the solver I want to use.

Afterwards I've typed:
vprofil <root> <case>

But the error message is:
vprofil cannot open root directory


Can someone please help me?
Thanks
Anja
anja is offline   Reply With Quote

Old   March 29, 2006, 11:30
Default What where your concrete value
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
What where your concrete values for root and case. I mean: do they exist? (usually root is ".": that should exist)
I would guess that the problem is a typo with the root-directory.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 30, 2006, 06:30
Default Hi, and now the error meass
  #3
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi,

and now the error meassage is:
keyword inlet is undefined in dictionary ..../run/test/sbogen1/0/U::boundaryField

But I thought this would be done automatically with my application for the velocity profil??
anja is offline   Reply With Quote

Old   March 30, 2006, 08:01
Default What this means is: your appli
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
What this means is: your application is trying to access a patch named "inlet" but in mesh there is no such patch. Check the file sbogen1/0/U and the files sbogen1/constant/polyMesh/boundary

My guess (but I can't tell without looking at the code) is that in your application the patch name "inlet" is hardcoded while in the mesh the patch that should be the inlet has another name ("einlasz" ?)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 30, 2006, 08:12
Default The problem is more, that I do
  #5
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
The problem is more, that I don't what to write in /0/U to define a velocity for the inlet, because I want it to come from the application.

If I just fill out something in /0/U like:
inlet
{ type fixedValue;
value uniform (0 0 0); }

I can reach a next problem:
FOAM FATAL ERROR : LHS and RHS of - have different dimensions
dimensions : [0 1 0 0 0 0 0] - [0 0 0 0 0 0 0]
anja is offline   Reply With Quote

Old   March 30, 2006, 10:06
Default OK. I assume that the 0/U file
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
OK. I assume that the 0/U file wasn't in tune with the boundary file.

The second problem is (I'm extrapolating this from the C()-discussion in another thread) that somewhere in the program you try to subract from a value with the dimension [m] a value with dimension [1]. Propably this happens during the calculation involving the face/cell-Centers (which have dimension [m]) and a scalar (which is I think converted to a dimensioned scalar [1]).

Try using the .value()-method for the dimensioned value (or give the non-dimensioned value a dimension)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 30, 2006, 13:01
Default Hi again, but I still have
  #7
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi again,

but I still have the first mentioned problem. What do I have to do so that the application for my velocity profil is taken into acount?

Thanks Bernhard, you really help me alot!
Anja
anja is offline   Reply With Quote

Old   March 30, 2006, 20:26
Default Short answer: if your utility
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Short answer: if your utility changes the velocity profile in the initial time step and the boundary condition is "fixed value", then you're in business.

Your vproile-application sets a value for every face in inlet (I hope). So instead of something like "uniform (0,0,1)" there is a whole list of values in the 0/U file (for the inlet). The solver starts with these values, and because it is a fixedValue-BC doesn't see no reason to change these values (and should therefor happily keep calculating with your profile).
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 31, 2006, 08:00
Default Hello All! I want to set up t
  #9
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Hello All!
I want to set up transient boundary conditions which values are calculated and based on the solution (velocities field) from previous time step. Is the "calculated" bc type a good choice and how exactly use it?
Thank you for any information!
ziemowitzima is offline   Reply With Quote

Old   March 31, 2006, 08:02
Default But the utility does not chang
  #10
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
But the utility does not change the velocity in the initial time step it seems.

I do have:
the application "vprofil"
started a new case in FoamX
already choosen the solver "simpleFoam" for that

But how can I actually use my utility??
With that: vprofil <profil><case> [-parallel]
it says this is one command too much??
anja is offline   Reply With Quote

Old   March 31, 2006, 08:14
Default Anja: a) Which time-step doe
  #11
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Anja:
a) Which time-step does the utility say it is reading?
b) if it is the initial time-step, are you actually writing the modified velocity field?
c) if you are writing: there is still the possibilty of a bug in your calculation (I can't help you with that, but "Info <<" for outputing intermediate results is your friend)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 31, 2006, 08:22
Default What I'm doing is: vprofil
  #12
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
What I'm doing is: vprofil <root> case

but then it says:
keyword inlet is undefined in dictionary ..../0/U::boundary field
(but this I do not want to fill out, because this should be the velocity profil coming from the application "vprofil", the whole list of values you were talking about)
anja is offline   Reply With Quote

Old   March 31, 2006, 10:54
Default You'll have too, because OpenF
  #13
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
You'll have too, because OpenFOAM needs that information to create the field (but fixedValue/uniform is sufficient) to make it possible to manipulate it. After your utility ran it will be something fixedValue/non-uniform.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 31, 2006, 12:06
Default Thanks, very nice to know.
  #14
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Thanks, very nice to know.

But now about the dimension problem. I've tried to change my velocity profile, and can't compile it any more.
Could you please check the source code??

Here it is:
#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"

int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "initContinuityErrs.H"

Info<< "\nStarting time loop\n" << endl;

// Change bc:

// Get index of patch
label inletPatchID = mesh.boundaryMesh().findPatchID("inlet");
// Get reference to boundary field value
fvPatchVectorField& inletu = U.boundaryField()[inletPatchID];
// get coordinate for cell centres
const fvPatchVectorField& centre = mesh.C().boundaryField()[inletPatchID];

scalarField x = centre.component(vector::X);
scalarField y = centre.component(vector::Y);
scalarField z = centre.component(vector::Z);

scalar n_1 = 0.159159;
scalar n_2 = -0.030791;

dimensionedScalar a
(
"a",
dimensionSet(0, -1, -1, 0, 0, 0, 0),
scalar(0.826871257),
);

dimensionedScalar s
(
"s",
dimensionSet(0, 1, -1, 0, 0, 0, 0),
scalar(4),
);

vector Cp = vector::zero;

dimensionedScalar d
(
"d",
dimensionSet(0, 1, 0, 0, 0, 0, 0),
scalarField(mag(mesh.C() - Cp)),
);

scalarField Ux = sqrt((s-d*d*a)*(s-d*d*a)/(n_1*n_1 + n_2*n_2))* n_1;
scalarField Uy = sqrt((s-d*d*a)*(s-d*d*a)/(n_1*n_1 + n_2*n_2))* n_2;
scalar Uz = 0.0;

inletu = vector(Ux, Uy, Uz);

U.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n\n" << endl;


Info<< "End\n" << endl;

return(0);
}

and here are the error messages:

(concerning last line of each dimensionSet)
error: expected primary-expression before ')' token

(concerning line for Ux)
error: conversion from 'Foam::dimensionedScalar' to non-scalar type 'Foam::Field<foam::scalar>' requested

(concerning line inletu= )
error: no matching function for call to 'Foam::Vector<foam::scalar>::Vector(Foam::scalarFi eld&, Foam::scalarField&, Foam::scalar&)'


Bernhard, I hope you keep answering

Thanks alot
Anja
anja is offline   Reply With Quote

Old   April 3, 2006, 09:26
Default - first error message: think a
  #15
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
- first error message: think about the third ',' and whether it is necessary?

- second error: I'm amazed it didn't fail at the construction of d (using a field to construct a scalar)

- third error: I wouldn't do it like this, but by doing
scalarField &Ux=inletu.component(0);
Ux= .... ;
(but I'm not sure whether this works (references to component ..). Usually I do these calculations for every face separatly: Drop me a mail and I'll send you a copy of an old program of mine that does something similar)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 5, 2006, 08:07
Default Hi, okay, I've channged my
  #16
Member
 
Anja Stretz
Join Date: Mar 2009
Posts: 92
Rep Power: 17
anja is on a distinguished road
Hi,

okay, I've channged my application so far that I can compile it.
And also the command: vprofil <root> <case> does not bring an error message.
"vprofil" is in the folder ...OpenFOAM/Anja-1.2/applications/vprofil and the calculation is in...OpenFOAM/Anja-1.2/run/test

But still the values in .../0/U were not changed!
How come??

Anja
anja is offline   Reply With Quote

Old   June 21, 2007, 11:00
Default hello, I am trying to write
  #17
mayank
Guest
 
Posts: n/a
hello,

I am trying to write a code for inlet radial velocity for multiple inlets on the face of cylinder.
when i use the following command to write to file:
inletu[facei] = vector(0,vely,velz);

i get the following error:
vprofile.C: In function 'int main(int, char**)':
vprofile.C:136: error: no matching function for call to 'Foam::Vector<double>::Vector(int, Foam::dimensionedScalar&, Foam::dimensionedScalar&)'
/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude/VectorI.H:60: note: candidates are: Foam::Vector<cmpt>::Vector(Foam::Istream&) [with Cmpt = double]
/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude/VectorI.H:50: note: Foam::Vector<cmpt>::Vector(const Cmpt&, const Cmpt&, const Cmpt&) [with Cmpt = double]
/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude/VectorI.H:42: note: Foam::Vector<cmpt>::Vector(const Foam::VectorSpace<foam::vector<cmpt>, Cmpt, 3>&) [with Cmpt = double]
/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude/VectorI.H:36: note: Foam::Vector<cmpt>::Vector() [with Cmpt = double]
/home/mgo/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude/Vector.H:62: note: Foam::Vector<double>::Vector(const Foam::Vector<double>&)
make: *** [Make/linux64Gcc4DPOpt/vprofile.o] Error 1


The solution proposed by Bernhard also doesnt work as i'm using dimensionedscalar to define Ux and Uy .This is necessary for using cos and sin functions on velocity.


How to write the components of U to the file. But when i only print the components output is visible.
I need some urgent help.

Thanks.
  Reply With Quote

Old   June 21, 2007, 13:34
Default try inletu = vector(0,vely.va
  #18
Member
 
rafal zietara
Join Date: Mar 2009
Location: Manchester, UK
Posts: 60
Rep Power: 17
rafal is on a distinguished road
try
inletu[facei] = vector(0,vely.value(),velz.value());
hope that helps,
rafal
rafal is offline   Reply With Quote

Old   June 22, 2007, 06:32
Default hello rafal, thanks for you
  #19
mayank
Guest
 
Posts: n/a
hello rafal,

thanks for your suggestion.it worked but i still have one more query. Values of vely,velz seem to be correct when i print the values . But i am not able to write these values to the file 0/U on the desired inlet patch. I tried U.write() after including <fstream> but it just clears out the mesh and i again have to set all the initial values in FoamX.

mayank
  Reply With Quote

Old   June 22, 2007, 08:31
Default hello all, i got the soluti
  #20
mayank
Guest
 
Posts: n/a
hello all,

i got the solution.basically i was placing U.write() in the wrong place.It has to be written after all the loops.


mayank
  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
User defined function hari FLUENT 0 October 9, 2007 04:24
User-Defined Fan Socrate FLUENT 0 March 28, 2007 11:25
User Defined GUI Frederik FLUENT 0 June 23, 2006 17:12
user defined viscosity solomon FLUENT 0 July 13, 2003 22:09
User Defined Scalar Sebeci FLUENT 0 April 9, 2003 02:51


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