CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Custom Boundary Condition with OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree21Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2010, 22:04
Default
  #21
Member
 
Ovie Doro
Join Date: Jul 2009
Posts: 99
Rep Power: 17
ovie is on a distinguished road
Quote:
Originally Posted by nishant_hull View Post
Hi Ovie
Thanks for reply. The pressure boundary condition is as follows:

inlet
{
type inletOutlet;
inletValue uniform 1e5;
value uniform 1e5;
}

outlet
{
type waveTransmissive;
field p;
phi phi;
rho rho;
psi psi;
gamma 1.3;
fieldInf 1e5;
lInf 0.3;
value uniform 1e5;
}


Thanks & regards,

Nishant

I actually had a similar experience today simulating a falling film using interFoam with the MULES explicit solver for alpha1. I am not quite certain but the pressure might not really be the problem. In my case, the time step kept shrinking SO I switched to the MULES::Implicit solver and the error message stopped.

I dont know if reducing the CN for the explicit solver might help though but I intend to experiment with that as well and see how low I can go before the solution becomes stable.
ovie is offline   Reply With Quote

Old   June 11, 2010, 13:58
Default
  #22
Member
 
Ovie Doro
Join Date: Jul 2009
Posts: 99
Rep Power: 17
ovie is on a distinguished road
Hi nishant,

The floating point exception error usually results from illegal algebraic operations. You may check these links on the forum to see if they could shed any light:
http://www.cfd-online.com/Forums/ope...exception.html.
http://openfoamwiki.net/index.php/HowTo_debugging

Typically such errors are a consequence of wrong bcs primarily.
ovie is offline   Reply With Quote

Old   June 11, 2010, 21:45
Default
  #23
Senior Member
 
Nishant
Join Date: Mar 2009
Location: Glasgow, UK
Posts: 166
Rep Power: 17
nishant_hull is on a distinguished road
Quote:
Originally Posted by ovie View Post
Hi nishant,

The floating point exception error usually results from illegal algebraic operations. You may check these links on the forum to see if they could shed any light:
http://www.cfd-online.com/Forums/ope...exception.html.
http://openfoamwiki.net/index.php/HowTo_debugging

Typically such errors are a consequence of wrong bcs primarily.
Hi Ovie,

As I am not working on interfoam sort of solver, I think MULES implicit solver would not be useful for me?
However the last link look useful. I will try those and let you know how it worked.

Thanks & regards,

Nishant
nishant_hull is offline   Reply With Quote

Old   June 11, 2010, 23:06
Default
  #24
Member
 
Ovie Doro
Join Date: Jul 2009
Posts: 99
Rep Power: 17
ovie is on a distinguished road
Hi Nishant,

Please check your variable initializations for the internal fields. I used non zero values and the error stopped. This might help. I found it from the second link in the last message.

Sorry about the confusion with the MULES solvers.

regards..
ovie is offline   Reply With Quote

Old   July 24, 2010, 21:19
Default
  #25
Senior Member
 
Nishant
Join Date: Mar 2009
Location: Glasgow, UK
Posts: 166
Rep Power: 17
nishant_hull is on a distinguished road
Thanks guys. Does any one know how to access the patchField from previous time step? is there any easy way to do it?

regards,

Nishant
nishant_hull is offline   Reply With Quote

Old   July 24, 2010, 22:46
Default
  #26
Senior Member
 
Nishant
Join Date: Mar 2009
Location: Glasgow, UK
Posts: 166
Rep Power: 17
nishant_hull is on a distinguished road
I want to access the patchField value from the last time (current_time - 1) and then take avergae value of the current and previous value of patchField and impose it as a boundary condition.
Is there any easy way to access previous iteration patchField value? for example, something like ... patchField.this->db().time().timeIndex()-1 ???

regards,

Nishant
nishant_hull is offline   Reply With Quote

Old   November 4, 2010, 11:19
Default Dynamically linked BC not recognized by simpleFoamResidual
  #27
Member
 
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17
andrea is on a distinguished road
Hi,
maybe one of you has already faced the problem, I created my own BC and linked it dynamically in $(FOAM_USER_LIBBIN) but post-processing tool simpleFoamResidual
cannot recognize it, do you know how to fix this?
Thanks
Andrea

Code:
--> FOAM FATAL IO ERROR: 
Unknown patchField type evaporationVelocity for patch type patch

Valid patchField types are :

