|
[Sponsors] |
July 26, 2013, 10:39 |
Time-varying boundary condition
|
#1 |
New Member
Yuri Frey
Join Date: Jul 2013
Posts: 13
Rep Power: 13 |
Hello!
I am a new OpenFoam user and I am trying to set up a case with time-dependent boundary condition for velocity. In the tutorial I found something but it's not working.. In the "0" folder I wrote the file "U" for velocity specifying the inlet condition : inlet {type uniformFixedValue; uniformValue table ( (0 0) (2.0 1.0) ) } I thought this was the way to say I have a uniform inlet profile which goes from 0 m/s to 1 m/s between time t=0 and t=2, but when I start icoFoam this is what I get: --> FOAM FATAL IO ERROR: Expected a '(' while reading VectorSpace<Form, Cmpt, nCmpt>, found on line 49 the label 0 file: /home/yurifrey/Scrivania/tesi/aorta/0/U.boundaryField.inlet.uniformValue at line 49. From function Istream::readBegin(const char*) in file db/IOstreams/IOstreams/Istream.C at line 94. FOAM exiting Wish someone can help me, thank you very much, Yuri |
|
July 26, 2013, 10:49 |
|
#2 |
Senior Member
|
Velocity is a vector so table should contain vectors (1 0 0). You put there scalars, and it is the reason for OpenFOAM to complain.
Table should be something like: {type uniformFixedValue; uniformValue table ( (0 (0 0 0)) (2.0 (1.0 0 0)) ) } |
|
July 26, 2013, 11:00 |
|
#3 |
New Member
Yuri Frey
Join Date: Jul 2013
Posts: 13
Rep Power: 13 |
Thank you very much!
|
|
July 27, 2013, 06:20 |
|
#4 |
New Member
Yuri Frey
Join Date: Jul 2013
Posts: 13
Rep Power: 13 |
Just another little question.. What if I want the velocity to be directed normal to the boundary, instead of giving the components of the vector? I tried
{type surfaceNormalFixedValue; refValue uniform table ( (0 0) (2 -1) ); } but it's not working.. Thank you again! Yuri |
|
July 27, 2013, 08:51 |
|
#5 |
Senior Member
|
AFAIK uniformFixedValue BCs are implemented only for limited types of boundary conditions (http://www.openfoam.org/version2.1.0...conditions.php).
Though it is rather simple to implement your own boundary condition. For example you can change surfaceNormalFixedValue. Instead of Code:
class surfaceNormalFixedValueFvPatchVectorField : public fixedValueFvPatchVectorField { // Private data scalarField refValue_; Code:
class surfaceNormalUniformFixedValueFvPatchVectorField : public fixedValueFvPatchVectorField { // Private data autoPtr<DataEntry<Type> > refValue_; |
|
October 5, 2014, 22:28 |
|
#6 |
Senior Member
|
Hello
I need varying BC for interstitialInletVelocity which can be found in DPMFoam/Goldschemidt. Using table for fixed value: Code:
bottom { type uniformFixedValue; uniformValue table ( (0 (0 0 1)) (0.001 (0 0 2)) (0.002 (0 0 3)) (0.003 (0 0 4)) ); } The default is: Code:
bottom { type interstitialInletVelocity; inletVelocity uniform (0 0 1); value uniform (0 0 1); phi phi.air; alpha alpha.air; } Code:
bottomSB { type interstitialInletVelocity; inletVelocity uniformFixedValue; uniformValue table ( (0 (0 0 1)) (0.001 (0 0 2)) (0.002 (0 0 3)) (0.003 (0 0 4)) ); value table ( (0 (0 0 1)) (0.001 (0 0 2)) (0.002 (0 0 3)) (0.003 (0 0 4)) ); phi phi.air; alpha alpha.air; } Code:
--> FOAM FATAL IO ERROR: expected keyword 'uniform' or 'nonuniform', found table file: /home/user/OpenFOAM/user-2.3.0/run/tutorials/lagrangian/DPMFoam/test/0/U.air.boundaryField.bottom from line 52 to line 70. From function Field<Type>::Field(const word& keyword, const dictionary&, const label) in file /home/user/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/Field.C at line 304. FOAM exiting Code:
--> FOAM FATAL IO ERROR: wrong token type - expected Scalar, found on line 64 the punctuation token '(' file: /home/user/OpenFOAM/user-2.3.0/run/tutorials/lagrangian/DPMFoam/test/0/U.air.boundaryField.bottom.value at line 64. From function operator>>(Istream&, Scalar&) in file lnInclude/Scalar.C at line 93. FOAM exiting Best, |
|
October 12, 2014, 13:47 |
|
#7 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@Maysam: Unfortunately I don't have enough time to give the whole solution, but I think I can still give information on why that didn't work and what can be done to fix the problem.
Bruno
__________________
|
|
October 18, 2014, 15:55 |
|
#9 | ||
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Maysam,
Quote:
Bruno
__________________
|
|||
October 19, 2014, 02:06 |
|
#10 | |
Senior Member
|
Hi Bruno,
I know the difference between u and U, the actual and superficial velocity with relation of U=alpha*u. This is the main advantage of "interstitialInletVelocity" to "fixedValue" and "uniformFixedaValue". My question was about why there are two entries in 0/U.air Quote:
|
||
October 21, 2014, 18:26 |
|
#11 |
Senior Member
|
We want use available boundary conditions of fixedValue (BC1), uniformFixedValue (BC2) and interstitialInletVelocity (BC3) to write own myInterstitialInletVelocity (BC4).
BC4 will have advantages of BC3 (which accounts alpha to have constant mass flow rate in multiphase flows) and BC2 (which accepts table to apply time varying air velocity). The first step is compiling BC in user directory. 1- Copying BC3 from source to user directory and renaming it to my0InterstitialInletVelocity. Code:
$FOAM_SRC/finiteVolume/fields/fvPatchFields/derived/interstitialInletVelocity to $WM_PROJECT_USER_DIR/src/finiteVolume/fields/fvPatchFields/derived/my0interstitialInletVelocity 3- Writing an appropriate Make/files and options and then compiling it in: Code:
$WM_PROJECT_USER_DIR/src/finiteVolume/ Code:
libs ("libmyFiniteVolume.so"); The link of GoldschemidtBC contains my0InterstitialInletVelocity BC in 0/U.air and dictionary in it is controlDict. The src link contains BC1 to BC4. but is compiled for "my0InterstitialInletVelocity". The BC4 doesn't work which will be discussed later. Code:
https://www.dropbox.com/s/b54r786b167bmxw/src.tar.gz?dl=0 https://www.dropbox.com/s/8fpj3os65a8hnp9/GoldschmidtBC.tar.gz?dl=0 The next step is doing modification in myInterstitialInletVelocity (BC4) to possible accepting table. The difference of BC2 to BC1 are: 1- BC2 has a new parameter definition: Code:
const Field<Type>& fld Code:
uniformValue_() 2- BC1 uses mapper (which I don't know what does it do): Code:
fixedValueFvPatchField<Type>::fixedValueFvPatchField ( const fixedValueFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, const fvPatchFieldMapper& mapper ) : fvPatchField<Type>(ptf, p, iF, mapper) { if (&iF && mapper.hasUnmapped()) { WarningIn ( "fixedValueFvPatchField<Type>::fixedValueFvPatchField\n" "(\n" " const fixedValueFvPatchField<Type>&,\n" " const fvPatch&,\n" " const DimensionedField<Type, volMesh>&,\n" " const fvPatchFieldMapper&\n" ")\n" ) << "On field " << iF.name() << " patch " << p.name() << " patchField " << this->type() << " : mapper does not map all values." << nl << " To avoid this warning fully specify the mapping in derived" << " patch fields." << endl; } } Code:
template<class Type> uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ( const uniformFixedValueFvPatchField<Type>& ptf, const fvPatch& p, const DimensionedField<Type, volMesh>& iF, const fvPatchFieldMapper& mapper ) : fixedValueFvPatchField<Type>(p, iF), // bypass mapper uniformValue_(ptf.uniformValue_().clone().ptr()) { // Evaluate since value not mapped const scalar t = this->db().time().timeOutputValue(); fvPatchField<Type>::operator==(uniformValue_->value(t)); } 3- we see time again in next class. In this one, it is looking for value or table: Code:
template<class Type> uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField ( const fvPatch& p, const DimensionedField<Type, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchField<Type>(p, iF), uniformValue_(DataEntry<Type>::New("uniformValue", dict)) { if (dict.found("value")) { fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size())); } else { const scalar t = this->db().time().timeOutputValue(); fvPatchField<Type>::operator==(uniformValue_->value(t)); } } However, I tried many different tries and errors by adding classes to BC4 but not possible to compile it successfully. Two possibles for errors are: 1- mistakes in defining parameters 2- two "operator== ..." in updateCoeff of BC4: Code:
void Foam::myInterstitialInletVelocityFvPatchVectorField::updateCoeffs() { Info << "Banana1" <<endl; if (updated()) { return; } const scalar t = this->db().time().timeOutputValue(); // fvPatchField<vector>::operator==(uniformInletVelocity_->value(t)); // // fixedValueFvPatchField<Type>::updateCoeffs(); // const fvPatchField<scalar>& alphap = patch().lookupPatchField<volScalarField, scalar>(alphaName_); operator==(uniformInletVelocity_/alphap); fixedValueFvPatchVectorField::updateCoeffs(); } Sorry for this long post and thanks in advance for any suggestion. Last edited by maysmech; October 21, 2014 at 22:08. |
|
November 3, 2014, 19:24 |
|
#12 |
Senior Member
|
Hi all,
I am trying to write a time varying boundary condition which accounts inlet porosity in applying inlet velocity but it hasn't lead to solution yet. Is it possible to write a script which automatically do below procedure: 1- Run 2- After finishing run (reaching to endTime) do the following: 2-1- Iincrease endTime in system/controlDict (for example from 1 to 2) 2-2- Change inlet velocity in U.air file (with known line and column) in exist latest time folder. 3- Run again and do a loop from 1 to reach a desired time (for example 10sec). For this purpose we should have a script to: 1- change a number in a file 2- understand when the run is finished 3- loop over time I think the first one is possible but I don't know about 2 and 3. Any idea will be appreciated. |
|
November 4, 2014, 06:27 |
|
#13 |
Senior Member
anonymous
Join Date: Aug 2014
Posts: 205
Rep Power: 13 |
Why don't you use groovyBC for your custom boundary condition?
You seem to be making it a lot more complicated than what it really is, search for groovyBC I'm sure it will help you. |
|
November 5, 2014, 17:31 |
|
#14 | |
New Member
Charlie
Join Date: May 2014
Posts: 9
Rep Power: 12 |
Quote:
This is what exactly I need for finding minimum fluidization velocity. I need a gradually increase in fluidization velocity. I used table with fixed value but the results was mistake because of inlet porosity is not considered in fixedValue. Did you find any solution? Please share it if you have found. Best regards. |
||
November 6, 2014, 18:55 |
|
#15 | ||
Senior Member
|
Quote:
The type of boundary condition is interstitialInletVelocity which divide velocity over air volume fraction. The groovy doesn't see volume fraction and is suitable for fixed value types. If I'm wrong, please correct! Quote:
As you mentioned, gradually increase of velocity is crucial for any fluidizeation velocity simulation. But unfortunately I didn't find any solution yet Last edited by wyldckat; November 8, 2014 at 07:39. Reason: merged posts that were in different threads but that were also pulled into this thread |
|||
November 24, 2014, 09:04 |
|
#17 |
Senior Member
anonymous
Join Date: Aug 2014
Posts: 205
Rep Power: 13 |
As far as I'm concerned, you can access volume fraction and all the variables you want from groovyBC.
|
|
November 30, 2014, 17:15 |
|
#18 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@Maysam: I didn't manage to have enough time to fully test this, so please test if everything is working OK. The new boundary condition, use/build instructions and tutorial cases are provided here: https://github.com/wyldckat/Unsuppor...OpenFOAM-2.3.x Either use "git clone" or download as a ZIP file, as instructed on the right side of the page at that website. By the way, the main detail was that the method "updateCoeffs()" should be like this: Code:
void Foam::uniformInterstitialInletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } const fvPatchField<scalar>& alphap = patch().lookupPatchField<volScalarField, scalar>(alphaName_); const scalar t = this->db().time().timeOutputValue(); inletVelocity_ = uniformInletVelocity_->value(t); operator==(inletVelocity_/alphap); fixedValueFvPatchVectorField::updateCoeffs(); } Best regards, Bruno
__________________
|
|
December 8, 2014, 14:25 |
|
#20 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Maysam,
Just a side note: Sorry, I wasn't very clear on why I mentioned it took me 2 hours. My estimate is that on average it takes me 20 minutes to answer each question here on the forum, although finding/developing the answer can sometimes take 6 to 8 hours or more... so the average comes down only because there are several posts where the answer ends up being a questions. Therefore, the concept I had in mind when I said "2h" was that it was all of the time I had that day and that compared to the average it was 5 other posts I couldn't answer... I wasn't trying to show off "how good I am", I was actually trying to state that I'm not good enough to answer as fast as I wanted to be able to This to say: If you - and anyone reading this post - can find some time to help other newcomers on the forum, please do! Best regards, Bruno PS: I'm very glad it's working!! Last edited by wyldckat; December 8, 2014 at 14:25. Reason: see "PS:" |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time dependant pressure boundary condition | yosuke1984 | OpenFOAM Verification & Validation | 3 | May 6, 2015 07:16 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 08:56 |
External Radiation Boundary Condition (Two sided wall), Grid Interface | CFD XUE | FLUENT | 0 | July 8, 2010 07:49 |
vorticity boundary condition | bearcharge | Main CFD Forum | 0 | May 14, 2010 12:32 |
Time Varying Boundary Conditon | ashish | CFX | 3 | February 15, 2005 07:21 |