CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   groovyBC for tractionDisplacement BC (http://www.cfd-online.com/Forums/openfoam/85875-groovybc-tractiondisplacement-bc.html)

carowjp March 8, 2011 23:49

groovyBC for tractionDisplacement BC
 
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...

gschaider March 10, 2011 11:19

Quote:

Originally Posted by carowjp (Post 298522)
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)

carowjp March 10, 2011 20:02

Quote:

Originally Posted by gschaider (Post 298864)
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 March 20, 2011 18:41

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

gschaider March 21, 2011 05:46

Quote:

Originally Posted by carowjp (Post 300250)
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

carowjp March 21, 2011 12:04

Quote:

Originally Posted by gschaider (Post 300314)
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

gschaider March 21, 2011 13:43

Quote:

Originally Posted by carowjp (Post 300380)
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

carowjp June 11, 2011 21:57

Hi Bernhard,

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

best regards

James

thomasnwalshiii July 21, 2011 16:20

update libraries
 
2 Attachment(s)
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 July 22, 2011 14:56

wmake lib....
 
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

gschaider July 25, 2011 04:51

Quote:

Originally Posted by thomasnwalshiii (Post 317153)
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

thomasnwalshiii July 25, 2011 12:52

compiling successful
 
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 July 26, 2011 11:19

Compilation Error
 
1 Attachment(s)
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::open(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

gschaider July 27, 2011 10:45

Quote:

Originally Posted by thomasnwalshiii (Post 317562)
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::open(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

carowjp August 1, 2011 03:27

This is what I did...
 
1 Attachment(s)
Have a look at the attachment...there is a README file, make folder, and groovyTractionDisplacement .H and .C files.

cheers,

James

Brayanashel April 8, 2014 10:24

tractionDisplacement groovybc
 
Hi,

Is there a groovybc for tractionDisplacement, please?

carowjp April 8, 2014 10:36

tractionDisplacement groovybc
 
Please have a look at the attachment in my previous post. It contains the boundary condition you are looking for. :D

regards,

James

Brayanashel April 9, 2014 10:48

Could you please let me know how to compile the code for OF-1.6-ext?

Regards

thomasnwalshiii April 9, 2014 13:25

Compiling Custom Boundary
 
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.


All times are GMT -4. The time now is 10:45.