50
(
SRFVelocity
activeBaffleVelocity
advective
calculated
cyclic
cylindricalInletVelocity
directMapped
directMappedVelocityFlux
directionMixed
empty
fixedGradient
fixedInternalValue
fixedNormalSlip
fixedValue
flowRateInletVelocity
fluxCorrectedVelocity
freestream
inletOutlet
mixed
movingWallVelocity
oscillatingFixedValue
outletInlet
outletMappedUniformInlet
partialSlip
pressureDirectedInletOutletVelocity
pressureDirectedInletVelocity
pressureInletOutletVelocity
pressureInletUniformVelocity
pressureInletVelocity
pressureNormalInletOutletVelocity
processor
rotatingPressureInletOutletVelocity
rotatingWallVelocity
sliced
slip
supersonicFreestream
surfaceNormalFixedValue
swirlFlowRateInletVelocity
symmetryPlane
timeVaryingFlowRateInletVelocity
timeVaryingMappedFixedValue
timeVaryingMappedPressureDirectedInletVelocity
timeVaryingUniformFixedValue
timeVaryingUniformInletOutlet
translatingWallVelocity
turbulentInlet
uniformFixedValue
waveTransmissive
wedge
zeroGradient
)


file: /home/andrea/OpenFOAM/andrea-1.7.1/run/testMesh2Cor2P/16.0253/U::boundaryField::tub from line 111739 to line 111740.

    From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<Type, volMesh>&, const dictionary&)
    in file /opt/openfoam171/src/finiteVolume/lnInclude/newFvPatchField.C at line 110.

FOAM exiting
andrea is offline   Reply With Quote

Old   July 30, 2012, 14:46
Default
  #28
Senior Member
 
mahdi abdollahzadeh
Join Date: Mar 2011
Location: Covilha,Portugal
Posts: 153
Rep Power: 15
mm.abdollahzadeh is on a distinguished road
Quote:
Originally Posted by marupio View Post
1. Choose a boundary condition that is close, and copy the directory contents to anywhere (say run/myCode). oscillatingFvPatchField might be a good one to start with.

2. Rename all the copied files to a new name (say customJetPatchField or something).

3. Search & replace all text in all the new files old name for new name (oscillatingFvPatchField replaced with customJetPatchField)

