OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR > Class Template Reference

#include <navierStokesAdvectionDiffusionCouplingPostProcessor3D.h>

+ Inheritance diagram for olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >:
+ Collaboration diagram for olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >:

Public Member Functions

 MixedScaleBoussinesqCouplingPostProcessor3D (int x0_, int x1_, int y0_, int y1_, int z0_, int z1_, T gravity_, T T0_, T deltaTemp_, std::vector< T > dir_, T PrTurb_, std::vector< BlockStructureD< 3 > * > partners_)
 
int extent () const override
 Extent of application area (0 for purely local operations)
 
int extent (int whichDirection) const override
 Extent of application area along a direction (0 or 1)
 
void process (BlockLattice< T, DESCRIPTOR > &blockLattice) override
 Execute post-processing step.
 
void processSubDomain (BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
 Execute post-processing step on a sublattice.
 
- Public Member Functions inherited from olb::PostProcessor3D< T, DESCRIPTOR >
 PostProcessor3D ()
 
virtual ~PostProcessor3D ()
 
std::string & getName ()
 read and write access to name
 
std::string const & getName () const
 read only access to name
 
int getPriority () const
 read only access to priority
 

Additional Inherited Members

- Protected Attributes inherited from olb::PostProcessor3D< T, DESCRIPTOR >
int _priority
 

Detailed Description

template<typename T, typename DESCRIPTOR>
class olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >

Definition at line 304 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

Constructor & Destructor Documentation

◆ MixedScaleBoussinesqCouplingPostProcessor3D()

template<typename T , typename DESCRIPTOR >
olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >::MixedScaleBoussinesqCouplingPostProcessor3D ( int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_,
T gravity_,
T T0_,
T deltaTemp_,
std::vector< T > dir_,
T PrTurb_,
std::vector< BlockStructureD< 3 > * > partners_ )

Definition at line 692 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

696 : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_),
697 gravity(gravity_), T0(T0_), deltaTemp(deltaTemp_),
698 dir(dir_), PrTurb(PrTurb_), partners(partners_)
699{
700 // we normalize the direction of force vector
701 T normDir = T();
702 for (unsigned iD = 0; iD < dir.size(); ++iD) {
703 normDir += dir[iD]*dir[iD];
704 }
705 normDir = util::sqrt(normDir);
706 for (unsigned iD = 0; iD < dir.size(); ++iD) {
707 dir[iD] /= normDir;
708 }
709
710 for (unsigned iD = 0; iD < dir.size(); ++iD) {
711 forcePrefactor[iD] = gravity * dir[iD];
712 }
713
714 tauTurbADPrefactor = descriptors::invCs2<T,descriptors::D3Q7<>>() / descriptors::invCs2<T,DESCRIPTOR>() / PrTurb;
715 tPartner = static_cast<BlockLattice<T,descriptors::D3Q7<descriptors::VELOCITY,descriptors::TAU_EFF,descriptors::CUTOFF_HEAT_FLUX>> *>(partners[0]);
716}
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100

References olb::util::sqrt().

+ Here is the call graph for this function:

Member Function Documentation

◆ extent() [1/2]

template<typename T , typename DESCRIPTOR >
int olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >::extent ( ) const
inlineoverridevirtual

Extent of application area (0 for purely local operations)

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 309 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

310 {
311 return 0;
312 }

◆ extent() [2/2]

template<typename T , typename DESCRIPTOR >
int olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >::extent ( int direction) const
inlineoverridevirtual

Extent of application area along a direction (0 or 1)

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 313 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.h.

314 {
315 return 0;
316 }

◆ process()

template<typename T , typename DESCRIPTOR >
void olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >::process ( BlockLattice< T, DESCRIPTOR > & blockLattice)
overridevirtual

Execute post-processing step.

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 962 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

964{
965 processSubDomain(blockLattice, x0, x1, y0, y1, z0, z1);
966}
void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_) override
Execute post-processing step on a sublattice.

◆ processSubDomain()

template<typename T , typename DESCRIPTOR >
void olb::MixedScaleBoussinesqCouplingPostProcessor3D< T, DESCRIPTOR >::processSubDomain ( BlockLattice< T, DESCRIPTOR > & blockLattice,
int x0_,
int x1_,
int y0_,
int y1_,
int z0_,
int z1_ )
overridevirtual

Execute post-processing step on a sublattice.

Molecular realaxation time

Effective realaxation time

Implements olb::PostProcessor3D< T, DESCRIPTOR >.

Definition at line 719 of file navierStokesAdvectionDiffusionCouplingPostProcessor3D.hh.

