CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] GroovyBC

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 27, 2016, 05:00
Lightbulb GroovyBC
  #1
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Hi to all,
which is the correct file format to set a boundary condition with GroovyBC starting from an external file? Which extension typare allowed?

Thanks for help!
FlyBob91 is offline   Reply With Quote

Old   October 27, 2016, 06:07
Default
  #2
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
ok i found it accepts the .csv and the openFoam-format. I have to work with .csv format but it seems not to work. Maybe i made some mistake in the file boundary

Code:
    inlet1
    {
	type groovyBC ;

	fields
	(
	U
	);
	outOfBounds clamp;
        readerType csv
	fileName "$FOAM_CASE/tab.csv";
	hasHeaderLine 1;
	valueColumns 3;
    }
can someone control me the code?
Thanks!
Attached Files
File Type: txt tab.txt (18.0 KB, 21 views)
FlyBob91 is offline   Reply With Quote

Old   October 27, 2016, 13:01
Default
  #3
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Ok i changed road and i decided to insertthe li directly in U file in ti manner:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet1
    {
        type             fixedValue
	value nonuniform List<vector>
	36
(
(-0.00053044	0.20173	0.002039)
(-0.0023134	0.28452	0.0037276)
(-0.0020482	0.38684	0.0054303)
(0.0020481	0.38684	0.0054303)
(0.0023134	0.28452	0.0037276)
(0.00053044	0.20173	0.002039)
(-0.0011778	0.2555	0.0033889)
(-0.0037739	0.3664	0.0060664)
(-0.003185	0.50186	0.0089382)
(0.003185	0.50186	0.0089382)
(0.0037739	0.3664	0.0060664)
(0.0011778	0.2555	0.0033889)
(-0.0013859	0.31758	0.0023695)
(-0.0047678	0.45854	0.0042026)
(-0.0040748	0.62904	0.006223)
(0.0040748	0.62904	0.006223)
(0.0047678	0.45854	0.0042026)
(0.0013859	0.31758	0.0023695)
(-0.0013859	0.31758	-0.0023695)
(-0.0047678	0.45854	-0.0042026)
(-0.0040748	0.62904	-0.006223)
(0.0040748	0.62904	-0.006223)
(0.0047678	0.45854	-0.0042026)
(0.0013859	0.31758	-0.0023695)
(-0.0011778	0.2555	-0.0033889)
(-0.0037739	0.3664	-0.0060664)
(-0.003185	0.50186	-0.0089382)
(0.003185	0.50186	-0.0089382)
(0.0037739	0.3664	-0.0060664)
(0.0011778	0.2555	-0.0033889)
(-0.00053044	0.20173	-0.002039)
(-0.0023134	0.28452	-0.0037276)
(-0.0020482	0.38684	-0.0054303)
(0.0020481	0.38684	-0.0054303)
(0.0023134	0.28452	-0.0037276)
(0.00053044	0.20173	-0.002039)
)
    }


    inlet2
    {
        type            fixedValue;
        value           uniform (0 -0.42 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    walls
    {
        type           fixedValue;
        value          uniform (0 0 0);       
    }
}

// ************************************************************************* //

however this error appear

Code:
--> FOAM FATAL IO ERROR: 
Essential entry 'value' missing

file: /home/roby/Scrivania/Tmixer_100/0/U.boundaryField.inlet1 from line 25 to line 26.

    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 lnInclude/fvPatchField.C at line 133.

FOAM exiting
any suggestion
FlyBob91 is offline   Reply With Quote

Old   October 28, 2016, 03:34
Default
  #4
Member
 
Brian Willis
Join Date: Mar 2011
Location: Cape Town, South Africa
Posts: 58
Rep Power: 15
Dipsomaniac is on a distinguished road
Looks like you are missing a semi colon after your bracket which containers the list of vectors.
Dipsomaniac is offline   Reply With Quote

Old   October 28, 2016, 05:04
Default
  #5
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Quote:
Originally Posted by Dipsomaniac View Post
Looks like you are missing a semi colon after your bracket which containers the list of vectors.
Hi Brian,
thank you for your reply (you are saving my life in these days). I also forgotthe semi colon after "fixedValue"

here the code corected

Code:
boundaryField
{
    inlet1
    {
        type             fixedValue;
	value 		 nonuniform List<vector>
	36
(
(-0.00053044	0.20173	0.002039)
(-0.0023134	0.28452	0.0037276)
(-0.0020482	0.38684	0.0054303)
(0.0020481	0.38684	0.0054303)
(0.0023134	0.28452	0.0037276)
(0.00053044	0.20173	0.002039)
(-0.0011778	0.2555	0.0033889)
(-0.0037739	0.3664	0.0060664)
(-0.003185	0.50186	0.0089382)
(0.003185	0.50186	0.0089382)
(0.0037739	0.3664	0.0060664)
(0.0011778	0.2555	0.0033889)
(-0.0013859	0.31758	0.0023695)
(-0.0047678	0.45854	0.0042026)
(-0.0040748	0.62904	0.006223)
(0.0040748	0.62904	0.006223)
(0.0047678	0.45854	0.0042026)
(0.0013859	0.31758	0.0023695)
(-0.0013859	0.31758	-0.0023695)
(-0.0047678	0.45854	-0.0042026)
(-0.0040748	0.62904	-0.006223)
(0.0040748	0.62904	-0.006223)
(0.0047678	0.45854	-0.0042026)
(0.0013859	0.31758	-0.0023695)
(-0.0011778	0.2555	-0.0033889)
);
    }
.............

Best Regards,
Roberto
FlyBob91 is offline   Reply With Quote

Old   October 29, 2016, 11:17
Default
  #6
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Sorry for the bump.
The list vector works good but, because i have to work with a large number of vectors, i would like to load them directly starting from my csv file. The condition is not timevarying but fixed.
Any suggestion?


this is what i write till now

Code:
      inlet1
    {
      type            fixedValue;
      uniformValue    csvFile; 
     
      csvFileCoeffs
      {
   	 fileName         "$FOAM_CASE/tab"
   	 outOfBounds      clamp;
   	 hasHeaderLine    true;
    	// refColumn        0; i don't hav refColumn because it's not time Varying
    	 componentColumns (0 1 2); 
       }
    }

here the error

Code:
--> FOAM FATAL IO ERROR: 
Essential entry 'value' missing

file: /home/roby/Scrivania/ciao/0/U.boundaryField.inlet1 from line 26 to line 35.

    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 lnInclude/fvPatchField.C at line 133.

FOAM exiting
this is strange because i followed the instructions in http://openfoam.org/release/2-1-0/bo...ime-dependent/
the guide is for timedipendent BC but i think it can ru also for fixedValue.

i link also the file
Attached Files
File Type: gz tab.csv.tar.gz (351 Bytes, 6 views)
FlyBob91 is offline   Reply With Quote

Old   October 29, 2016, 11:42
Default
  #7
Member
 
Brian Willis
Join Date: Mar 2011
Location: Cape Town, South Africa
Posts: 58
Rep Power: 15
Dipsomaniac is on a distinguished road
Hi Roberto

Looks like you need to still add
Code:
value uniform (0 0 0);
after you have read in your CSV file. I am assuming it won't be used in the calculation and is just a place holder, but is required for the boundary condition to still be read correctly.

Regards,
Brian

Like this.
Code:
      inlet1
    {
      type            fixedValue;
      uniformValue    csvFile; 
     
      csvFileCoeffs
      {
   	 fileName         "$FOAM_CASE/tab"
   	 outOfBounds      clamp;
   	 hasHeaderLine    true;
    	// refColumn        0; i don't hav refColumn because it's not time Varying
    	 componentColumns (0 1 2); 
       }

      value uniform (0 0 0);
    }

Last edited by Dipsomaniac; October 29, 2016 at 11:48. Reason: Making it more explicit.
Dipsomaniac is offline   Reply With Quote

Old   October 29, 2016, 12:16
Default
  #8
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
Quote:
Originally Posted by Dipsomaniac View Post
Hi Roberto
after you have read in your CSV file. I am assuming it won't be used in the calculation and is just a place holder, but is required for the boundary condition to still be read correctly.
Hi Brian,
Thanks for your fast reply but, unfortunately, with this modification it works but it takes a null velocity boundary condition

Best Regards,
Roberto
FlyBob91 is offline   Reply With Quote

Old   October 29, 2016, 14:29
Default
  #9
Member
 
Brian Willis
Join Date: Mar 2011
Location: Cape Town, South Africa
Posts: 58
Rep Power: 15
Dipsomaniac is on a distinguished road
I am thinking that the fixedValue boundary condition can't be directly used with a CSV (external) file unfortunately. I am looking at other boundary conditions which may work for your purpose.
Dipsomaniac is offline   Reply With Quote

Old   October 30, 2016, 12:56
Default
  #10
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
Quote:
Originally Posted by FlyBob91 View Post
Hi Brian,
Thanks for your fast reply but, unfortunately, with this modification it works but it takes a null velocity boundary condition

Best Regards,
Roberto
In the second post you were not tthat far off: The lookuptable would work like this (adapt for your own need)
Code:
inlet {
  type groovyBC;
  valueExpression "profile(pos().y)*normal()";
  lookuptables (
     {
          name profile;
          readerType csv;
          fileName "$FOAM_CASE/profile.csv";
          outOfBounds clamp;
          timeColumn 0;
          valueColumns (1);
      }
  );
}
Have a look at the Examples/groovyBC/wobbler/0/D-file and the Documentation/swak4FoamReference.org in the swak4Foam-sources
Dipsomaniac and FlyBob91 like this.
__________________
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   November 3, 2016, 11:06
Default
  #11
Senior Member
 
FlyBob91's Avatar
 
Join Date: Mar 2016
Location: Bergamo
Posts: 157
Rep Power: 10
FlyBob91 is on a distinguished road
hi Bernhard, Thank you for you reply and contribution.
You were very clear, but i have only a last doubt about how setting the time column if i have a non time varying input field.


Best Regards,
Roberto
FlyBob91 is offline   Reply With Quote

Old   November 3, 2016, 14:05
Default
  #12
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
Quote:
Originally Posted by FlyBob91 View Post
hi Bernhard, Thank you for you reply and contribution.
You were very clear, but i have only a last doubt about how setting the time column if i have a non time varying input field.


Best Regards,
Roberto
"timeColumn" is just a name for the number of the column with the independent variable. It is named like this for historical reasons
__________________
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

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
[swak4Foam] groovyBC for oscillatory flow liybzd OpenFOAM Community Contributions 5 November 12, 2018 07:53
[swak4Foam] reactingMultiPhaseEulerFoam problems with groovyBC zanilu70 OpenFOAM Community Contributions 4 December 13, 2016 06:46
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 03:30
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 07:16
[swak4Foam] groovyBC and Eqn.setReference() benk OpenFOAM Community Contributions 3 June 2, 2011 08:49


All times are GMT -4. The time now is 18:40.