Hi,
I was wondering if anyone
Hi,
I was wondering if anyone had an example of using the twoLiquidMixingFoam solver that they would be willing to share? The user and programer's reference don't seem to have one. I am interested in modeling some microfluidic mixers. Cheers Shawn Pfeil |
Enjoy,
http://www.cfd-onli
|
I noticed in the controlDictio
I noticed in the controlDictionary the solver is interFoam is twoLiquidMixingFoam not used? I'm a little bit of a newbie.
Thanks, |
Hi Hrv, (and others)
I went t
Hi Hrv, (and others)
I went to run the example you sent and got the following error: --> FOAM FATAL ERROR : gradientInternalCoeffs cannot be called for a defaultFvPatchField. (Actual type fixedMeanValue) You are probably trying to solve for a field with a default boundary conditions. From function defaultFvPatchField<type>::gradientInternalCoeffs( ) const in file fields/fvPatchFields/basicFvPatchFields/default/defaultFvPatchField.C at line 421. FOAM exiting I noticed that when defining the boundary conditions you used an auxilary file outside of the blockMesh dictionary. The file boundary in the polyMesh/ directory. I'm a little new to OpenFOAM and am not entirely sure how this works. If somone has the time to clue me in I would greatly appreciate it. All the examples in the programing guide appear to have b.c.'s self contained in the blockMeshDictonary. Putting them in a seperate file has obvious advantages. I suspect my problem is that I have not figured out how to tell interFoam to look for the boundary file. Cheers, Shawn |
Aha, that's one of my new boun
Aha, that's one of my new boundary conditions: change it to fixedValue and all will be well.
Hrv |
Hi,
I still a little confused
Hi,
I still a little confused. Is defaultFvPatchField a boundary condition you wrote? If so where is it referenced that I need to replace with a fixedValue? I didn't see it in the .OpenFOAM-1.3/Fields directory. Or do I need to replace some of the conditions in the blockMeshDictionary with fixedValue? Sorry for all the newbie questions. Shawn |
edit 0/pd, line 42: change fix
edit 0/pd, line 42: change fixedMeanValue into fixedValue.
In any case, here's an updated version. Hrv http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif twoStream.tgz For the discussion on default b.c. please have a look through the forum - I have already explained this ad nauseum. :-) |
I figured it out.
I figured it out.
|
Hi,
I was wondering if their
Hi,
I was wondering if their is a simple way to make the viscosity in twoLiquidMixing foam a function of gamma. I am interested in mixing two newtonian liquids where the viscosity is a function of the fraction gamma. It seems like this should be fairly straightforward to code, but I wanted to ask the various c++ and OpenFoam masters before I invest the time. Also, if you could point me to the part of the code I need to tinker with that would be great. Shawn |
1 Attachment(s)
Hi, Dear Foamers, I update the example case using twoLiquidMixingFoam solver for OpenFOAM Version 1.6.
Enjoy, Chiven |
Hi,
I tried gunzip on the example and got out a binary file. I was expecting some directories? I just updated to OpenFOAM-1.6 and was hoping to find a good example to get up to speed. |
I realized the file was a .tar.gz file and set up the example. It still gives an error. I ran blockMesh and then twoLiquidMixingFoam. The output is
Create time Create mesh for time = 0 Reading g Reading field p_rgh --> FOAM FATAL IO ERROR: cannot open file file: /home/shp/OpenFOAM/OpenFOAM-1.6.x/tutorials/twoStream/0/p_rgh at line 0. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 62. FOAM exiting field p_rgh is not mentioned in any of the entries under system. What is this? Shawn |
Hi, I think you 've probably forgotten the "step" setFields
try this : blockMesh, setFields and finally twoLiquidMixingFoam regards Yann |
Sorry, I'm using this solver too.
I use your files. Also I use setFields, but still no p_rgh file. Quote:
|
Quote:
is there a version of fixedMeanValue for Openfoam 1.6 yet ? I would be really glad to get hold of it, if possible, since i have been dealing with a problem which might be solved by your boundary condition. But I kind of dislike the thought of going back do OF 1.5...or earlier. thx & regards |
omg, never mind my stupidity, plz!
Just figured it out ... for the records, fixedMeanValue works also with OF 1.6.. you need: files file: Code:
fixedMeanValueFvPatchFields.C Code:
EXE_INC = \ Code:
libs ( "libfixedMeanValue.so" ) ; |
1 Attachment(s)
This is the one I modified on OpenFOAM 1.6.x.
Quote:
|
Dear Foamers,
Does anyone of you know where I can find some informations about model being implemented in TwoLiquidMixingFoam, especially descriptions of the extra terms in NS equations ? 1. (fvc::grad(U) & fvc::grad(muEff)) 2. what function reconstruct does ? fvc::reconstruct ( fvc::interpolate(rho)*(g & mesh.Sf()) - mesh.magSf()*fvc::snGrad(p) ), 3. Why there is "- mesh.magSf()*fvc::snGrad(p)" to calculate pressure gradient instead of: "-fvc::grad(p)" ? Thanks for your help ! ZM |
Quote:
|
p_rgh at line 0
Quote:
Can you explain more on how to fix the error "p_rgh at line 0" I get the same error for a case to run a wave Tank. I downloaded the file twoStream.tar.gz and but I got an error like the file is corrupted gzip: stdin: not in gzip format tar: Child returned status 1 tar: Exiting with failure status due to previous errors vrosaless@ubuntu:~/Downloads$ gunzip twoStream.tar.g Any help is wellcome Thanks Victor |
1 Attachment(s)
This one should work and run.
|
This is the p_rgh file now I use
//================================================== ============== FoamFile { version 2.0; format ascii; root ""; case ""; instance ""; local ""; class volScalarField; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { bottomInlet { type zeroGradient; } topInlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; } pipe { type zeroGradient; } defaultFaces { type empty; } } // ************************************************** *********************** // Take care of the object name is "p_rgh", not "p", and also the dimension is different to simpleFoam. Quote:
|
p_rgh
The last file itīs OK.
I' m actually using p_rgh for a wave tank in interFoam. I used your case to update the wave tank files where I found the p_rgh missing. Thanks for your help Victor |
Hi, I'm also having the same problem trying to extract "twoStream.tar.gz". Would someone be willing to post a working version for v1.7 or as Victor requested provide some additional detail on how to fix the error "p_rgh at line 0"?
Thanks in advance! |
Try this
//================================================== ============== FoamFile { version 2.0; format ascii; root ""; case ""; instance ""; local ""; class volScalarField; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { bottomInlet { type zeroGradient; } topInlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; } pipe { type zeroGradient; } defaultFaces { type empty; } } Quote:
|
Thanks Maolong LIU!
When I use the your suggestion I get the following ======================= DILUPBiCG: Solving for alpha1, Initial residual = 0.00755434, Final residual = 2.4898e-08, No Iterations 2 Phase 1 volume fraction = 0.501191 Min(alpha1) = 0 Max(alpha1) = 1 DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 2.74871e-12, No Iterations 3 DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 9.82467e-12, No Iterations 3 --> FOAM FATAL IO ERROR: keyword p_rgh is undefined in dictionary "/home/hunts/Desktop/twoStream/system/fvSolution::solvers" file: /home/hunts/Desktop/twoStream/system/fvSolution::solvers from line 22 to line 73. From function dictionary::subDict(const word& keyword) const in file db/dictionary/dictionary.C at line 456. FOAM exiting ======================= Any ideas? My apologies. I'm relatively new to OpenFOAM. Thanks |
In the fvSoluction file, and also fvSchems file, because now you solve p_rgh equation in stead of p equation, so you need change p to p_rgh.
So just change all the word "p" to "p_rgh" in both those files. Quote:
|
This is my fvSolution file
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p_rgh { solver PCG; preconditioner DIC; tolerance 1e-8; relTol 0; } p_rghFinal { solver PCG; preconditioner DIC; tolerance 1e-8; relTol 0; } alpha1 { solver PBiCG; preconditioner DILU; tolerance 1e-06; relTol 0; } U { solver PBiCG; preconditioner DILU; tolerance 1e-08; relTol 0; } UFinal { solver PBiCG; preconditioner DILU; tolerance 1e-08; relTol 0; } } PIMPLE { nOuterCorrectors 2; nCorrectors 2; nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; } Quote:
|
Thank you!
|
what does alphatab stand for ?
|
Quote:
please help me with this Regards |
1 Attachment(s)
Attachment 6025
here you have. |
Quote:
Dab is the diffusivity, as would be calculated using Chapman-Enskog for 2 gases... Is alphatab some kind of multiplier on that? |
alphatab = 1/Sct (the turbulent Schmidt number)
Quote:
|
Quote:
|
FYI, it is written in the code (createFields.H) ;)
Code:
// Read the reciprocal of the turbulent Schmidt number |
I'm trying to write a separate case for using twoLiquidMixingFoam in a customized form. First, I removed the variables 'p' and 'g' and 'gh' and instead operated everything in 'p_rgh'. Next, I removed 'alphatab' and now the diffusivity works solely on Dab.
In pEqn.H { volScalarField rAU = 1.0/UEqn.A(); surfaceScalarField rAUf = fvc::interpolate(rAU); U = rAU*UEqn.H(); surfaceScalarField phiU ( "phiU", (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rAU, rho, U, phi) ); adjustPhi(phiU, U, p_rgh); phi = phiU ;//- ghf*fvc::snGrad(rho)*rAUf*mesh.magSf() for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix p_rghEqn ( fvm::laplacian(rAUf, p_rgh) == fvc::div(phi) ); p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell)); p_rghEqn.solve ( mesh.solver ( p_rgh.select ( finalIter && corr == nCorr-1 && nonOrth == nNonOrthCorr ) ) ); if (nonOrth == nNonOrthCorr) { phi -= p_rghEqn.flux(); } } U += rAU*fvc::reconstruct((phi - phiU)/rAUf); U.correctBoundaryConditions(); #include "continuityErrs.H" The problem is in the line- fvm::laplacian(rAUf, p_rgh) == fvc::div(phi) And the output reads- --> FOAM FATAL IO ERROR: keyword laplacian(interpolate((1|A(U))),p_rgh) is undefined in dictionary "/home/tanay/OpenFOAM/tanay-1.7.1/run/roughMix/system/fvSchemes::laplacianSchemes" file: /home/tanay/OpenFOAM/tanay-1.7.1/run/roughMix/system/fvSchemes::laplacianSchemes from line 54 to line 63. So, I tried adding this line to fvSchemes but it didn't work. Any suggestions on what's missing in fvSchemes? Here's the fvSchemes file if anyone wishes to view it- ddtSchemes { default Euler; } gradSchemes { default Gauss linear; grad(U) Gauss linear; grad(muEff) Gauss linear; grad(p_rgh) Gauss linear; } snGradSchemes { default corrected; } divSchemes { default none; div(phi,U) Gauss limitedLinearV 1; div(phi,k) Gauss limitedLinear 1; div(phi,epsilon) Gauss limitedLinear 1; div(phi,R) Gauss limitedLinear 1; div(R) Gauss linear; div(phi,nuTilda) Gauss limitedLinear 1; div((nuEff*dev(grad(U).T()))) Gauss linear; div(phi,alpha1) Gauss limitedLinear 1; div(phi) Gauss limitedLinear 1; div(rhoPhi,U) Gauss limitedLinear 1; div(rho*phi,U) Gauss limitedLinear 1; } laplacianSchemes { default none; laplacian(nuEff,U) Gauss linear corrected; laplacian((1|A(U)),p_rgh) Gauss linear corrected; laplacian(DkEff,k) Gauss linear corrected; laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected; laplacian(DnuTildaEff,nuTilda) Gauss linear corrected; laplacian(Dab,alpha1) Gauss linear corrected; laplacian(rAUf,p_rgh) Gauss linear corrected; laplacian(muEff,U) Gauss linear corrected; } interpolationSchemes { default linear; interpolate(U) linear; } fluxRequired { default no; p_rgh ; alpha1 yes; } |
Hi Tanay,
I think that you can have a problem with an extra "bracket". An error says: laplacian(interpolate((1|A(U))),p_rgh) so here u have : ...U))) -- triple closing ) but in your laplacianSchemes you have : .... laplacian((1|A(U)),p_rgh) Gauss linear corrected; .... and: A(U)) double closing ) so it seems that you have some typo in your code. Cheers ZMM |
Yeah, thanks. That was a simple typo. Now, I'm getting a Courant number blow-up.
Courant Number mean: 21.0277 max: 258.938 deltaT = 3.37996e-06 Time = 0.0145817 #0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so" #2 Uninterpreted: #3 Foam::PBiCG::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so" #4 Foam::GAMGSolver::solveCoarsestLevel(Foam::Field<d ouble>&, Foam::Field<double> const&) const in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so" #5 Foam::GAMGSolver::Vcycle(Foam::PtrList<Foam::lduMa trix::smoother> const&, Foam::Field<double>&, Foam::Field<double> const&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::PtrList<Foam::Field<double> >&, Foam::PtrList<Foam::Field<double> >&, unsigned char) const in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so" #6 Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so" #7 Foam::fvMatrix<double>::solve(Foam::dictionary const&) in "/opt/openfoam171/lib/linuxGccDPOpt/libfiniteVolume.so" #8 in "/home/tanay/OpenFOAM/tanay-1.7.1/applications/bin/linuxGccDPOpt/customizedTwoLiquidMixingFoam" #9 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6" #10 in "/home/tanay/OpenFOAM/tanay-1.7.1/applications/bin/linuxGccDPOpt/customizedTwoLiquidMixingFoam" Floating point exception Lowering the time step just prolongs the blow-up. All the fvSchemes (printed above) I've used correspond to a pimpleFoam tutorial and so they can't be too problematic. Where may be the error? |
Well, ziemowit, I've given up trying to make the blowing up case converge since I tried everything from reducing the time step to decreasing the velocity and increasing laminar viscosity etc. So, now I'm trying to build a new solver based on PIMPLE to simulate twoLiquidMixing. In this, I've included a file called customTwoLiquid.H for laminar mixing. It reads as-
surfaceScalarField muEff ("muEff", (alpha1*mu1 + (scalar(1)-alpha1)*mu2)); volScalarField rho ("rho", (alpha1*rho1 + (scalar(1)-alpha1)*rho2)); surfaceScalarField rhoIntoPhi ("rhoIntoPhi", rho*phi); Now this produces a compilation error. Can you please tell me what's wrong? |
All times are GMT -4. The time now is 06:05. |