Skip to content

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

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #6823
    Matthias
    Participant

    Hey all,

    I want to simulate the surface temperature of a pipe that is cooled by a gas/fluid inside.
    To do this, I need the heat exchange of the fluid with the inside of the pipe and also the heat conduction within the pipe material.
    The exchange of the outside of the pipe with the environment is defined by the heat transfer coefficient.
    Can OpenLB simulate this or can the code be adapted for this?
    I would be very happy if someone can assess this, share experience or even give advice.

    With kind regards
    Matthias

    #6840
    FBukreev
    Keymaster

    Hello Matthias,

    it would be possible, if You take a larger calculation region for the pipe wall and perform there the temperature ADE with the wall material temperature conductivity -> other relaxation time. The velocity in the pipe must be set to 0. The heat flux to the environment must be defined as a source term, but possibly there must be written some new boundary condition.

    Kind regards,
    Fedor

    #7194
    Henderson_C
    Participant

    Dear FBukreev,

    Regarding the source term, how can I access and modify the source code? For example, I tried to look for the source term in the galliummelting2d example. But I was not able to locate it. Please guide me on how can I add the heat flux source term.

    Thanks,

    #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 ago by FBukreev.
    • This reply was modified 1 year ago by FBukreev.
    • This reply was modified 1 year ago by FBukreev.
    • This reply was modified 1 year ago by FBukreev.
    #7204
    Henderson_C
    Participant

    Dear Fedor,

    Thank you for our prompt reply. Instead of calculating or obtaining the velocity or temperature in a certain material number, I want to impose a heat source at certain space and time during the streaming and collision steps. However I am not sure if this is done through a source term.

    Best regards,

    #7205
    FBukreev
    Keymaster

    if you have the heat source then you need to use advection diffusion lbm for heat and then calculate tempreature fom it. But the sourtce term is anyway programmed on the way how I mentioned it above.

    Regards,
    Fedor

    #7208
    Henderson_C
    Participant

    Dear Fedor,

    I have modified the function to include a certain temperature at certain location, but the problem is that I do not see the temperature change when I visualize it in Paraview. What I understand from the above code, is that for a certain cell I can change the “Temperature” of a cell to a certain value.

    Regards,

    #7209
    FBukreev
    Keymaster

    Hello,

    yes, this is the way to change some value per cell.
    There are many reasons why the temperature does not change. You need to display the temperature value after each operation with ADE equation to find the reason.

    Regards
    Fedor

    #7635
    Jijo
    Participant

    Dear Fedor,

    I have read your response on setting the value of rho to each cell. That is exactly what I need and I am thankful for your help but it seems that this function does not work for parallel running. Does it? The value of iC is always zero and does not increase further. Any help on that would really be appreciated.

    Best regards,

    #7636
    FBukreev
    Keymaster

    Dear Jijo,

    if you have only 1 cuboid there will be only iC=0.

    Best regards
    Fedor

    #7637
    Jijo
    Participant

    Dear Fedor,

    It seems that I am missing something here. I am running the simulation using the command (mpirun -np 10 ./bstep) which will divide the domain into 10 cuboids. but the above loop only iterates through iC=0.

    I apologize for the question but I am genuinely confuse.

    Best regards,

    #7641
    mathias
    Keymaster

    Did you change the Makefile config (Parallel mode flag AND compiler) and recompile the entire code?

    #7643
    Jijo
    Participant

    Dear Dr. Mathias,

    I did that and the simulation is running. The problem is with the simulation output where the loop only iterates around the cuboid ranked 0 instead of the other 9 cuboids.

    I think problem lies with the following snippet code:

    Vector<T,2> extendStep( lengthStep, heightStep );
    Vector<T,2> originStep( 0, 0);
    std::shared_ptr<IndicatorF2D<T>> step = std::make_shared<IndicatorCuboid2D<T>>( extendStep, originStep );
    CuboidGeometry2D<T> cuboidGeometry( *(channel-step), converter.getConversionFactorLength(), 10 );

    If I change 10 to 1, the output is correct.

    Best regards,

    #7644
    FBukreev
    Keymaster

    Dear Jijo,

    you can also try to write your own Coupler like one of navierStokesAdvectionDiffusionCoupling.h. They also run parallelly.
    But I think the problem is still somewhere in the config.

    Best regards,
    Fedor

    #7726
    Jijo
    Participant

    Dear Fedor,

    I appreciate your help.

    This is my config file:
    ///
    # Example build config for OpenLB using GNU C++ and OpenMPI
    #
    # Usage:
    # – Copy this file to OpenLB root as config.mk
    # – Run make clean; make
    # – Switch to example directory, e.g. examples/laminar/cavity3dBenchmark
    # – Run make
    # – Start the simulation using mpirun ./cavity3d
    #
    # Usage of the Intel C++ compiler is recommended for Intel CPU clusters.
    # See config/cpu_simd_intel_mpi.mk for guidance.

    CXX := mpic++
    CC := gcc

    # The march=native flag enables AVX2 / AVX-512 instructions if available.
    # However, actually using them requires adding the CPU_SIMD platform.
    #
    # Note that on some clusters the head node for compilation may differ from
    # the compute nodes, necessitating manual selection of the correct
    # architecture / SIMD flags. Alternatively, compilation at the start of
    # the HPC jobs is a common option.
    CXXFLAGS := -O3 -Wall -march=native -mtune=native
    CXXFLAGS += -std=c++17

    # HYBRID mode is also possible but more complex to run correctly
    PARALLEL_MODE := MPI

    # optional MPI and OpenMP flags
    OMPFLAGS := -fopenmp

    # SIMD support may optionally be enabled by adding the CPU_SIMD platform
    PLATFORMS := CPU_SISD # CPU_SIMD

    FLOATING_POINT_TYPE := double

    USE_EMBEDDED_DEPENDENCIES := ON

    // END ///////////////////////////////////////////////

    I do not get why does this not work. I have tried the Squarecavity2d Example and it loops around only 1. Is there any other way to set a certain cell a source(Temperature)? Pretty much stuck at this point from last time.

    Thanks,
    Jijo

Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.