4. Modify the code to suit your needs. (How's your C++?)

5. Create the directory structure: myCode/Make, and create files and options in it.

6. Under files, define the main source file (look under finiteVolume/Make/files, and copy / rename the relevant entry from the patch field you copied). Also tell it what the new library name will be. Use $(FOAM_USER_LIBBIN) instead of $(FOAM_LIBBIN). It should look something like:
customJetPatchFields.C

LIB = $(FOAM_USER_LIBBIN)/libcustomJetPatchField


7. The options file should have EXE_INC (for any includes such as finiteVolume) and LIB_LIBS (for included libraries, again finite Volume). Look at other LIB_LIBS for examples. Should probably look like:
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude

LIB_LIBS = \
-lfiniteVolume

etc..

8. $wmake libso customJetPatchField

9. Add whatever new dictionary entries are needed to your 0/U and 0/P files.

10. Add libs ( "libcustomJetPatchField" ) to controlDict

11. It should run now.

Common mistakes are not linking the correct file in Make/files. It isn't the one you might think. Remember to copy what finiteVolume/Make/files does for the patch field you chose. Another mistake is forgetting the libso in wmake. Good luck!
Dear David

I have created my boundary condition according to your steps.
but when running my case it can not recognize the patch name.

could you please help me?

best
Mahdi
mm.abdollahzadeh is offline   Reply With Quote

Old   September 8, 2012, 12:22
Default
  #29
New Member
 
Join Date: Aug 2012
Posts: 4
Rep Power: 14
Tensai is on a distinguished road
Hello foamers!

I am a new OpenFOAM user and I have been trying to create a new boundary condition using the tutorial posted on this thread and on the wiki. I followed the tutorials to the letter (at least I think!) and I managed to compile my boundary condition without any error.

However, when I tried to use the newly created boundary condition in a case, I got the same error message as Andrea two posts above. Any suggestion as to how to solve this problem?

By the way, I am using OpenFOAM 2.1.0.

Thanks
Tensai is offline   Reply With Quote

Old   September 8, 2012, 14:00
Default
  #30
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
When you run it, it isn't loading the library containing your boundary condition. Do you have the correct entries in the controlDict? I think it's called "libs". If you have the correct entries, check to see if it is actually loading... is there a --> FOAM Warning at the very start that informs you it could not load a library?
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   September 8, 2012, 14:09
Default
  #31
New Member
 
Join Date: Aug 2012
Posts: 4
Rep Power: 14
Tensai is on a distinguished road
Thank you for your quick reply. I figured it would be a problem of library. In the controtDict for the library I added "libWindkessel.so". libWindkessel is the name of the library that was used in the files file. Anyway I can't get an answer right now regarding the error. I will probably only get it Monday when I have access to the machine I use for the simulations at the university.
Tensai is offline   Reply With Quote

Old   September 10, 2012, 05:48
Default
  #32
New Member
 
Join Date: Aug 2012
Posts: 4
Rep Power: 14
Tensai is on a distinguished road
Ok I just checked the error message and here is what I got at the start of it:

Quote:
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : /home/ese/mb483/OpenFOAM/mb483-2.1.0/platforms/linux64GccDPOpt/lib/libWindkessel4FvPatchScalarField.so: undefined symbol: _ZTVN4Foam29Windkessel4FvPatchScalarFieldE
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libWindkessel4FvPatchScalarField.so"
I don't know how and where to track this unknown symbol. If you have any idea, please feel free to pitch it to me.

Last edited by Tensai; September 11, 2012 at 08:21.
Tensai is offline   Reply With Quote

Old   September 11, 2012, 15:01
Default
  #33
New Member
 
Join Date: Aug 2012
Posts: 4
Rep Power: 14
Tensai is on a distinguished road
I just solved my problem. If it can be of any help to people stuck with a similar problem, the issue resided in the header file. I forgot to remove a member function of the original boundary condition that I had no use of.
Tensai is offline   Reply With Quote

Old   March 25, 2013, 05:51
Default queries in preparing boundary conditions
  #34
Senior Member
 
starter
Join Date: Sep 2012
Posts: 125
Rep Power: 16
sihaqqi is on a distinguished road
@David Gaden and other experts


I am a student of MS by research in CFD and a beginner with openFoam. I found your steps helpful but I am stuck in the following instances


According to your steps 5 and 6
  1. Create the directory structure: myCode/Make, and create files and options in it.
  2. Under files, define the main source file …...customJetPatchFields.C
    LIB = $(FOAM_USER_LIBBIN)/libcustomJetPatchField

    I have copied these two from system opt/openfoam/finiteVolume/Make folder and deleted all the patch names in it and deleted all entries except only the two lines you have written. Is it alright or should I let all entries stay there whic are there when you copy original file from Make folder and just add my line and change the last line to
    LIB =$(FOAM_USER_LIBBIN)/libcustomJetPatchField

    8. $wmake libso customJetPatchField
    When I type this command in withoutcustomJetPatchField. it gives me the following error: no rules to make target “ customJetPatchField.dep” needed by Make linux 64 GCcDP0pt/dependecies”. Stop
    When I type full command as you have written with customJetPatchField, the error is cannot find customJetPatchField. What does this mean

    10. Add libs ( "libcustomJetPatchField" ) to controlDict
    Where should I add this, In controlDict file, can you identify by attaching your own controldict file so that I can see where amongst the program of time you have included it to avoid mistakes

    I shall be very grateful for these answers.
    Best Regards
sihaqqi is offline   Reply With Quote

Old   November 3, 2014, 08:19
Default
  #35
Senior Member
 
Muhammad Waqas
Join Date: Jul 2014
Location: Germany
Posts: 122
Rep Power: 12
mwaqas is on a distinguished road
Send a message via Skype™ to mwaqas
Hello Everyone

I am trying to implement / compile new boundary condition in OF 2.3.0. I have followed the same steps as above. I have code for my new boundary condition. But when I try to compile boundary condition by typing "$ wmake libso " I get the following error

waqas@waqas-Inspiron-N5050:~/OpenFOAM/waqas-2.3.0/myCode$ wmake libso
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file particleSlip/particleSlipVelocityFvPatchVectorField.C
Making dependency list for source file particleSlip/particleSlipThetaFvPatchScalarField.C
make: *** No rule to make target `twoPhaseEulerFoam.dep', needed by `Make/linux64GccDPOpt/dependencies'. Stop.

I think there is something missing in "Make/files"

Because when I try to implement my new boundary condition in 0/U. solver does not read new boundary condition.
mwaqas is offline   Reply With Quote

Old   November 6, 2014, 22:54
Default
  #36
New Member
 
Sean
Join Date: Nov 2014
Posts: 3
Rep Power: 12
SeanOpenfoam is on a distinguished road
mwaqas,

Did you get an answer to your question? I've been having the same problem on OpenFOAM-2.3.0

So far, I've followed the 11-step advice posted before by marupio. I made no changes to the condition itself--I simply renamed it, updated the appropriate files, and put it into my user-folder (i.e. /home/sean/OpenFOAM/Sean-2.3.0/src/finiteVolume/fields/fvPatchFields/derived). When I near the end of the 11 steps, I give the wmake command and get the same "*** No rule to make target . . ." error that you described, and when I try to run a case, my new boundary condition isn't recognized. Note that for me, the command "$wmake libso myUniformFixedValue" doesn't do anything. I simply typed "wmake" in the "/home/sean/OpenFOAM/Sean-2.3.0/src/finiteVolume" directory where my Make folder is located.

However! I repeated the 11-step advice as I described above, but instead of putting my new boundary condition into my personal OpenFOAM folder, I put it into the original OpenFOAM installation (i.e. /home/sean/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/fields/fvPatchFields/derived). When I gave the "wmake" command, it seemed to work, and indeed when I examined the files in /home/sean/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/fields/fvPatchFields/derived/myUniformFixedValue, I found the .dep file exactly where it should be. Unfortunately, when I tried to run a case, the solver still wouldn't recognize my boundary condition (perhaps I'll have to edit the actual solver's .C file and force it to look in the correct spot for my constraint? Or maybe use wmake in the /applications directory? Not sure how to solve this issue yet).

Anyways, there's some food for thought.
SeanOpenfoam is offline   Reply With Quote

Old   November 7, 2014, 04:53
Default
  #37
Senior Member
 
Muhammad Waqas
Join Date: Jul 2014
Location: Germany
Posts: 122
Rep Power: 12
mwaqas is on a distinguished road
Send a message via Skype™ to mwaqas
Hello Sean

I am still stuck on the same point as mentioned above. I tried to add boundary condition in my personal folder and got same error "*** No rule to make target ***".
I also tried to add boundary condition directory into original OpenFoam installation but I was not able to add over there. If I will get something and update here.
Also if you get something please post here. Thank you

Best Regards
mwaqas is offline   Reply With Quote

Old   November 7, 2014, 11:02
Default
  #38
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
"No rule to make target" is OpenFOAM for "the filename listed in Make/files cannot be found" - edit Make/files to make sure it is correct. Or it could also mean that an old .dep file is referencing a non-existent file. rmdepall clears this up.

If you compile successfully, make sure you add the library to your case directory's controlDict libs entry.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   November 16, 2014, 19:24
Default
  #39
New Member
 
Sean
Join Date: Nov 2014
Posts: 3
Rep Power: 12
SeanOpenfoam is on a distinguished road
I think I finally got my "custom" boundary conditions to work. After deleting all of my old mistakes, I:

1) created a copy of my OpenFOAM-2.3.0 folder and renamed it to sean-2.3.0 to make it my FOAM_USER location. I'm not sure if it's necessary to copy everything from the OpenFOAM-2.3.0 folder, but hey, it worked for me.

