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
- This topic has 21 replies, 5 voices, and was last updated 1 year, 6 months ago by FBukreev.
-
AuthorPosts
-
September 25, 2022 at 10:46 pm #6823MatthiasParticipant
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
MatthiasSeptember 28, 2022 at 11:41 am #6840FBukreevKeymasterHello 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,
FedorFebruary 14, 2023 at 3:51 pm #7194Henderson_CParticipantDear 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,
February 16, 2023 at 12:04 pm #7198FBukreevKeymasterHello,
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
FedorFebruary 16, 2023 at 4:09 pm #7204Henderson_CParticipantDear 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,
February 16, 2023 at 4:13 pm #7205FBukreevKeymasterif 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,
FedorFebruary 19, 2023 at 11:39 am #7208Henderson_CParticipantDear 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,
February 19, 2023 at 12:47 pm #7209FBukreevKeymasterHello,
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
FedorJuly 19, 2023 at 10:53 am #7635JijoParticipantDear 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,
July 19, 2023 at 12:42 pm #7636FBukreevKeymasterDear Jijo,
if you have only 1 cuboid there will be only iC=0.
Best regards
FedorJuly 19, 2023 at 3:18 pm #7637JijoParticipantDear 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,
July 20, 2023 at 11:57 pm #7641mathiasKeymasterDid you change the Makefile config (Parallel mode flag AND compiler) and recompile the entire code?
July 21, 2023 at 12:44 pm #7643JijoParticipantDear 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,
July 21, 2023 at 2:19 pm #7644FBukreevKeymasterDear 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,
FedorSeptember 6, 2023 at 9:07 am #7726JijoParticipantDear 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 asconfig.mk
# – Runmake clean; make
# – Switch to example directory, e.g.examples/laminar/cavity3dBenchmark
# – Runmake
# – Start the simulation usingmpirun ./cavity3d
#
# Usage of the Intel C++ compiler is recommended for Intel CPU clusters.
# Seeconfig/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 theCPU_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_SIMDFLOATING_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 -
AuthorPosts
- You must be logged in to reply to this topic.