Skip to content

Commit 0402bf2

Browse files
authored
Merge pull request #503 from TravisMitchell/overlay/thermo
Move thermocapillary model to TCLB/overlay framework
2 parents 6f0196d + 6c63685 commit 0402bf2

File tree

6 files changed

+32
-392
lines changed

6 files changed

+32
-392
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,29 @@ The DEM codes that TCLB can be integrated with are:
106106

107107
Refer to the documentation for instructions on compilation and coupling.
108108

109+
## Models
110+
For users looking to apply existing LBM methods, common/supported models are below. Note extensions to these models exist using the [TCLB's overlay](https://github.com/CFD-GO/TCLB_overlay) framework and TCLB optional compile flags.
111+
112+
**Two-Dimensional**
113+
- d2q9: MRT LBM for single-phase flow.
114+
- d2q9_les: MRT LBM with Smagorinski LES turbulence model.
115+
- d2q9q9_cm_cht: thermal LBM with Boussinesq approx for coupling and cumulant or cascaded relaxation kernels.
116+
- d2q9_pf_velocity: multiphase LBM based on the phase field model and incompressible LBM.
117+
118+
**Three-Dimensional**
119+
- d3q27_cumulant: cumulant LBM with options for:
120+
* Interpolated bounceback.
121+
* Smagorinski LES turbulence model.
122+
- d3q27q27_cm_cht: thermal LBM with Boussinesq approx for coupling and cumulant or cascaded collision relaxation kernels.
123+
- d3q27_pf_velocity: multiphase LBM based on the phase field model and incompressible LBM.
124+
* Options for various contact angle implementations (surface energy or geometric)
125+
* [Thermocapillary flow extension](https://github.com/TravisMitchell/thermocapillary)
126+
127+
**Particle (DEM) Coupled**
128+
- d3q27_PSM: Applies the partially saturated model for coupling particles in single phase flow.
129+
* Options for Two-Relaxation-Time kernel
130+
* Option for Non-Equilibiurm Bounce-Back and Superposition for the DEM-LBM coupling.
131+
109132
## About
110133

111134
### Authors

models/multiphase/d3q27_pf_velocity/Dynamics.R

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,6 @@ if (Options$geometric){
108108
AddField("PhaseF",stencil3d=1, group="PF")
109109
}
110110

111-
if (Options$thermo){
112-
source("thermocapillary.R")
113-
114-
save_initial_PF = c(save_initial_PF,"Thermal")
115-
save_iteration = c(save_iteration, "Thermal")
116-
load_iteration = c(load_iteration, "Thermal")
117-
}
118-
119111
######################
120112
########STAGES########
121113
######################
@@ -138,26 +130,11 @@ if (Options$thermo){
138130
AddStage("calcWall" , "calcWallPhase", save=Fields$name=="PhaseF", load=DensityAll$group %in% c("nw", "solid_boundary", extra_fields_to_load_for_bc))
139131
AddStage("calcWallPhase_correction", "calcWallPhase_correction", save=Fields$name=="PhaseF", load=DensityAll$group %in% c("nw", "solid_boundary"))
140132
}
141-
if (Options$thermo){
142-
AddStage("CopyDistributions", "TempCopy", save=Fields$group %in% c("g","h","Vel","nw", "PF","Thermal"))
143-
AddStage("CopyThermal","ThermalCopy", save=Fields$name %in% c("Temp","Cond","SurfaceTension"), load=DensityAll$name %in% c("Temp","Cond","SurfaceTension"))
144-
AddStage("RK_1", "TempUpdate1", save=Fields$name=="RK1", load=DensityAll$name %in% c("U","V","W","Cond","PhaseF","Temp"))
145-
AddStage("RK_2", "TempUpdate2", save=Fields$name=="RK2", load=DensityAll$name %in% c("U","V","W","RK1","Cond","PhaseF","Temp"))
146-
AddStage("RK_3", "TempUpdate3", save=Fields$name=="RK3", load=DensityAll$name %in% c("U","V","W","RK1","RK2","Cond","PhaseF","Temp"))
147-
AddStage("RK_4", "TempUpdate4", save=Fields$name %in% c("Temp","SurfaceTension"), load=DensityAll$name %in% c("U","V","W","RK1","RK2","RK3","Cond","PhaseF","Temp"))
148-
149-
AddStage("NonLocalTemp","BoundUpdate", save=Fields$name %in% c("Temp","SurfaceTension"), load=DensityAll$name %in% c("Temp"))
150-
}
151133

152134
#######################
153135
########ACTIONS########
154136
#######################
155-
if (Options$thermo){
156-
AddAction("TempToSteadyState", c("CopyDistributions","RK_1", "RK_2", "RK_3", "RK_4","NonLocalTemp"))
157-
AddAction("Iteration", c("BaseIter", "calcPhase", "calcWall","RK_1", "RK_2", "RK_3", "RK_4","NonLocalTemp"))
158-
AddAction("IterationConstantTemp", c("BaseIter", "calcPhase", "calcWall","CopyThermal"))
159-
AddAction("Init" , c("PhaseInit","WallInit" , "calcWall","BaseInit"))
160-
} else if (Options$geometric) {
137+
if (Options$geometric) {
161138
calcGrad <- if (Options$isograd) "calcPhaseGrad" else "calcPhaseGrad_init"
162139
AddAction("Iteration", c("BaseIter", "calcPhase", calcGrad, "calcWall_CA", "calcWallPhase_correction"))
163140
AddAction("Init" , c("PhaseInit","WallInit_CA" , "calcPhaseGrad_init" , "calcWall_CA", "calcWallPhase_correction", "BaseInit"))

models/multiphase/d3q27_pf_velocity/Dynamics.c.Rt

Lines changed: 7 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
// xx/xx/2022: Extension of phase field to d3q27 option to move away from crappy q15 lattice.
4343
// xx/xx/2022: Development of geometric wetting B.C. option as well as existing surface energy.
4444
// xx/xx/2023: Code extension for wetting on curved boundaries.
45+
// 30/01/2024: Thermocapillary support moved to TCLB overlay: https://github.com/TravisMitchell/thermocapillary
4546

4647
#include <math.h>
4748
#define PI 3.14159265
@@ -217,13 +218,8 @@ CudaDeviceFunction real_t calcMu(real_t C)
217218
myLaplace('lpPhi', 'PhaseF')
218219
?>
219220
#endif
220-
#ifdef OPTIONS_thermo
221-
mu = 4.0*(12.0*SurfaceTension(0,0,0)/IntWidth)*(C-PhaseField_l)*(C-PhaseField_h)*(C-pfavg)
222-
- (1.5 *SurfaceTension(0,0,0)*IntWidth) * lpPhi;
223-
#else
224-
mu = 4.0*(12.0*sigma/IntWidth)*(C-PhaseField_l)*(C-PhaseField_h)*(C-pfavg)
225-
- (1.5 *sigma*IntWidth) * lpPhi;
226-
#endif
221+
mu = 4.0*(12.0*sigma/IntWidth)*(C-PhaseField_l)*(C-PhaseField_h)*(C-pfavg)
222+
- (1.5 *sigma*IntWidth) * lpPhi;
227223
return mu;
228224
}
229225

@@ -288,35 +284,7 @@ CudaDeviceFunction void InitFromFieldsStage()
288284
}
289285

290286
CudaDeviceFunction void specialCases_Init()
291-
{
292-
#ifdef OPTIONS_thermo
293-
Temp = T_init;
294-
if (fabs(dT) > 0){
295-
Temp = T_init + dT*Y;
296-
}
297-
if (fabs(dTx) > 0){
298-
Temp = T_init + dTx*X;
299-
}
300-
#ifdef OPTIONS_planarBenchmark
301-
if ( (NodeType & NODE_ADDITIONALS) == NODE_BWall) { //bottom wall
302-
real_t x, omega;
303-
x = (X-0.5) - myL;
304-
omega = 3.1415926535897 / myL;
305-
Temp = T_h + T_0 * cos(omega * x);
306-
printf("y,x=%.4lf,%.4lf\n", Y,x);
307-
} else if ( (NodeType & NODE_ADDITIONALS) == NODE_TWall) {
308-
Temp = T_c;
309-
printf("y,x=%.4lf,%.4lf\n", Y, X);
310-
}
311-
PhaseF = 0.5 + PLUSMINUS * (0.5) * tanh( (Y - MIDPOINT)/(IntWidth/2) );
312-
#endif
313-
if (surfPower > 1) {
314-
SurfaceTension = sigma + sigma_TT*pow((Temp(0,0,0) - T_ref),surfPower) * (1.0/surfPower);
315-
} else {
316-
SurfaceTension = sigma + sigma_T*(Temp(0,0,0) - T_ref);
317-
}
318-
Cond = interp(PhaseF, k_h, k_l);
319-
#endif
287+
{
320288
// Pre-defined Initialisation patterns:
321289
// Diffuse interface sphere
322290
// BubbleType = -1 refers to light fluid bubble.
@@ -418,10 +386,6 @@ CudaDeviceFunction void Init_distributions()
418386
?>
419387
pnorm = <?R C(sum(g)) ?>;
420388
PhaseF = <?R C(sum(h)) ?>;
421-
#ifdef OPTIONS_thermo
422-
Temp = Temp(0,0,0);
423-
Cond = interp(PhaseF, k_h, k_l);
424-
#endif
425389
#ifdef OPTIONS_OutFlow
426390
if ((NodeType & NODE_BOUNDARY) == NODE_EConvect){
427391
<?R if (Options$OutFlow){
@@ -526,38 +490,9 @@ CudaDeviceFunction void calc_Fb(real_t *fx, real_t *fy, real_t *fz, real_t rho){
526490
}
527491

528492
CudaDeviceFunction void calc_Fs(real_t *fx, real_t *fy, real_t *fz, real_t mu, vector_t gPhi){
529-
#ifdef OPTIONS_thermo
530-
Temp = Temp(0,0,0);
531-
SurfaceTension = SurfaceTension(0,0,0);
532-
Cond = Cond(0,0,0);
533-
real_t tmpSig, delta_s, dotTMP, magnPhi, magnPhi2;
534-
magnPhi = sqrt(gPhi.x*gPhi.x + gPhi.y*gPhi.y + gPhi.z*gPhi.z);
535-
magnPhi2 = magnPhi*magnPhi;
536-
vector_t gradT;
537-
<?R
538-
IsotropicGrad('gradT','Temp')
539-
?>
540-
dotTMP = dotProduct(gradT,gPhi);
541-
if (surfPower < 2) {
542-
delta_s = 1.5*IntWidth*sigma_T;
543-
*fx = mu * gPhi.x + delta_s*( magnPhi2*gradT.x - dotTMP*gPhi.x );
544-
*fy = mu * gPhi.y + delta_s*( magnPhi2*gradT.y - dotTMP*gPhi.y );
545-
*fz = mu * gPhi.z + delta_s*( magnPhi2*gradT.z - dotTMP*gPhi.z );
546-
} else {
547-
vector_t gradSig;
548-
<?R
549-
IsotropicGrad('gradSig','SurfaceTension')
550-
?>
551-
delta_s = 1.5*IntWidth;
552-
*fx = mu * gPhi.x + delta_s*gradSig.x*( magnPhi2*gradT.x - dotTMP*gPhi.x );
553-
*fy = mu * gPhi.y + delta_s*gradSig.y*( magnPhi2*gradT.y - dotTMP*gPhi.y );
554-
*fz = mu * gPhi.z + delta_s*gradSig.z*( magnPhi2*gradT.z - dotTMP*gPhi.z );
555-
}
556-
#else
557-
*fx = mu * gPhi.x;
558-
*fy = mu * gPhi.y;
559-
*fz = mu * gPhi.z;
560-
#endif
493+
*fx = mu * gPhi.x;
494+
*fy = mu * gPhi.y;
495+
*fz = mu * gPhi.z;
561496
}
562497

563498
#ifndef OPTIONS_BGK
@@ -836,13 +771,6 @@ CudaDeviceFunction void updateTrackers(real_t C){
836771
}
837772
}
838773
}
839-
//#############//
840-
//######THERMOCAPILLARY UPDATE######//
841-
#ifdef OPTIONS_thermo
842-
<?RT models/multiphase/d3q27_pf_velocity/thermo.c.Rt ?>
843-
#endif
844-
//#############//
845-
846774

847775
#ifdef OPTIONS_BGK
848776
CudaDeviceFunction void CollisionBGK()

models/multiphase/d3q27_pf_velocity/conf.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ADJOINT=0
22
TEST=FALSE
3-
OPT="(q27 + OutFlow + BGK + thermo*planarBenchmark)*autosym*geometric*staircaseimp*isograd*tprec"
3+
OPT="(q27 + OutFlow + BGK)*autosym*geometric*staircaseimp*isograd*tprec"
44
# q27 - Q27 lattice structure for phasefield
55
#
66
# OutFlow - include extra velocity stencil for outflowing boundaries

0 commit comments

Comments
 (0)