|
[Sponsors] | |||||
[v2506] [interFoam] - Courant number explodes when using a custom boundary condition |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
New Member
stefsolo
Join Date: Oct 2025
Posts: 2
Rep Power: 0 ![]() |
Hello all!
I'm simulating two-phase (air-water) flow using the interFoam solver to model the filling of a microfluidic channel connected to a microchamber. The microfluidic device material is permeable to air but impermeable to water. The device is bonded to a non-permeable surface, therefore I must take into account the permeability only for the surfaces of the device. To achieve this I have implemented a custom boundary condition on the air-permeable surface, using a fixedCodedValue that calculates the normal velocity to the permeable surface using the Darcy law, based on the internal and external pressure, to calculate the velocity with which air escapes the device. Below you can see my fixedCodedValue. Note that the velocity calculation is only active when the volume fraction of water, α, is less than 0.01, therefore only when air is present. Code:
wall_pdms
{
type codedFixedValue;
value uniform (0 0 0);
name darcyporouswall1;
codeInclude
#{
#include "fvCFD.H"
#include "alphaFixedPressureFvPatchScalarField.H"
#};
codeOptions
#{
-I$(WM_PROJECT_DIR)/src/finiteVolume/lnInclude \
-I$(WM_PROJECT_DIR)/src/meshTools/lnInclude \
-I$(WM_PROJECT_DIR)/src/transportModels/twoPhaseProperties/lnInclude
#};
code
#{
// Constants
const scalar mu = 1.813e-5; // Dynamic viscosity (Pa·s)
const scalar K = 1.0e-16; // Permeability (m^2)
const scalar Pout = 0; // Outlet pressure (Pa)
const scalar L = 1e-3; // Characteristic length (m)
// Access to the current fvPatch
const fvPatch& fvP = this->patch();
// Access to the face normal vectors
const vectorField& n = fvP.nf();
// Access to the entire pressure and alpha.water fields
const volScalarField& p = this->db().lookupObject<volScalarField>("p");
const volScalarField& alpha = this->db().lookupObject<volScalarField>("alpha.water");
// Access the patch values of pressure and alpha
const fvPatchScalarField& pPatch = p.boundaryField()[fvP.index()];
const fvPatchScalarField& alphaPatch = alpha.boundaryField()[fvP.index()];
// Loop through each face on the patch to set the velocity
forAll(fvP, faceI)
{
if (alphaPatch[faceI] < 0.01)
{
// Apply Darcy's Law only when alpha < 0.01
scalar Un = (K / mu) * ((pPatch[faceI] - Pout) / L);
this->operator[](faceI) = Un * n[faceI];
}
else
{
// Otherwise, set velocity to zero
this->operator[](faceI) = vector(0, 0, 0);
}
}
#};
}
All the above seem to happen no matter the mesh (coarse or fine). Please note that the thickness of the device is very small (0.015e-3 m). Please note that my timeStep is adjustable and despite for it becoming extremely small loosing all its physical meaning Courant still remains high, that is why the simulation stops. I am also attaching my U, p_rgh, fvSchemes and fvSolutions files as well as a screenshot of the geometry. I am using openfoam2506, Any suggestions to fix the problem will be very much appreciated. Thanks in advance. Last edited by stefsolo; October 2, 2025 at 06:37. |
|
|
|
|
|
![]() |
| Tags |
| courant number increasing, custom boundary condition, interfoam |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 06:38 |
| [snappyHexMesh] Error snappyhexmesh - Multiple outside loops | avinashjagdale | OpenFOAM Meshing & Mesh Conversion | 53 | March 8, 2019 10:42 |
| Problem in setting Boundary Condition | Madhatter92 | CFX | 12 | January 12, 2016 05:39 |
| Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
| An error has occurred in cfx5solve: | volo87 | CFX | 5 | June 14, 2013 18:44 |