2) followed the steps marupio laid out, except that instead of putting my "custom" boundary conditions in a myCode/BC folder, I matched the file structure of OpenFOAM. For example, a fvPatchField would go in sean-2.3.0/src/finiteVolume/fields/fvPatchFields etc etc etc, just like it would in my original OpenFOAM installation.

I think a lot of my problems were related to putting my custom BC's in the correct folders, as well as getting consistent naming in their files. I found it very easy to accidentally type fvsPatchFields when I meant to type fvPatchFields, even though I used copy-paste a lot. So, marupio, I think that your previous post was quite correct.

Anyways, after following these steps, I successfully compiled my code and ran test cases with it.

Thanks a bunch!
SeanOpenfoam is offline   Reply With Quote

Old   November 30, 2014, 12:46
Default
  #40
Senior Member
 
Muhammad Waqas
Join Date: Jul 2014
Location: Germany
Posts: 122
Rep Power: 12
mwaqas is on a distinguished road
Send a message via Skype™ to mwaqas
Hello Everyone
I have compiled my new boundary condition but when i try to run my case, I get following error

Create time

fileName::stripInvalid() called for invalid fileName air(copy).outlet~
For debug level (= 2) > 1 this is considered fatal
Aborted (core dumped)

Can anyone please tell me what could be the possible error. Thank you

PS: I am using twoPhaeEulerFoam for fluidisedbed, I have made changes in my 0/U.particles boundary condition
mwaqas 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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
how to set up a wall boundary condition according to calculated wall shear stress? gameoverli OpenFOAM Pre-Processing 1 May 21, 2009 09:28
Help Urgent about changing boundary condition Anjum Naveed FLUENT 7 August 14, 2006 13:25
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15
How to resolve boundary condition problem? sam FLUENT 2 July 20, 2003 03:19


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