|
[Sponsors] |
[sedFoam] codedFixedValue does not transport alpha fields |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Victor Baconnet
Join Date: Apr 2021
Location: Cannes, France
Posts: 9
Rep Power: 5 ![]() |
Hello everyone,
I am running a simulation using sedFoam for sediment transport applications, which is modified from the twoPhaseEulerFoam solver. Case description I won't get into much details about the geometry etc since it is not relevant for my problem. In a nutshell, my inlet velocity profile is given with codedFixedValue to implement a log-law velocity profile. The solid (sediment) phase, named alpha_a, has similar codedFixedValue boundary conditions to set the sediment concentration throughout the domain. Initially, alpha_a has the following distribution all over the domain (excerpt of my 0/alpha_a file) : Code:
forAll(Cf, faceI) { field[faceI] = 0.6128*0.5 *(1.0+tanh((2-Cf[faceI].y())*5000)) +1e-100; } initial_alpha_a_distribution.png Now, what I would like to do, is to set a higher alpha_a value at the inlet boundary, kind of like "injecting" a higher concentration at the inlet and seeing how it transports in the domain. Consequently, I changed my 0/alpha_a file to : Code:
forAll(Cf, faceI) { field[faceI] = 0.6128*0.5 *(1.0+tanh((2-Cf[faceI].y())*5000)) +1e-100; if ( Cf[faceI].y() >= 2.0 ) { field[faceI] += 0.05; } } Issue description The issue is, the value alpha_a=0.05 on the inlet boudary works fine, but alpha_a is not transported into the domain (see following picture) zoom.png As you can see on this picture, alpha_a is set to 0.05 on the boundary. What I have tried so far Instead of codedFixedValue, if I set my velocity profile as a fixedValue of (0.5 0 0) for example, alpha_a is properly transported throughout the domain exactly as I wanted. So I would think the issue comes from the codedFixedValue boundary condition for the velocity profile. EDIT: Using GroovyBC to set the log velocity profile transports alpha_a properly, and solves my problem. I still keep this thread open because I'd love to get an explanation on why codedFixedValue doesn't work. This is what the codedFixedValue for the velocity profile looks like: Code:
inlet { type codedFixedValue; value uniform (0 0 0); name inlet; codeInclude #{ #include "fvCFD.H" #}; codeOptions #{ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude #}; codeLibs #{ -lfiniteVolume \ -lmeshTools #}; code #{ const fvPatch& boundaryPatch = patch(); const vectorField& Cf = boundaryPatch.Cf(); vectorField& field = *this; scalar t = this->db().time().value(); forAll(Cf, faceI) { if (Cf[faceI].y() > 2) { if (t <= 4.0) { // Linearly increasing velocity magnitude under t=4s field[faceI] = (0.1 + 0.9*(t/4.0)) *vector ( 0.04318/0.41 *log(30*(Cf[faceI].y()-2) /9e-4), 0, 0 ); } else { //This is the original velocity profile field[faceI] = vector ( 0.04318/0.41 *log(30*(Cf[faceI].y()-2) /9e-4), 0, 0 ); } } else { //velocity is 0 under y=2 which is the sediment bed field[faceI] = vector(0,0,0); } } #}; } Why does codedFixedValue not transport the alpha_a field? Clearly, setting a velocity fixedValue at the inlet works fine, so what did I miss? I have attached my 0/alpha_a and 0/Ua files in case anybody wants to have a closer look. If you need more files/details, please let me know - I'm happy to provide any additional information. Cheers and thanks in advance for any help. alpha_a.txtUa.txt Last edited by victor13165; July 13, 2021 at 09:34. Reason: Problem solved |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
multiphaseEulerFoam: efficient way of implementing fields for all phases | maybee | OpenFOAM Programming & Development | 0 | January 23, 2014 04:16 |
a reconstructPar issue | immortality | OpenFOAM Post-Processing | 8 | June 16, 2013 11:25 |
an odd(at least for me!) reconstructPar error on a field | immortality | OpenFOAM Running, Solving & CFD | 3 | June 3, 2013 22:36 |
Missing fields in reconstructPar | flowris | OpenFOAM | 1 | July 9, 2010 02:48 |
PostChannel | maka | OpenFOAM Post-Processing | 5 | July 22, 2009 09:15 |