Reply To: Point-by-point field – pressure( density ) free energy boundary condition in 3D
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Point-by-point field – pressure( density ) free energy boundary condition in 3D › Reply To: Point-by-point field – pressure( density ) free energy boundary condition in 3D
Dear Sam,
1) Thank you for your suggestion regarding the convergence criterion. I will try this approach as I am still determining the best method for my specific physical problem.
2a-b) I set the density (and I believe the label is correct) using the following:
setFreeEnergyInletBoundary<T,DESCRIPTOR>(sLattice1,omega,superGeometry,3,"density",1);
setFreeEnergyOutletBoundary<T,DESCRIPTOR>(sLattice1,omega,superGeometry,4,"density",1);
setFreeEnergyInletBoundary<T,DESCRIPTOR>(sLattice2,omega,superGeometry,3,"density",2);
setFreeEnergyOutletBoundary<T,DESCRIPTOR>(sLattice2,omega,superGeometry,4,"density",2);
However, the boundary values are not being enforced as expected. For example, in a piston-like simulation, I tried setting an inlet density of 10 (non-physical, just for visualization purposes in Paraview), like so:
AnalyticalConst3D<T,T> rhoinVal( inletDensity );
AnalyticalConst3D<T, T> rhooutVal(T {1});
AnalyticalConst3D<T,T> phiminusone( T {-1} );
AnalyticalConst3D<T, T> phione(T {1});
sLattice1.defineRho(superGeometry,3,rhoinVal);
sLattice1.defineRho(superGeometry,3,rhooutVal);
sLattice2.defineRho(superGeometry,3,phiminusone);//3 inlet material number
sLattice2.defineRho(superGeometry,4,phione);// 4 outlet material number
sLattice1.setProcessingContext<Array<momenta::FixedDensity::RHO>>(
ProcessingContext::Simulation);
sLattice2.setProcessingContext<Array<momenta::FixedDensity::RHO>>(
ProcessingContext::Simulation);
I expected a rho value of 10 at the output, but it seems the boundary condition is not applied. I tried setting this before the coupling definitions, after them, and in the simulation loop, but without success.
I defined the couplings in the order: outlet, chemicalPotential, force, and inlet, as shown below:
SuperLatticeCoupling coupling1(
InletOutletCoupling3D{},
names::A{}, sLattice2,
names::B{}, sLattice1
);
coupling1.restrictTo(superGeometry.getMaterialIndicator({4}));
SuperLatticeCoupling coupling2(
ChemicalPotentialCoupling3D{},
names::A{}, sLattice1,
names::B{}, sLattice2);
coupling2.template setParameter<ChemicalPotentialCoupling3D::ALPHA>(alpha);
coupling2.template setParameter<ChemicalPotentialCoupling3D::KAPPA1>(kappa1);
coupling2.template setParameter<ChemicalPotentialCoupling3D::KAPPA2>(kappa2);
coupling2.restrictTo(superGeometry.getMaterialIndicator({1}));
SuperLatticeCoupling coupling3(
ForceCoupling3D{},
names::A{}, sLattice2,
names::B{}, sLattice1);
coupling3.restrictTo(superGeometry.getMaterialIndicator({1}));
///inlet coupling
SuperLatticeCoupling coupling4(
InletOutletCoupling3D{},
names::A{}, sLattice2,
names::B{}, sLattice1
);
coupling4.restrictTo(superGeometry.getMaterialIndicator({3}));
Thank you for your suggestions. I hope the attached code provides some helpful context. I am sure that I am missing something fundamental, but I am struggling to identify exactly what it is.
Best regards,
Alice