|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Hallo everyone
This post will take you through a method of creating a circular inlet condition. Where the inlet condition is made from an array generated in Matlab This Matlab function can take an array and put into the right syntax for OpenFOAM. Code:
%input syntax % filename = 'data/test.txt'; % % x = 0:.1:1; % tal = [t.^2;t.^3;t.^4]; % output_file(x,tal,filename); function output_file(t,val,filename) %%% note this function only works on velocity bundary conditins. A = [t;val]; % this defines the precision, if higher needed look up fprintf in matlab % doc formatSpec = '( %4.2f (%4.2f %4.2f %4.2f) )\r\n'; fileID = fopen(filename,'w'); fprintf(fileID,'%1s\r\n','(') fprintf(fileID,formatSpec,A); fprintf(fileID,'%1s',');'); fclose(fileID); end Code:
( ( 0 (0 0 1)) (100 (0 0 2)) ); Code:
inlet { type cylindricalInletVelocity; axis (0 0 1); // <-These two defines where the center axis is. centre (0 0 0); // <- axialVelocity constant 0; radialVelocity //<- Here the radial velocity is defined. { type tableFile; file "$FOAM_CASE/myDataFile"; //<- The path to the file which descripes the inlet speed } rpm constant 0; //<- This sets the swirl of inlet. value uniform (0 0 0); //<- This will initialize the postproces and calculation, will be overwritten when the // boundary is accessed the first time } This should do it. Any improvements are welcome, so others easily can remake these inlet condition. - Fridrik Magnusson Last edited by Fridrik; October 12, 2017 at 05:51. Reason: additional information |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Senior Member
|
Quote:
This indicates that OpenFOAM expects the keyword file, while you have the keyword fileName. So I think changing that would solve this error. Regards, Tom |
||
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
||
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
The derived boundary conditions: "cylindricalInletVelocity" should do the trick but it dosent seem to work.
from the website: To test the inlet condition. I set the rpm and the axial velocity to 0. This will just have a radial component then. Code:
inlet { type cylindricalInletVelocity; axis (0 0 1); origin (0 0 0); axialVelocity constant 0; radialVelocity constant 1; rpm constant 0; } Code:
--> FOAM FATAL IO ERROR: Essential entry 'value' missing file: /-/-/-/-/OpenFOAM/Circulare_inlet/0/U.boundaryField.inlet from line 26 to line 31. From function Foam::fvPatchField<Type>::fvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&, bool) [with Type = Foam::Vector<double>] in file /home/pgh/OpenFOAM/OpenFOAM-v1706/src/finiteVolume/lnInclude/fvPatchField.C at line 131. FOAM exiting How do i make this boundary condition work ? |
|
![]() |
![]() |
![]() |
![]() |
#5 | |
Senior Member
|
Quote:
Code:
inlet { type cylindricalInletVelocity; axis (0 0 1); origin (0 0 0); axialVelocity constant 0; radialVelocity constant 1; rpm constant 0; value uniform (1 1 0); } Best Regards, Tom |
||
![]() |
![]() |
![]() |
![]() |
#6 |
Member
Fridrik Magnusson
Join Date: Aug 2017
Location: Denmark
Posts: 34
Rep Power: 9 ![]() |
Thanks again Tom
Since the value is only for postprocessing and only gives a value at t = 0, i put it to (0 0 0). I think this pushed me over the finish line, i will update the post to be a tutorial for other users |
|
![]() |
![]() |
![]() |
Tags |
bash on ubuntu on windows, circulare inlet condition, swag4foam |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
setting the correct format of nonuniform List<vector> for inlet in 0 Folder | cfdonline2mohsen | OpenFOAM Running, Solving & CFD | 8 | July 18, 2019 08:03 |
Problem with assigned inlet velocity profile as a boundary condition | Ozgur_ | FLUENT | 5 | August 25, 2015 04:58 |
velocity inlet and ideal gas simultaneously-what's wrong? | preetam69 | FLUENT | 0 | September 28, 2013 04:51 |
Inlet Velocity in CFX | aeroman | CFX | 12 | August 6, 2009 18:42 |
Diffusion component at inlet | Balaji | FLUENT | 2 | August 8, 2005 07:37 |