Skip to content

Reply To: Heat transfer liquid-solid and heat conduction in solids

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Heat transfer liquid-solid and heat conduction in solids Reply To: Heat transfer liquid-solid and heat conduction in solids

#7198
FBukreev
Keymaster

Hello,

the source term is an external field defined in the Descriptor like:
using TDESCRIPTOR = D2Q5<VELOCITY,TEMPERATURE>;

You can accesss this field from the setup in 2 ways:
ADlattice.defineField<descriptors::VELOCITY>(superGeometry.getMaterialIndicator({1, 2, 3}), u0);
The u0 is an AnalyticalFunctor then.

The second way is if you want calculate some source term in each cell separately, then you need to write a method inside of the setup with the following scheme:

template<typename T>
void setTemperature(SuperLattice<T, DESCRIPTOR>& sLattice){
    for (int iC = 0; iC < sLattice.getLoadBalancer().size(); iC++) {

      int nx = sLattice.getBlock(iC).getNx();
      int ny = sLattice.getBlock(iC).getNy();
      int nz = sLattice.getBlock(iC).getNz();

      for (int iX = 0; iX < nx; ++iX) {
        for (int iY = 0; iY < ny; ++iY) {
          for (int iZ = 0; iZ < nz; ++iZ) {

            //calculation
            T scalar = someValue;
            sLatticeAD.getBlock(iC).get(iX,iY,iZ).template  setField<descriptors::TEMPERATURE>(scalar);
          }
        }
      }
    }
}

Greetings
Fedor

  • This reply was modified 1 year, 3 months ago by FBukreev.
  • This reply was modified 1 year, 3 months ago by FBukreev.
  • This reply was modified 1 year, 3 months ago by FBukreev.
  • This reply was modified 1 year, 3 months ago by FBukreev.