722{
723
724 const T C_nu = 0.04;
725 const T C_alpha = 0.5;
726 // const T deltaT = 1.0;
727
728 const T invCs2 = descriptors::invCs2<T,DESCRIPTOR>();
729 const T invCs2_g = descriptors::invCs2<T,descriptors::D3Q7<>>();
730
731 int newX0, newX1, newY0, newY1, newZ1, newZ0;
732 if ( util::intersect (
733 x0, x1, y0, y1, z0, z1,
734 x0_, x1_, y0_, y1_, z0_, z1_,
735 newX0, newX1, newY0, newY1, newZ1, newZ0 ) ) {
736
737 auto& heatFluxCache = blockLattice.template getField<HEAT_FLUX_CACHE>()[0];
738 for (int iX=newX0-1; iX<=newX1+1; ++iX) {
739 for (int iY=newY0-1; iY<=newY1+1; ++iY) {
740 for (int iZ=newZ0-1; iZ<=newZ1+1; ++iZ) {
741 const T temperature = tPartner->get(iX,iY,iZ).computeRho();
742 heatFluxCache[blockLattice.getCellId(iX, iY, iZ)] = temperature;
743
744 // computation of the bousinessq force
745 T temperatureDifference = temperature - T0;
746 blockLattice.get(iX,iY,iZ).template setField<descriptors::FORCE>(temperatureDifference*forcePrefactor);
747
748 FieldD<T,DESCRIPTOR,descriptors::VELOCITY> u;
749 blockLattice.get(iX,iY,iZ).computeU(u.data());
750 tPartner->get(iX,iY,iZ).template setField<descriptors::VELOCITY>(u);
751 }
752 }
753 }
754
755 for (int iX=newX0; iX<=newX1; ++iX) {
756 for (int iY=newY0; iY<=newY1; ++iY) {
757 for (int iZ=newZ0; iZ<=newZ1; ++iZ) {
758
759 auto u_ppp = tPartner->get(iX+1, iY+1, iZ+1).template getField<descriptors::VELOCITY>();
760 auto u_0pp = tPartner->get(iX, iY+1, iZ+1).template getField<descriptors::VELOCITY>();
761 auto u_npp = tPartner->get(iX-1, iY+1, iZ+1).template getField<descriptors::VELOCITY>();
762 auto u_p0p = tPartner->get(iX+1, iY, iZ+1).template getField<descriptors::VELOCITY>();
763 auto u_00p = tPartner->get(iX, iY, iZ+1).template getField<descriptors::VELOCITY>();
764 auto u_n0p = tPartner->get(iX-1, iY, iZ+1).template getField<descriptors::VELOCITY>();
765 auto u_pnp = tPartner->get(iX+1, iY-1, iZ+1).template getField<descriptors::VELOCITY>();
766 auto u_0np = tPartner->get(iX, iY-1, iZ+1).template getField<descriptors::VELOCITY>();
767 auto u_nnp = tPartner->get(iX-1, iY-1, iZ+1).template getField<descriptors::VELOCITY>();
768
769 auto u_pp0 = tPartner->get(iX+1, iY+1, iZ ).template getField<descriptors::VELOCITY>();
770 auto u_0p0 = tPartner->get(iX, iY+1, iZ ).template getField<descriptors::VELOCITY>();
771 auto u_np0 = tPartner->get(iX-1, iY+1, iZ ).template getField<descriptors::VELOCITY>();
772 auto u_p00 = tPartner->get(iX+1, iY, iZ ).template getField<descriptors::VELOCITY>();
773 auto u_000 = tPartner->get(iX, iY, iZ ).template getField<descriptors::VELOCITY>();
774 auto u_n00 = tPartner->get(iX-1, iY, iZ ).template getField<descriptors::VELOCITY>();
775 auto u_pn0 = tPartner->get(iX+1, iY-1, iZ ).template getField<descriptors::VELOCITY>();
776 auto u_0n0 = tPartner->get(iX, iY-1, iZ ).template getField<descriptors::VELOCITY>();
777 auto u_nn0 = tPartner->get(iX-1, iY-1, iZ ).template getField<descriptors::VELOCITY>();
778
779 auto u_ppn = tPartner->get(iX+1, iY+1, iZ-1).template getField<descriptors::VELOCITY>();
780 auto u_0pn = tPartner->get(iX, iY+1, iZ-1).template getField<descriptors::VELOCITY>();
781 auto u_npn = tPartner->get(iX-1, iY+1, iZ-1).template getField<descriptors::VELOCITY>();
782 auto u_p0n = tPartner->get(iX+1, iY, iZ-1).template getField<descriptors::VELOCITY>();
783 auto u_00n = tPartner->get(iX, iY, iZ-1).template getField<descriptors::VELOCITY>();
784 auto u_n0n = tPartner->get(iX-1, iY, iZ-1).template getField<descriptors::VELOCITY>();
785 auto u_pnn = tPartner->get(iX+1, iY-1, iZ-1).template getField<descriptors::VELOCITY>();
786 auto u_0nn = tPartner->get(iX, iY-1, iZ-1).template getField<descriptors::VELOCITY>();
787 auto u_nnn = tPartner->get(iX-1, iY-1, iZ-1).template getField<descriptors::VELOCITY>();
788
789 const T *h_ppp = & heatFluxCache[blockLattice.getCellId(iX+1, iY+1, iZ+1)];
790 const T *h_0pp = & heatFluxCache[blockLattice.getCellId(iX, iY+1, iZ+1)];
791 const T *h_npp = & heatFluxCache[blockLattice.getCellId(iX-1, iY+1, iZ+1)];
792 const T *h_p0p = & heatFluxCache[blockLattice.getCellId(iX+1, iY, iZ+1)];
793 const T *h_pnp = & heatFluxCache[blockLattice.getCellId(iX+1, iY-1, iZ+1)];
794 const T *h_00p = & heatFluxCache[blockLattice.getCellId(iX, iY, iZ+1)];
795 const T *h_0np = & heatFluxCache[blockLattice.getCellId(iX, iY-1, iZ+1)];
796 const T *h_n0p = & heatFluxCache[blockLattice.getCellId(iX-1, iY, iZ+1)];
797 const T *h_nnp = & heatFluxCache[blockLattice.getCellId(iX-1, iY-1, iZ+1)];
798
799 const T *h_pp0 = & heatFluxCache[blockLattice.getCellId(iX+1, iY+1, iZ )];
800 const T *h_0p0 = & heatFluxCache[blockLattice.getCellId(iX, iY+1, iZ )];
801 const T *h_np0 = & heatFluxCache[blockLattice.getCellId(iX-1, iY+1, iZ )];
802 const T *h_p00 = & heatFluxCache[blockLattice.getCellId(iX+1, iY, iZ )];
803 const T *h_pn0 = & heatFluxCache[blockLattice.getCellId(iX+1, iY-1, iZ )];
804 const T *h_000 = & heatFluxCache[blockLattice.getCellId(iX, iY, iZ )];
805 const T *h_0n0 = & heatFluxCache[blockLattice.getCellId(iX, iY-1, iZ )];
806 const T *h_n00 = & heatFluxCache[blockLattice.getCellId(iX-1, iY, iZ )];
807 const T *h_nn0 = & heatFluxCache[blockLattice.getCellId(iX-1, iY-1, iZ )];
808
809 const T *h_ppn = & heatFluxCache[blockLattice.getCellId(iX+1, iY+1, iZ-1)];
810 const T *h_0pn = & heatFluxCache[blockLattice.getCellId(iX, iY+1, iZ-1)];
811 const T *h_npn = & heatFluxCache[blockLattice.getCellId(iX-1, iY+1, iZ-1)];
812 const T *h_p0n = & heatFluxCache[blockLattice.getCellId(iX+1, iY, iZ-1)];
813 const T *h_pnn = & heatFluxCache[blockLattice.getCellId(iX+1, iY-1, iZ-1)];
814 const T *h_00n = & heatFluxCache[blockLattice.getCellId(iX, iY, iZ-1)];
815 const T *h_0nn = & heatFluxCache[blockLattice.getCellId(iX, iY-1, iZ-1)];
816 const T *h_n0n = & heatFluxCache[blockLattice.getCellId(iX-1, iY, iZ-1)];
817 const T *h_nnn = & heatFluxCache[blockLattice.getCellId(iX-1, iY-1, iZ-1)];
818
819// cout<<"h_ppn= "<<h_ppp[0]<<endl;
820// cout<<"h_0pn= "<<h_0pp[0]<<endl;
821// cout<<"h_npn= "<<h_npp[0]<<endl;
822// cout<<"h_p0n= "<<h_p0p[0]<<endl;
823// cout<<"h_00n= "<<h_00p[0]<<endl;
824// cout<<"h_n0n= "<<h_n0p[0]<<endl;
825// cout<<"h_pnn= "<<h_pnp[0]<<endl;
826// cout<<"h_0nn= "<<h_0np[0]<<endl;
827// cout<<"h_nnn= "<<h_nnp[0]<<endl;
828
829 //Testfilter h 3D
830 Vector<T,3> filtered_u;
831 T filtered_h = (
832 (
833 ( h_ppp[0] + 2. * h_0pp[0] + h_npp[0]) + 2.*
834 ( h_p0p[0] + 2. * h_00p[0] + h_n0p[0]) +
835 ( h_pnp[0] + 2. * h_0np[0] + h_nnp[0])
836 ) * 0.25 * 0.25 + 2. *
837
838 (
839 ( h_pp0[0] + 2. * h_0p0[0] + h_np0[0]) + 2.*
840 ( h_p00[0] + 2. * h_000[0] + h_n00[0]) +
841 ( h_pn0[0] + 2. * h_0n0[0] + h_nn0[0])
842 ) * 0.25 * 0.25 +
843
844 (
845 ( h_ppn[0] + 2. * h_0pn[0] + h_npn[0]) + 2.*
846 ( h_p0n[0] + 2. * h_00n[0] + h_n0n[0]) +
847 ( h_pnn[0] + 2. * h_0nn[0] + h_nnn[0])
848 ) * 0.25 * 0.25
849 ) * 0.25;
850
851 //Testfilter u 3D
852 filtered_u = (
853 (
854 ( u_ppp + 2. * u_0pp + u_npp) + 2.*
855 ( u_p0p + 2. * u_00p + u_n0p) +
856 ( u_pnp + 2. * u_0np + u_nnp)
857 ) * 0.25 * 0.25 + 2. *
858
859 (
860 ( u_pp0 + 2. * u_0p0 + u_np0) + 2.*
861 ( u_p00 + 2. * u_000 + u_n00) +
862 ( u_pn0 + 2. * u_0n0 + u_nn0)
863 ) * 0.25 * 0.25 +
864
865 (
866 ( u_ppn + 2. * u_0pn + u_npn) + 2.*
867 ( u_p0n + 2. * u_00n + u_n0n) +
868 ( u_pnn + 2. * u_0nn + u_nnn)
869 ) * 0.25 * 0.25
870 ) * 0.25;
871
872 //Ende Testfilter u
873 // filtered_u[i] -= u_00[i];
874
875// cout << "u["<<i<<"]= "<< filtered_u[i] << std::endl;
876// cout << "h[0]= "<< filtered_h[0] << std::endl;
877 const Vector<T,3> filtered_u_reduced = u_000 - filtered_u;
878 const Vector<T,3> filtered_heatFlux_reduced = u_000*h_000[0] - filtered_u*filtered_h;
879 T cutoffKinEnergy = filtered_u_reduced[0] * filtered_u_reduced[0]
880 + filtered_u_reduced[1] * filtered_u_reduced[1]
881 + filtered_u_reduced[2] * filtered_u_reduced[2];
882 T cutoffHeatFlux = filtered_heatFlux_reduced[0] * filtered_heatFlux_reduced[0]
883 + filtered_heatFlux_reduced[1] * filtered_heatFlux_reduced[1]
884 + filtered_heatFlux_reduced[2] * filtered_heatFlux_reduced[2];
885// cout << "filtered_u_reduced= " << filtered_u_reduced << std::endl;
886// cout << "filtered_heatFlux_reduced= " << filtered_heatFlux_reduced << std::endl;
887// cout << "cutoffKinEnergy= " << cutoffKinEnergy << std::endl;
888// cout << "cutoffHeatFlux= " << cutoffHeatFlux << std::endl;
889
890 blockLattice.get(iX,iY,iZ).template setField<descriptors::CUTOFF_KIN_ENERGY>(util::pow(0.5*cutoffKinEnergy, 0.25));
891 tPartner->get(iX,iY,iZ).template setField<descriptors::CUTOFF_HEAT_FLUX>(util::pow(0.5*cutoffHeatFlux, 0.25));
892
893// std::cout<<"cutoffKinEnergy_14= "<<cutoffKinEnergy_14[0]<<std::endl;
894// std::cout<<"cutoffHeatFlux_14= "<<cutoffHeatFlux_14[0]<<std::endl;
895
896
897 // tau coupling
898 auto tauNS = blockLattice.get(iX,iY,iZ).template getField<descriptors::TAU_EFF>();
899 auto tauAD = tPartner->get(iX,iY,iZ).template getField<descriptors::TAU_EFF>();
900
901
902// std::cout<<"tau_NS= "<<tauNS[0]<<std::endl;
903// std::cout<<"tau_AD= "<<tauAD[0]<<std::endl;
904
906 T tau_mol_NS = 1. / blockLattice.get(iX, iY, iZ).getDynamics()->getParameters(blockLattice).template getOrFallback<descriptors::OMEGA>(0);
907 T tau_mol_AD = 1. / tPartner->get(iX, iY, iZ).getDynamics()->getParameters(*tPartner).template getOrFallback<descriptors::OMEGA>(0);
908
909 const T temperature = h_000[0];
910
911 // computation of the bousinessq force
912 auto force = blockLattice.get(iX,iY,iZ).template getField<descriptors::FORCE>();
913 // T temperatureDifference = temperature - T0;
914 // for (unsigned iD = 0; iD < L::d; ++iD) {
915 // force[iD] = forcePrefactor[iD] * temperatureDifference;
916 // }
917
918 auto u = tPartner->get(iX,iY,iZ).template getFieldPointer<descriptors::VELOCITY>();
919 T rho, pi[util::TensorVal<DESCRIPTOR>::n], j[DESCRIPTOR::d];
920 // blockLattice.get(iX,iY).computeAllMomenta(rho, u, pi);
921 rho = blockLattice.get(iX,iY,iZ).computeRho();
922 blockLattice.get(iX,iY,iZ).computeStress(pi);
923
924 int iPi = 0;
925 const int dim = DESCRIPTOR::d;
926 for (int Alpha=0; Alpha<dim; ++Alpha) {
927 for (int Beta=Alpha; Beta<dim; ++Beta) {
928 pi[iPi] += rho/2.*(force[Alpha]*u[Beta] + u[Alpha]*force[Beta]);
929 ++iPi;
930 }
931 }
932 const T piSqr[6] = {pi[0]*pi[0], pi[1]*pi[1], pi[2]*pi[2], pi[3]*pi[3], pi[4]*pi[4], pi[5]*pi[5]};
933 const T PiNeqNormSqr = piSqr[0] + 2.0 * piSqr[1] + 2.0 * piSqr[2] + piSqr[3] + 2.0 * piSqr[4] + piSqr[5];
934 const T PiNeqNorm = util::sqrt(PiNeqNormSqr);
935
936 tPartner->get(iX, iY, iZ).computeJ(j);
937
938 const Vector<T,3> jNeq = {(j[0] - temperature * u[0]), (j[1] - temperature * u[1]), (j[2] - temperature * u[2])};
939
940 const Vector<T,6> t = { 2.0 * jNeq[0] * pi[0], (jNeq[0] + jNeq[1]) * pi[1], (jNeq[0] + jNeq[2]) * pi[2], 2.0 * jNeq[1] * pi[3], (jNeq[1] + jNeq[2]) * pi[4], 2.0 * jNeq[2] * pi[5]};
941 const Vector<T,6> tSqr = {t[0]*t[0], t[1]*t[1], t[2]*t[2], t[3]*t[3], t[4]*t[4], t[5]*t[5]};
942 const T TnormSqr = tSqr[0] + 2.0 * tSqr[1] + 2.0 * tSqr[2] + tSqr[3] + 2.0 * tSqr[4] + tSqr[5];
943 const T Tnorm = util::sqrt(2.0 * 0.25 * TnormSqr);
944
945 auto cutoffKinEnergy_14 = blockLattice.get(iX,iY,iZ).template getField<descriptors::CUTOFF_KIN_ENERGY>();
946 auto cutoffHeatFlux_14 = tPartner->get(iX,iY,iZ).template getField<descriptors::CUTOFF_HEAT_FLUX>();
947
948 const T tau_turb_NS = C_nu * util::sqrt(util::sqrt(2.)/2.) * invCs2 * invCs2 * util::sqrt(PiNeqNorm / rho / tauNS) * cutoffKinEnergy_14;
949 const T tau_turb_AD = C_alpha * invCs2 / rho * util::sqrt(Tnorm * invCs2_g / tauNS / tauAD) * cutoffHeatFlux_14;
950
952 blockLattice.get(iX,iY,iZ).template setField<descriptors::TAU_EFF>(tau_mol_NS + tau_turb_NS);
953 tPartner->get(iX,iY,iZ).template setField<descriptors::TAU_EFF>(tau_mol_AD + tau_turb_AD);
954
955 }
956 }
957 }
958 }
959}
platform_constant Fraction t[Q]
constexpr T invCs2() any_platform
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
bool intersect(int x0, int x1, int y0, int y1, int x0_, int x1_, int y0_, int y1_, int &newX0, int &newX1, int &newY0, int &newY1)
Definition util.h:89
static constexpr int n
result stored in n
Definition util.h:211

References olb::Vector< T, D >::data(), olb::BlockLattice< T, DESCRIPTOR >::get(), olb::BlockStructureD< D >::getCellId(), olb::util::intersect(), olb::util::pow(), and olb::util::sqrt().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: