CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   zero flux boundary conditon (https://www.cfd-online.com/Forums/openfoam-solving/229957-zero-flux-boundary-conditon.html)

Lie Wei September 1, 2020 23:43

zero flux boundary conditon
 
hi, everyone
I have a question about the boundary condition for the following species transport equation:
-fvm::laplacian(Dc, C) +fvm::div(phi, C) == 0
and I want to set the flux of C to be zero for my b.cs, which is given as:
-DC*dC/dn + Un*C == 0
where n is the normal direction of b.c
I use the codedmixed to implement my b.c as following:
outlet
{
type codedMixed;
refValue uniform 0;
refGradient uniform 0;
valueFraction uniform 1;

name zeroFlux;

code
#{
fvPatchField<scalar> C
(
patch().lookupPatchField<volScalarField, scalar>("C")
);
fvPatchField<vector> U
(
patch().lookupPatchField<volVectorField, vector>("U")
);
scalarField Ux = U.component(vector::X);
this->refValue() = 0.0;
this->refGrad() = - Ux / 1.05e-8 * C;
this->valueFraction() = 0.0;
#};
}

where 1.05e-8 is Dc

The above code worked, but the results are quit different from COMSOL's (a FEM software) calculations. I don't know where I made the mistake, can anyone help?

simrego September 3, 2020 04:39

Hi!


Why don't you just use the zeroGradient BC instead?

Lie Wei September 8, 2020 23:13

hi,anonymous
the BC I need is
-DC*dC/dn + Un*C == 0
I think zeroGradient mean
-DC*dC/dn == 0?


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