simphony / simphony-openfoam

The implementation of the SimPhoNy OpenFOAM -wrappers.
GNU General Public License v2.0
2 stars 0 forks source link

Enhancements for contactAngle BC treatment #76

Open TobiasRasp opened 8 years ago

TobiasRasp commented 8 years ago

In order to deal with contact angle boundary conditions in the OpenFoam wrapper (necessary for task 5.4), I propose to add two points to the code:

  1. It would be great to be able to set the maximum Courant number to a value different to the default one, which is 1.0. I realized that the default value is too high causing unrealistic results in the case of bubble flow in a channel. Setting maxCo in the user script and map it to controlDict in foam_dicts.py can be done similar to CUBA.TIME_STEP etc. But for this CUBA.MAX_CO must first be included in the cuba list, of course.
  2. Appending
elif volumeFractionBCs[boundary][0] == "wettingAngle":
                    myDict = myDict + "\t type \t constantAlphaContactAngle;\n"
                    myDict = myDict + "\t theta0 \t" + str(volumeFractionBCs[boundary][1]) + ";\n"
                    myDict = myDict + "\t limit \t gradient;\n"
                    myDict = myDict + "\t value \t uniform 0;\n"

to the volumeFractionBCs block of modify_fields in foam_dicts.py allows the user to apply contact angle BCs at the walls by setting e.g.

wrapper.BC[CUBA.VOLUME_FRACTION] = {'inlet': ('fixedValue', 1),
                                    'outlet': 'zeroGradient',
                                    'walls': ('wettingAngle', 150),
                                    'frontAndBack': 'empty'}

The naming "wetting angle" can be adapted and was just my choice for testing.

TobiasRasp commented 8 years ago

Hi Kai,

I tried to test the new release with my example that is about a bubble floating through a channel driven by a pressure gradient (see attached below. Again I had to change the file extension from py to txt for uploading purposes).

However, it failed! The error message for the IO wrapper is:

--> FOAM FATAL IO ERROR: keyword type is undefined in dictionary "IStringStream.sourceFile.inlet" file: IStringStream.sourceFile.inlet From function dictionary::lookupEntry(const word&, bool, bool) const in file db/dictionary/dictionary.C at line 437. FOAM exiting

Same for the internal wrapper, but with a different error message: Traceback (most recent call last): File "bubbles_V2_phil.py", line 91, in <module> mesh_inside_wrapper.update_cells(updated_cells) File "/W5/ras/SimPhoNy/OpenFoam/Wrapper-Tests/Test_ContAngle/simphony-openfoam/foam_internalwrapper/foam_mesh.py", line 439, in update_cells create_dummy_celldata(self.name, dataName) File "/W5/ras/SimPhoNy/OpenFoam/Wrapper-Tests/Test_ContAngle/simphony-openfoam/foam_internalwrapper/mesh_utils.py", line 56, in create_dummy_celldata dimension) RuntimeError: request for volScalarField p_rgh from objectRegistry region0 failed available objects of type volScalarField are 0()

By the way, also the dahl(_rel_vel) examples crashed in my case for both IO and internal, which is true also for the master branch! Can you please check that as well. Just to make sure that it is not due to my installation.

bubbles_hydrophil.txt

wetAngleMeshDict_Version1.txt

khiltunen commented 8 years ago

Hi Tobias,

wrapper did not had flowRate BC implemented. I added that and pushed changes to branch. I'll look at that dahl example later. It might be something to do with the fixedFluxPressure BC...

TobiasRasp commented 8 years ago

OK, thanks! I'll check the changes on Monday since I'm off now for the weekend already.

TobiasRasp commented 7 years ago

Oh, you are right! I additionally added the flowRate BC to get my example running. Thanks a lot for adding it to the new repository version! So, the error message was due to this extra change from my side. My example is running now with the current version also on my machine!