Couple sourced AD and NS lattices
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Couple sourced AD and NS lattices
- This topic has 2 replies, 2 voices, and was last updated 2 years, 10 months ago by antoniowu.
-
AuthorPosts
-
February 28, 2022 at 3:21 am #6353antoniowuParticipant
Hi OpenLB community,
I am trying to couple SourcedAdvectionDiffusionBGKdynamics and ForcedBGKdynamics using NavierStokesAdvectionDiffusionCouplingGenerator2D. Segmentation faults showed up when running the compiled app. I’ve identified this issue as related to the coupling because the app went fine when the coupling had been turned off. Are there any other coupling generators I should use? Or is there any way to get around?
Descriptors:
typedef D2Q9<FORCE> NSDESCRIPTOR;
typedef D2Q5<VELOCITY,SOURCE> TDESCRIPTOR;Dynamics:
ADlattice.defineDynamics(superGeometry, 0, &instances::getNoDynamics<T, TDESCRIPTOR>());
NSlattice.defineDynamics(superGeometry, 0, &instances::getNoDynamics<T, NSDESCRIPTOR>());ADlattice.defineDynamics(superGeometry, 1, &advectionDiffusionBulkDynamics);
ADlattice.defineDynamics(superGeometry, 2, &advectionDiffusionBulkDynamics);
ADlattice.defineDynamics(superGeometry, 3, &advectionDiffusionBulkDynamics);
ADlattice.defineDynamics(superGeometry, 4, &advectionDiffusionBulkDynamics); ADlattice.defineDynamics(superGeometry, 5, &sourcedAdvectionDiffusionSolidDynamics);NSlattice.defineDynamics(superGeometry, 1, &bulkDynamics);
NSlattice.defineDynamics(superGeometry, 2, &instances::getNoDynamics<T, NSDESCRIPTOR>());
NSlattice.defineDynamics(superGeometry, 3, &bulkDynamics);
NSlattice.defineDynamics(superGeometry, 4, &bulkDynamics);
NSlattice.defineDynamics(superGeometry, 5, &instances::getBounceBack<T, NSDESCRIPTOR>());Lattice initialization:
AnalyticalConst2D<T,T> u(0, maxVelocity);NSlattice.defineRhoU(superGeometry, 1, rho, u);
NSlattice.iniEquilibrium(superGeometry, 1, rho, u);
NSlattice.defineField<descriptors::FORCE>(superGeometry, 1, force);
NSlattice.defineRhoU(superGeometry, 2, rho, u);
NSlattice.iniEquilibrium(superGeometry, 2, rho, u);
NSlattice.defineField<descriptors::FORCE>(superGeometry, 2, force);
NSlattice.defineRhoU(superGeometry, 3, rho, u);
NSlattice.iniEquilibrium(superGeometry, 3, rho, u);
NSlattice.defineField<descriptors::FORCE>(superGeometry, 3, force);
NSlattice.defineRhoU(superGeometry, 4, rho, u);
NSlattice.iniEquilibrium(superGeometry, 4, rho, u);
NSlattice.defineField<descriptors::FORCE>(superGeometry, 4, force);
NSlattice.iniEquilibrium(superGeometry, 4, rho, u);
NSlattice.defineField<descriptors::FORCE>(superGeometry, 4, force);AnalyticalConst2D<T,T> Cold(converter.getLatticeTemperature(Tcold));
AnalyticalConst2D<T,T> Hot(converter.getLatticeTemperature(Thot));
AnalyticalConst2D<T,T> u0(0, 0);
AnalyticalConst2D<T,T> Tsource(converter.getLatticeTemperature(1));
AnalyticalConst2D<T,T> T0(0);ADlattice.defineRho(superGeometry, 1, Cold);
ADlattice.iniEquilibrium(superGeometry, 1, Cold, u);
ADlattice.defineField<descriptors::VELOCITY>(superGeometry, 1, u);
ADlattice.defineRho(superGeometry, 2, Hot);
ADlattice.iniEquilibrium(superGeometry, 2, Hot, u);
ADlattice.defineField<descriptors::VELOCITY>(superGeometry, 2, u);
ADlattice.defineRho(superGeometry, 3, Cold);
ADlattice.iniEquilibrium(superGeometry, 3, Cold, u);
ADlattice.defineField<descriptors::VELOCITY>(superGeometry, 3, u);
ADlattice.defineRho(superGeometry, 4, Cold);
ADlattice.iniEquilibrium(superGeometry, 4, Cold, u);
ADlattice.defineField<descriptors::VELOCITY>(superGeometry, 4, u);
ADlattice.defineRho(superGeometry, 5, Cold);
ADlattice.iniEquilibrium(superGeometry, 5, Cold, u0);
ADlattice.defineField<descriptors::VELOCITY>(superGeometry, 5, u0);
ADlattice.defineField<descriptors::SOURCE>(superGeometry, 5, Tsource);Coupling:
SuperLattice2D<T, TDESCRIPTOR> ADlattice(superGeometry);
SuperLattice2D<T, NSDESCRIPTOR> NSlattice(superGeometry);ForcedBGKdynamics<T, NSDESCRIPTOR> NSbulkDynamics(
converter.getLatticeRelaxationFrequency(),
instances::getBulkMomenta<T,NSDESCRIPTOR>());AdvectionDiffusionBGKdynamics<T, TDESCRIPTOR> TbulkDynamics (
converter.getLatticeThermalRelaxationFrequency(),
instances::getAdvectionDiffusionBulkMomenta<T,TDESCRIPTOR>()
);SourcedAdvectionDiffusionBGKdynamics<T, TDESCRIPTOR> TsolidDynamics (
converter.getLatticeThermalRelaxationFrequency()*2,
instances::getAdvectionDiffusionBulkMomenta<T,TDESCRIPTOR>()
);NavierStokesAdvectionDiffusionCouplingGenerator2D<T,NSDESCRIPTOR>
coupling(0, converter.getLatticeLength(lx), 0, converter.getLatticeLength(ly),
boussinesqForcePrefactor, converter.getLatticeTemperature(Tcold), 1., dir);// NSlattice.addLatticeCoupling(coupling, ADlattice);
NSlattice.addLatticeCoupling(superGeometry, 1, coupling, ADlattice);
NSlattice.addLatticeCoupling(superGeometry, 2, coupling, ADlattice);
NSlattice.addLatticeCoupling(superGeometry, 3, coupling, ADlattice);
NSlattice.addLatticeCoupling(superGeometry, 4, coupling, ADlattice);March 30, 2022 at 11:05 am #6397jjessbergerParticipantDear Antonio,
for material=2, NoDynamics are set on the Navier-Stokes lattice. This may crash later when you apply the coupling. At least, I don’t understand the intention of the Boussinesq coupling outside the domain.
If this does not help, you could turn on the coupling for one material after the other and see, where it crashes.
Yours,
JuliusApril 7, 2022 at 5:02 am #6418antoniowuParticipantDear Julius,
Thanks for your comment. It turns out the NS-AD coupling generator does not handle the source field. I’ve included the source field into the coupling generator and now everything works fine.
Cheers,
Antonio -
AuthorPosts
- You must be logged in to reply to this topic.