|
[Sponsors] |
December 9, 2014, 17:38 |
|
#21 |
New Member
Charlie
Join Date: May 2014
Posts: 9
Rep Power: 11 |
Thanks a lot Maysam and Bruno for your public discussion on this issue.
I was searching a lot for such boundary condition to calculate minimum fluidization velocity. and it is good news to see it works. How can I use time varying boundary condition in U.air? I need a gradually increase from zaero to a maximum air velocity. Theanks |
|
December 9, 2014, 17:46 |
|
#22 |
Senior Member
|
Hi Bruno,
You are a kind expert in fluid mechanics and C++ programming and I and other cfd-online users have learned a lot from you. Thanks Hi Charlie, Use something like this: Code:
{ type uniformInterstitialInletVelocity; uniformInletVelocity table ( (0 (0 0 0.1)) (10 (0 0 1.5)) ) ; inletVelocity uniform (0 0 1.5); value uniform (0 0 1.5); phi phi.air; alpha alpha.air; } |
|
March 11, 2015, 09:19 |
|
#23 | |
Member
Alexander Bartel
Join Date: Feb 2015
Location: Germany
Posts: 97
Rep Power: 11 |
Hi maysam, Bruno, or someone with a bit experience on this issue,
I have got a (hopefully) rather simple question. the table isn't fully explained on the official website. ( http://www.openfoam.org/version2.1.0...conditions.php ) I think because it seems to clear. Quote:
So in this example the boundary condition is set to 0.0 from 0s to 100s, and set to 10.0 from 100s until the end of the computation. Is that right? I hope it isn't, because it behaves a bit different on my computer. kind regards Alex |
||
April 30, 2015, 11:55 |
|
#24 |
Member
Alexander Bartel
Join Date: Feb 2015
Location: Germany
Posts: 97
Rep Power: 11 |
At least I am at the point to make my problem more clearly.
But fortunately I solved the problem myself, while I tried to write a simple testcase. Now I want to share not only the problem but also the solution. I am using OF 2.3.1 and 2.3.0 and tried to move a mesh with pimpleDyMFoam(just for the mesh motion(like in the tutorial pimpleDyMFoam/movingCone) and InterPhaseChangeFoam (for a study of cavitation in moved diesel Injectors). for this problem I defined a little list in the pointmotionU file: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ... snip ... dimensions [0 1 -1 0 0 0 0]; internalField uniform 0; boundaryField { moving { type uniformFixedValue; //uniformValue constant 0.25; uniformValue table ( (0.000 0) (0.0005 0.25) (0.001 0) (0.0015 -0.25) (0.002 0) ); } walls { type uniformFixedValue; uniformValue constant 0; } ... snip ... } // ************************************************************************* // Instead the mesh moved from the beginning to approx 0.001 up and from 0.001 to 0.002 down. I don't know why, but with this adjustment the output was perfect. Code:
... snip ... type uniformFixedValue; //uniformValue constant 0.25; uniformValue table ( (0 0) (0.0005 0) (0.000501 0.25) (0.001 0.25) (0.001001 0) (0.0015 0) (0.001501 -0.25) (0.002 -0.25) (0.002001 0) (0.003 0) ); ... snip ... if someone with more experience has a good explanation.... feel free to share it. If anyone likes to test my code snippets... just copy them in the pointmotionUx file in pimpleDyMFoam/movingCone/0, modify the velocity to 5 and run it. best regards Alex |
|
May 3, 2015, 14:07 |
|
#25 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Greetings Alex,
Sorry for the late reply, but only today did I manage to answer to your questions here. If you take a look at the tutorial "incompressible/pimpleFoam/TJunction" and run it, you should be able to see that this table that is in the file "0/p": Code:
inlet { type uniformTotalPressure; pressure table ( (0 10) (1 40) ); p0 40; // only used for restarts U U; phi phi; rho none; psi none; gamma 1; value uniform 40; } Code:
p_i = 10 + (40-10)*t/(1-0) That is why your solution sort-of worked, since you restrained the interpolation mechanism that this specific table system uses. Best regards, Bruno
__________________
|
|
May 5, 2015, 17:39 |
|
#26 |
Member
Alexander Bartel
Join Date: Feb 2015
Location: Germany
Posts: 97
Rep Power: 11 |
Thanks for the explanation Bruno,
now everything is clear And you don't have to apologize... you're doing enough here and my question from the eleventh of March was a bit tooo general to insist on a fast reply. br Alex |
|
September 28, 2015, 12:34 |
Maximum time value for table entries
|
#27 |
New Member
James Montague
Join Date: Jan 2014
Location: Vermont, United States
Posts: 7
Rep Power: 12 |
I have a general question on time-varying boundary conditions. Is there a maximum time (in seconds) that can be used in a table?
I am using flowRateInletVelocity in which I switch flow on and off over the course of two months. This means that my table looks like this: Code:
type flowRateInletVelocity; volumetricFlowRate table ( (0 1.66666667e-6) (5400 1.66666667e-6) (5401 0) (1891800 0) (1891801 1.66666667e-6) (1897200 1.66666667e-6) (1897201 0) (3094200 0) (3094201 1.66666667e-6) (3099600 1.66666667e-6) (3099601 0) (4554000 0) (4554001 1.66666667e-6) (4559400 1.66666667e-6) (4559401 0) (6100200 0) (6100201 1.66666667e-6) (6105600 1.66666667e-6) (6105601 0) ); Code:
Reading field U [1] [1] [1] --> FOAM FATAL ERROR: [1] out-of-order value: 1.8918e+06 at index 4 [1] [1] From function Foam::TableBase<Type>::check() const [1] in file lnInclude/TableBase.C at line 203. [1] FOAM parallel run exiting Thanks, Jim Last edited by Montague; September 29, 2015 at 09:50. |
|
September 29, 2015, 11:00 |
|
#28 |
New Member
James Montague
Join Date: Jan 2014
Location: Vermont, United States
Posts: 7
Rep Power: 12 |
After some experimentation, I have found that the increase in each time step at large values should be at least the time step used. I was using a time step of 60 s, so my new table has time increments of at least 60 s rather than my previous table that used timesteps of 1 s.
Code:
type flowRateInletVelocity; volumetricFlowRate table ( (0 1.66666667e-6) (5400 1.66666667e-6) (5460 0) (1891800 0) (1891860 1.66666667e-6) (1897200 1.66666667e-6) (1897260 0) (3094200 0) (3094260 1.66666667e-6) (3099600 1.66666667e-6) (3099660 0) (4554000 0) (4554060 1.66666667e-6) (4559400 1.66666667e-6) (4559460 0) (6100200 0) (6100260 1.66666667e-6) (6105600 1.66666667e-6) (6105660 0) ); Best, Jim |
|
October 4, 2015, 15:46 |
|
#29 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Quick answer @Jim: I don't have time to test this myself, but I suspect the problem has to do with the time precision option in "system/controlDict":
Code:
timePrecision 6; |
|
October 5, 2015, 15:06 |
|
#30 |
New Member
James Montague
Join Date: Jan 2014
Location: Vermont, United States
Posts: 7
Rep Power: 12 |
Thanks Bruno!
That seems to have been the issue. The writePrecission option should also be changed to match the timePrecision. -Jim |
|
January 28, 2016, 16:05 |
|
#31 |
Member
Ali
Join Date: Aug 2011
Location: Milwaukee
Posts: 34
Rep Power: 14 |
Hello everyone,
I am trying to do the same thing (time varying boundary condition) and I am getting the same error but I cant find the reason. I highly appreciate any helps. Here is my boundary condition: Code:
type flowRateInletVelocity; volumetricFlowRate table 8 ( (0 0.2747e-6) (0.025 0.2961e-6) (0.05 0.3654e-6) (0.075 0.4168e-6) (0.1 0.3889e-6) (0.125 0.3847e-6) (0.15 0.4157e-6) (0.175 0.4474e-6) ) ; Code:
--> FOAM FATAL ERROR: out-of-order value: 0.1 at index 5 From function Foam::TableBase<Type>::check() const in file lnInclude/TableBase.C at line 203. |
|
January 28, 2016, 17:31 |
|
#32 |
New Member
James Montague
Join Date: Jan 2014
Location: Vermont, United States
Posts: 7
Rep Power: 12 |
Hi Ali,
I tried running a simple case using your boundary condition and the only way I can get an error is by changing the writePrecision in the controlDict to a smaller value (<=4). I would recommend looking at these values first to make sure they are large enough to capture the precision you need. Additionally, the error I get refers to index 4 rather than index 5 as the out of order value. I hope this helps Best, Jim |
|
January 28, 2016, 22:29 |
|
#33 |
Member
Ali
Join Date: Aug 2011
Location: Milwaukee
Posts: 34
Rep Power: 14 |
Hey Jim,
Thanks for the reply. I actually solved the problem by defining my table in a file. As soon as I put the table inside a separate file the problem solved! Also my writePrecision is on 6. But thanks again. Cheers Ali |
|
October 18, 2019, 02:24 |
|
#34 | |
Member
George Pichurov
Join Date: Jul 2010
Posts: 52
Rep Power: 15 |
Quote:
Code:
(0 (0 0 0)) (2.0 (0 0 0)) (2.0 (1 0 0) (3.0 (1 0 0) |
||
February 2, 2021, 10:46 |
|
#35 | ||
Member
Vitor Monteiro
Join Date: Nov 2020
Posts: 32
Rep Power: 5 |
How can I do this interstitial varying velocity (today...rs) at OpenFOAM 8?
I've tried to copy those files but when wmake I've got: Quote:
Now, I'm having this kind of problem: Quote:
Thanks if someone could help! Last edited by Vitor Monteiro; February 2, 2021 at 12:48. |
|||
February 17, 2021, 07:35 |
|
#36 |
Member
Vitor Monteiro
Join Date: Nov 2020
Posts: 32
Rep Power: 5 |
Actually, I've solved the problem modifying uniformInterstitialInletVelocityFvPatchVectorField .C and uniformInterstitialInletVelocityFvPatchVectorField .H files:
Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | Unsupported Contributions for OpenFOAM \\ / O peration | \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- 2014-11-30 Bruno Santos (wyldckat): Cross-over BC between interstitialInletVelocityFvPatchVectorField and uniformFixedValueFvPatchField, but oriented to interpolate data over time. Created for fulfilling the request on this thread: http://www.cfd-online.com/Forums/ope...g-development/ 121366-time-varying-boundary-condition.html ------------------------------------------------------------------------------- License This file is a derivative work of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class Foam::uniformInterstitialInletVelocityFvPatchVectorField \*---------------------------------------------------------------------------*/ #include "uniformInterstitialInletVelocityFvPatchVectorField.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::uniformInterstitialInletVelocityFvPatchVectorField:: uniformInterstitialInletVelocityFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF ) : fixedValueFvPatchVectorField(p, iF), uniformInletVelocity_(), //inletVelocity_(p.size(), vector::zero), inletVelocity_(p.size(), Zero), alphaName_("alpha") {} Foam::uniformInterstitialInletVelocityFvPatchVectorField:: uniformInterstitialInletVelocityFvPatchVectorField ( const uniformInterstitialInletVelocityFvPatchVectorField& ptf, const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const fvPatchFieldMapper& mapper ) : fixedValueFvPatchVectorField(ptf, p, iF, mapper), uniformInletVelocity_(ptf.uniformInletVelocity_().clone().ptr()), //inletVelocity_(ptf.inletVelocity_, mapper), inletVelocity_(mapper(ptf.inletVelocity_)), alphaName_(ptf.alphaName_) {} Foam::uniformInterstitialInletVelocityFvPatchVectorField:: uniformInterstitialInletVelocityFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchVectorField(p, iF, dict), uniformInletVelocity_(Function1<vector>::New("uniformInletVelocity", dict)), inletVelocity_("inletVelocity", dict, p.size()), alphaName_(dict.lookupOrDefault<word>("alpha", "alpha")) {} Foam::uniformInterstitialInletVelocityFvPatchVectorField:: uniformInterstitialInletVelocityFvPatchVectorField ( const uniformInterstitialInletVelocityFvPatchVectorField& ptf ) : fixedValueFvPatchVectorField(ptf), uniformInletVelocity_ ( ptf.uniformInletVelocity_.valid() ? ptf.uniformInletVelocity_().clone().ptr() : NULL ), inletVelocity_(ptf.inletVelocity_), alphaName_(ptf.alphaName_) {} Foam::uniformInterstitialInletVelocityFvPatchVectorField:: uniformInterstitialInletVelocityFvPatchVectorField ( const uniformInterstitialInletVelocityFvPatchVectorField& ptf, const DimensionedField<vector, volMesh>& iF ) : fixedValueFvPatchVectorField(ptf, iF), uniformInletVelocity_ ( ptf.uniformInletVelocity_.valid() ? ptf.uniformInletVelocity_().clone().ptr() : NULL ), inletVelocity_(ptf.inletVelocity_), alphaName_(ptf.alphaName_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::uniformInterstitialInletVelocityFvPatchVectorField::autoMap ( const fvPatchFieldMapper& m ) { fixedValueFvPatchVectorField::autoMap(m); //inletVelocity_.autoMap(m); m(inletVelocity_, inletVelocity_); } void Foam::uniformInterstitialInletVelocityFvPatchVectorField::rmap ( const fvPatchVectorField& ptf, const labelList& addr ) { fixedValueFvPatchVectorField::rmap(ptf, addr); const uniformInterstitialInletVelocityFvPatchVectorField& tiptf = refCast<const uniformInterstitialInletVelocityFvPatchVectorField>(ptf); inletVelocity_.rmap(tiptf.inletVelocity_, addr); } 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(); } void Foam::uniformInterstitialInletVelocityFvPatchVectorField::write ( Ostream& os ) const { fvPatchField<vector>::write(os); writeEntryIfDifferent<word>(os, "alpha", "alpha", alphaName_); uniformInletVelocity_->writeData(os); //inletVelocity_.writeEntry("inletVelocity", os); writeEntry(os, "inletVelocity", inletVelocity_); //writeEntry("value", os); writeEntry(os, "value", *this); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { makePatchTypeField ( fvPatchVectorField, uniformInterstitialInletVelocityFvPatchVectorField ); } // ************************************************************************* // Code:
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | Unsupported Contributions for OpenFOAM \\ / O peration | \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- 2014-11-30 Bruno Santos (wyldckat): Cross-over BC between interstitialInletVelocityFvPatchVectorField and uniformFixedValueFvPatchField, but oriented to interpolate data over time. Created for fulfilling the request on this thread: http://www.cfd-online.com/Forums/ope...g-development/ 121366-time-varying-boundary-condition.html ------------------------------------------------------------------------------- License This file is a derivative work of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class Foam::uniformInterstitialInletVelocityFvPatchVectorField Description Time dependent inlet velocity in which the actual interstitial velocity is calculated by dividing the specified inletVelocity field with the local phase-fraction. \heading Patch usage \table Property | Description | Required | uniformInletVelocity | Non-interstitial inlet velocity | yes | alpha | Name of the phase-fraction field | yes | inletVelocity | Current non-interstitial inlet velocity | yes | \endtable Example of the boundary condition specification: \verbatim inlet { type uniformInterstitialInletVelocity; uniformInletVelocity constant (0 0.2 0); alpha alpha.particles; inletVelocity uniform (0 0.2 0); value uniform (0 0 0); } \endverbatim SourceFiles uniformInterstitialInletVelocityFvPatchVectorField.C \*---------------------------------------------------------------------------*/ #ifndef uniformInterstitialInletVelocityFvPatchVectorField_H #define uniformInterstitialInletVelocityFvPatchVectorField_H #include "fixedValueFvPatchFields.H" #include "Function1.H" #include "fieldTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class uniformInterstitialInletVelocityFvPatch Declaration \*---------------------------------------------------------------------------*/ class uniformInterstitialInletVelocityFvPatchVectorField : public fixedValueFvPatchVectorField { // Private data //- Time varying inlet velocity autoPtr<Function1<vector> > uniformInletVelocity_; //- Inlet velocity vectorField inletVelocity_; //- Name of the flux transporting the field word alphaName_; public: //- Runtime type information TypeName("uniformInterstitialInletVelocity"); // Constructors //- Construct from patch and internal field uniformInterstitialInletVelocityFvPatchVectorField ( const fvPatch&, const DimensionedField<vector, volMesh>& ); //- Construct from patch, internal field and dictionary uniformInterstitialInletVelocityFvPatchVectorField ( const fvPatch&, const DimensionedField<vector, volMesh>&, const dictionary& ); //- Construct by mapping given // uniformInterstitialInletVelocityFvPatchVectorField // onto a new patch uniformInterstitialInletVelocityFvPatchVectorField ( const uniformInterstitialInletVelocityFvPatchVectorField&, const fvPatch&, const DimensionedField<vector, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy uniformInterstitialInletVelocityFvPatchVectorField ( const uniformInterstitialInletVelocityFvPatchVectorField& ); //- Construct and return a clone virtual tmp<fvPatchVectorField> clone() const { return tmp<fvPatchVectorField> ( new uniformInterstitialInletVelocityFvPatchVectorField (*this) ); } //- Construct as copy setting internal field reference uniformInterstitialInletVelocityFvPatchVectorField ( const uniformInterstitialInletVelocityFvPatchVectorField&, const DimensionedField<vector, volMesh>& ); //- Construct and return a clone setting internal field reference virtual tmp<fvPatchVectorField> clone ( const DimensionedField<vector, volMesh>& iF ) const { return tmp<fvPatchVectorField> ( new uniformInterstitialInletVelocityFvPatchVectorField (*this, iF) ); } // Member functions // Mapping functions //- Map (and resize as needed) from self given a mapping object virtual void autoMap ( const fvPatchFieldMapper& ); //- Reverse map the given fvPatchField onto this fvPatchField virtual void rmap ( const fvPatchVectorField&, const labelList& ); // Evaluation functions //- Update the coefficients associated with the patch field virtual void updateCoeffs(); //- Write virtual void write(Ostream&) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* // |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time dependant pressure boundary condition | yosuke1984 | OpenFOAM Verification & Validation | 3 | May 6, 2015 06:16 |
plot over time | fferroni | OpenFOAM Post-Processing | 7 | June 8, 2012 07:56 |
External Radiation Boundary Condition (Two sided wall), Grid Interface | CFD XUE | FLUENT | 0 | July 8, 2010 06:49 |
vorticity boundary condition | bearcharge | Main CFD Forum | 0 | May 14, 2010 11:32 |
Time Varying Boundary Conditon | ashish | CFX | 3 | February 15, 2005 06:21 |