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

[swak4Foam] groovyBC for tractionDisplacement BC

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2011, 23:49
Question groovyBC for tractionDisplacement BC
  #1
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Hello FOAMers,

Can anyone please tell me if it is possible to apply groovyBC to the traction in the tractionDisplacement boundary condition used in stress solvers?

The BC is specified as:

type tractionDisplacement;
traction uniform ( 0 0 0 );
pressure uniform 0;
value uniform (0 0 0);

I would like to change the value of the traction as a function of time.

There is a nice example 'Wobbler' in the wiki (http://openfoamwiki.net/index.php/Co...oovyBC#wobbler) but that shows how to change the displacement value, not the traction or the pressure.

thanks for any input...
carowjp is offline   Reply With Quote

Old   March 10, 2011, 11:19
Default
  #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
Quote:
Originally Posted by carowjp View Post
Hello FOAMers,

Can anyone please tell me if it is possible to apply groovyBC to the traction in the tractionDisplacement boundary condition used in stress solvers?

The BC is specified as:

type tractionDisplacement;
traction uniform ( 0 0 0 );
pressure uniform 0;
value uniform (0 0 0);

I would like to change the value of the traction as a function of time.

There is a nice example 'Wobbler' in the wiki (http://openfoamwiki.net/index.php/Co...oovyBC#wobbler) but that shows how to change the displacement value, not the traction or the pressure.

thanks for any input...
Not out of the box I'm afraid. The solution would be to write a boundary condition groovyTractionDisplacement that is a subclass of tractionDisplacement. That class would add parameters tractionExpression and pressureExpression. In the method updateCoeffs these expressions would be evaluated, assigned to traction and pressure and the updateCoeffs of the superclass would be called.

There is a library groovyStandardBCs where this is demonstrated for the totalPressure. The library is currently only present in the development version that is in the Mercurial (not in the svn). Adapting this for tractionDiscplacement shouldn't be too hard if you know some C++.

Bernhard

PS: I don't plan to groovyify all existing boundary condtions. Only on a "as I need them" basis. But of course if somebody groovyified a boundary condition I will gladly include it (or you can push it yourself to the hg)
gschaider is offline   Reply With Quote

Old   March 10, 2011, 20:02
Default
  #3
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Not out of the box I'm afraid. The solution would be to write a boundary condition groovyTractionDisplacement that is a subclass of tractionDisplacement. That class would add parameters tractionExpression and pressureExpression. In the method updateCoeffs these expressions would be evaluated, assigned to traction and pressure and the updateCoeffs of the superclass would be called.

There is a library groovyStandardBCs where this is demonstrated for the totalPressure. The library is currently only present in the development version that is in the Mercurial (not in the svn). Adapting this for tractionDiscplacement shouldn't be too hard if you know some C++.

Bernhard

PS: I don't plan to groovyify all existing boundary condtions. Only on a "as I need them" basis. But of course if somebody groovyified a boundary condition I will gladly include it (or you can push it yourself to the hg)
Thank you for pointing me in the right direction Bernhard...
carowjp is offline   Reply With Quote

Old   March 20, 2011, 18:41
Question
  #4
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Bernhard,

I have used the groovyTotalPressureFvPatchScalarField code from the Hg debug version of swak4Foam as a guide to groovify the solidTractionDisplacement BC.

Unfortunately it is not working properly as the BC isn't applied & I receive the following warning:

Code:
Reading field DU
--> FOAM Warning : 
    From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 123
    No value defined for DU on traction therefore using 2{(0 0 0)}
The /0/DU file boundaryField has the following entry:

Code:
    traction
    {
        type groovyBC;
        tractionExpression "(time()<20e-6) ? vector(0,1e+06,0) : vector(0,0,0)";
        pressureExpression "0";
        valueExpression "vector(0,0,0)";
    }
Any hints on what I likely missed?

thx,

Jim
carowjp is offline   Reply With Quote

Old   March 21, 2011, 05:46
Default
  #5
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 carowjp View Post
Bernhard,

I have used the groovyTotalPressureFvPatchScalarField code from the Hg debug version of swak4Foam as a guide to groovify the solidTractionDisplacement BC.

Unfortunately it is not working properly as the BC isn't applied & I receive the following warning:

Code:
Reading field DU
--> FOAM Warning : 
    From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 123
    No value defined for DU on traction therefore using 2{(0 0 0)}
The /0/DU file boundaryField has the following entry:

Code:
    traction
    {
        type groovyBC;
        tractionExpression "(time()<20e-6) ? vector(0,1e+06,0) : vector(0,0,0)";
        pressureExpression "0";
        valueExpression "vector(0,0,0)";
    }
Any hints on what I likely missed?

thx,

Jim
At first you'll want to change the type of your BC from groovyBC to groovySolidTraction (or whatever it is that is is called in the TypeName-macro in the header of your class). The warning is not the problem. You can make it go away with "value uniform (0 0 0);"

Bernhard
gschaider is offline   Reply With Quote

Old   March 21, 2011, 12:04
Question
  #6
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Quote:
Originally Posted by gschaider View Post
At first you'll want to change the type of your BC from groovyBC to groovySolidTraction (or whatever it is that is is called in the TypeName-macro in the header of your class). The warning is not the problem. You can make it go away with "value uniform (0 0 0);"
Bernhard,

I have added this to the controlDict file:
libs( "libOpenFOAM.so" "libgroovyBC.so" "libgroovyStandardBCs");

is this correct?
I have also changed the name of the BC in the field file to match the type-name I created.

It seems that the BC is still not being recognized.

thanks for your help,

Jim
carowjp is offline   Reply With Quote

Old   March 21, 2011, 13:43
Default
  #7
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 carowjp View Post
Bernhard,

I have added this to the controlDict file:
libs( "libOpenFOAM.so" "libgroovyBC.so" "libgroovyStandardBCs");

is this correct?
I have also changed the name of the BC in the field file to match the type-name I created.

It seems that the BC is still not being recognized.

thanks for your help,

Jim
The libs entry is correct. Otherwise its hard to tell without the source

I'd suggest the following steps to check whether your BC is used:

1. Check the solver output for a warning about a generic-BC (that's an indication that an unknown BC is used)
1a. Set in the system-wide controlDict the disallowGeneric*-switches to 1
2. Add syntax errors to the expressions. If the simulation fails then your BC is used
3. Add an Info << traction() after the expression-evaluation in the updateCoeffs of your BC
4. Make sure that the updateCoeffs of the superclass is called in the end
gschaider is offline   Reply With Quote

Old   June 11, 2011, 22:57
Smile
  #8
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Hi Bernhard,

I see you will be presenting at OF6.. I will be there and hope to meet you.

best regards

James
carowjp is offline   Reply With Quote

Old   July 21, 2011, 17:20
Default update libraries
  #9
New Member
 
Thomas Walsh
Join Date: Nov 2010
Posts: 18
Rep Power: 16
thomasnwalshiii is on a distinguished road
Hi,

I am also trying to accomplish this with groovyTractionDisplacement. I have attached my .C and .H files. I used the groovyFlowRateInletVelocityFvPatchVectorField for the example files. I am not quite sure what to do next however. How do I get these file referenced by one of the boundary condition libraries? I noticed that there is also a .dep file for the other groovyStandardBCs. Do I have to re-make swak4Foam in order for this file to link up properly?
thomasnwalshiii is offline   Reply With Quote

Old   July 22, 2011, 15:56
Default wmake lib....
  #10
New Member
 
Thomas Walsh
Join Date: Nov 2010
Posts: 18
Rep Power: 16
thomasnwalshiii is on a distinguished road
I have figured out how to add my new groovyBC to the standard BCs library. I simply added my file's name, "groovyTractionDisplamentFvPatchVectorField.C" , to the Libraries->groovyStandardBCs->Make->files script and ran

>> wmake libso groovyStandardBCs/

This made the dependency files, but I ran into an error with the wmake process:

In file included from groovyTractionDisplacementFvPatchVectorField.C:33:
groovyTractionDisplacementFvPatchVectorField.H:44: 52: error: tractionDisplacementFvPatchVectorField.H: No such file or directory

Is there somewhere that I should be specifying the location of the original tractionDisplacementFvPatchVectorField.H? There is a lot of other errors reported after this one, but I have a feeling that they are caused from this one.

Thanks for any help,
Tom
thomasnwalshiii is offline   Reply With Quote

Old   July 25, 2011, 05:51
Default
  #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
Quote:
Originally Posted by thomasnwalshiii View Post
I have figured out how to add my new groovyBC to the standard BCs library. I simply added my file's name, "groovyTractionDisplamentFvPatchVectorField.C" , to the Libraries->groovyStandardBCs->Make->files script and ran

>> wmake libso groovyStandardBCs/

This made the dependency files, but I ran into an error with the wmake process:

In file included from groovyTractionDisplacementFvPatchVectorField.C:33:
groovyTractionDisplacementFvPatchVectorField.H:44: 52: error: tractionDisplacementFvPatchVectorField.H: No such file or directory

Is there somewhere that I should be specifying the location of the original tractionDisplacementFvPatchVectorField.H? There is a lot of other errors reported after this one, but I have a feeling that they are caused from this one.

Thanks for any help,
Tom
The original tractionDisplacement is found somewhere in $FOAM_SOLVERS/stressAnanlysis. You'll have to add the exact location to Make/options
gschaider is offline   Reply With Quote

Old   July 25, 2011, 13:52
Default compiling successful
  #12
New Member
 
Thomas Walsh
Join Date: Nov 2010
Posts: 18
Rep Power: 16
thomasnwalshiii is on a distinguished road
Bernhard,

Thanks for the reply! I've successfully compiled groovyTractionDisplacement using the following additions to the make->files & options scrips:

For files:

groovyTotalPressureFvPatchScalarField.C
groovyFlowRateInletVelocityFvPatchVectorField.C
groovyTractionDisplacementFvPatchVectorField.C

LIB = $(FOAM_USER_LIBBIN)/libgroovyStandardBCs

For options:

ifdef FOAM_DEV
FOAM_DEV_OPTION = -DFOAM_DEV
endif


EXE_INC =-I$(OBJECTS_DIR) \
$(FOAM_DEV_OPTION) \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I../groovyBC/lnInclude/ \
-I../swak4FoamParsers/lnInclude/ \
-I$(FOAM_SOLVERS)/stressAnalysis/solidDisplacementFoam/tractionDisplacement/


LIB_LIBS = -lfiniteVolume \
-lOpenFOAM \
-lsampling \
-L$(FOAM_USER_LIBBIN) \
-lgroovyBC \
-lswak4FoamParsers

I'll now have to see if my groovified boundary condition actually works. I'm making a case which will simulate the effects that a gasket has on a cover (how much it deforms). By using this new groovified boundary condition I am planing on adjusting the pressure applied to each face depending on its current (or last iteration) deformation. I will submit my case example if it is a success. If anyone has any alternative solutions or solvers that already can accomplish this goal please let me know. The pressure vs deformation for my current case has a non-linear relation.

Tom
thomasnwalshiii is offline   Reply With Quote

Old   July 26, 2011, 12:19
Default Compilation Error
  #13
New Member
 
Thomas Walsh
Join Date: Nov 2010
Posts: 18
Rep Power: 16
thomasnwalshiii is on a distinguished road
It seems that I have not successfully compile groovyTractionDisplacement or that I have an error within my code. When attempting to run a simulation with the groovyTract... BC I get the following error:

--> FOAM Warning :
From function dlLibraryTable:pen(const fileName& functionLibName)
in file db/dlLibraryTable/dlLibraryTable.C at line 78
could not load /home/twalsh/OpenFOAM/twalsh-1.7.0/lib/linux64GccDPOpt/libgroovyStandardBCs.so: undefined symbol: _ZN4Foam38tractionDisplacementFvPatchVectorField7a utoMapERKNS_18fvPatchFieldMapperE
Create mesh for time = 0

I also noticed that I get an error message while compiling the dependent files, below shows the last two lines of text written during the wmake libso groovyStandardBCs:

collect2: ld returned 1 exit status
make: *** [OpenFOAM.out] Error 1

I'm not sure what this Error 1 is or where it comes from. I have attached the log file, but can't seem to see what this error references. Any assistance would be appreciated.

Tom
Attached Files
File Type: txt wmake_log_file_A.txt (55.0 KB, 5 views)
thomasnwalshiii is offline   Reply With Quote

Old   July 27, 2011, 11:45
Default
  #14
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 thomasnwalshiii View Post
It seems that I have not successfully compile groovyTractionDisplacement or that I have an error within my code. When attempting to run a simulation with the groovyTract... BC I get the following error:

--> FOAM Warning :
From function dlLibraryTable:pen(const fileName& functionLibName)
in file db/dlLibraryTable/dlLibraryTable.C at line 78
could not load /home/twalsh/OpenFOAM/twalsh-1.7.0/lib/linux64GccDPOpt/libgroovyStandardBCs.so: undefined symbol: _ZN4Foam38tractionDisplacementFvPatchVectorField7a utoMapERKNS_18fvPatchFieldMapperE
Create mesh for time = 0

I also noticed that I get an error message while compiling the dependent files, below shows the last two lines of text written during the wmake libso groovyStandardBCs:

collect2: ld returned 1 exit status
make: *** [OpenFOAM.out] Error 1

I'm not sure what this Error 1 is or where it comes from. I have attached the log file, but can't seem to see what this error references. Any assistance would be appreciated.

Tom
By adding the include you only said "that is what your parent class will look like" (the declaration) but no actual code was added (that definition is in tractionDisplacementFvPatchFields.o or so). Usually that .o file is linked into the solidDisplacement-Solvers. Are you using one of those? If not is the corresponding .C-file specified in your custom solver?

Linking the .o-file into the library is not a good idea because if that gets loaded by a stock-solver then there are two definitions of the class and the loading will fail also.

If the definition of the parent class IS in the used solver (make sure by grepping the solver-binary for the symbol that was reported missing) then something strange is going on.

Bernhard
gschaider is offline   Reply With Quote

Old   August 1, 2011, 04:27
Thumbs up This is what I did...
  #15
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Have a look at the attachment...there is a README file, make folder, and groovyTractionDisplacement .H and .C files.

cheers,

James
Attached Files
File Type: gz tDFvPatchVectorField.tar.gz (2.4 KB, 49 views)
Behzad Taghilou likes this.
carowjp is offline   Reply With Quote

Old   April 8, 2014, 11:24
Default tractionDisplacement groovybc
  #16
New Member
 
Join Date: Mar 2014
Posts: 23
Rep Power: 12
Brayanashel is on a distinguished road
Hi,

Is there a groovybc for tractionDisplacement, please?
Brayanashel is offline   Reply With Quote

Old   April 8, 2014, 11:36
Default tractionDisplacement groovybc
  #17
Member
 
carowjp's Avatar
 
Jim Carow
Join Date: Apr 2010
Location: Michigan, USA
Posts: 41
Rep Power: 16
carowjp is on a distinguished road
Please have a look at the attachment in my previous post. It contains the boundary condition you are looking for.

regards,

James
carowjp is offline   Reply With Quote

Old   April 9, 2014, 11:48
Default
  #18
New Member
 
Join Date: Mar 2014
Posts: 23
Rep Power: 12
Brayanashel is on a distinguished road
Could you please let me know how to compile the code for OF-1.6-ext?

Regards
Brayanashel is offline   Reply With Quote

Old   April 9, 2014, 14:25
Default Compiling Custom Boundary
  #19
New Member
 
Thomas Walsh
Join Date: Nov 2010
Posts: 18
Rep Power: 16
thomasnwalshiii is on a distinguished road
Hi,

Its been a while since I compiled a custom boundary condition, but if you read through this post you should be able to get it working. Looks like Jim Carow also added a text file in his attachment that tells you how to, so check that out.
thomasnwalshiii is offline   Reply With Quote

Old   September 7, 2016, 15:27
Default
  #20
New Member
 
Behzad Taghilou
Join Date: Jul 2016
Posts: 7
Rep Power: 10
Behzad Taghilou is on a distinguished road
Quote:
Originally Posted by carowjp View Post
Have a look at the attachment...there is a README file, make folder, and groovyTractionDisplacement .H and .C files.

cheers,

James
Hello James
I want to use your attachment files "groovyTractionDisplacement".
What is the valid OF version for your groovyStandardBC?
My current OF version is FOAM-extended 3.2?
I tried to compile it first time, but It was not compiled.
Will It work with this version? Or should I compile it once again?

thank you.

Behzad Taghilou

Last edited by Behzad Taghilou; September 8, 2016 at 03:50.
Behzad Taghilou is offline   Reply With Quote

Reply

Tags
boundary condition, groovybc, traction, tractiondisplacement


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


All times are GMT -4. The time now is 12:46.