# Lift coefficient of a wing

Hello everyone,
I am trying to compute lift coefficient of a wing with immersed boundary. The code I am using is as below:

``````forceConversion = param.rho * (param.dxFinest * param.dxFinest * param.dxFinest * param.dxFinest) / (param.dtFinest * param.dtFinest);
force = -reduceImmersedForce<T>(*container, iSurface) * forceConversion
``````

My question is whether the variable ‘force’ is the lift coefficient I want, or it is just a non-dimensionial force.

Thanks,
S. Chu

By the way, I also use grid refinement. When maxOctreeLevel increases by 1, the value of force nearly doubles.

Hello，chust：
‘force‘ is you want, you should use “forceConversion =2* param.rho * (param.dxFinest * param.dxFinest * param.dxFinest * param.dxFinest) / (param.dtFinest * param.dtFinest);”

My case is 3D, so is the form of forceConversion like this? (wing area is 1^2 * AspectRatio)

forceConversion = 2 * param.rho * (param.dxFinest * param.dxFinest * param.dxFinest * param.dxFinest) / (param.dtFinest * param.dtFinest) / AspectRatio;

Hello，chust：
I think that if you want to get force coefficient, you can use " / AspectRatio". if you want to get force ,not use" / AspectRatio"

Hello Lin,
Thank you for your explanation. What do you think of my second question? When I refine the grid, the force doubles as well.

Hello，chust：
May I can see dinfination of your “container”?I want to see your setting ,then I try to make it.

Hello Lin,
My “container” is defined by the function `createFluidBlocks`, which is modified from the example “generalExternalFlow” in palabos.

``````    MultiScalarField3D<T> *rhoBar = nullptr;
MultiTensorField3D<T,3> *j = nullptr;
MultiContainerBlock3D *container = nullptr;
std::vector<MultiBlock3D*> lattice_rho_bar_j_arg;

createFluidBlocks(param, lattices, rhoBar, j, container, lattice_rho_bar_j_arg, order);

void createFluidBlocks(SimulationParameters& param, MultiLevelCoupling3D<T,DESCRIPTOR,RESCALER>*& lattices,
MultiScalarField3D<T>*& rhoBar, MultiTensorField3D<T,3>*& j, MultiContainerBlock3D*& container,
std::vector<MultiBlock3D*>& lattice_rho_bar_j_arg, plint& order)
{
Dynamics<T,DESCRIPTOR> *dynamics = new ConsistentSmagorinskyBGKdynamics<T,DESCRIPTOR>(param.omega[0], param.cSmago);
param.incompressibleModel = false;
pcout << "Dynamics: Smagorinsky BGK." << std::endl;

lattices = new MultiLevelCoupling3D<T,DESCRIPTOR,RESCALER>( param.ogs, dynamics->clone(), order );

for (plint iLevel = 0; iLevel < lattices->getNumLevels(); iLevel++) {
pcout << "Info for lattice at level: " << iLevel << std::endl;
pcout << getMultiBlockInfo(lattices->getLevel(iLevel)) << std::endl;
lattices->getLevel(iLevel).toggleInternalStatistics(false);
}

rhoBar = generateMultiScalarField<T>((MultiBlock3D&) lattices->getLevel(param.finestLevel), param.largeEnvelopeWidth).release();
rhoBar->toggleInternalStatistics(false);

j = generateMultiTensorField<T,3>((MultiBlock3D&) lattices->getLevel(param.finestLevel), param.largeEnvelopeWidth).release();
j->toggleInternalStatistics(false);

container = new MultiContainerBlock3D((MultiBlock3D&) *rhoBar);

lattice_rho_bar_j_arg.clear();
lattice_rho_bar_j_arg.push_back(&(lattices->getLevel(param.finestLevel)));
lattice_rho_bar_j_arg.push_back(rhoBar);
lattice_rho_bar_j_arg.push_back(j);

integrateProcessingFunctional(
new BoxRhoBarJfunctional3D<T,DESCRIPTOR>(),
lattices->getLevel(param.finestLevel).getBoundingBox(), lattice_rho_bar_j_arg, 0);
integrateProcessingFunctional(
new ComputeWallVelocityFunctional<T,DESCRIPTOR>(&param),
lattices->getLevel(param.finestLevel).getBoundingBox(), lattice_rho_bar_j_arg, 1);

// Integrate the immersed boundary processors in the lattice multi-block.

std::vector<MultiBlock3D*> args;

plint pl = 2;

args.resize(0);
args.push_back(container);
integrateProcessingFunctional(
new InstantiateImmersedWallDataWithIndexedTagging3D<T>(param.vertices, param.areas, param.flags),
container->getBoundingBox(), lattices->getLevel(param.finestLevel), args, pl);
pl++;

for (plint i = 0; i < param.ibIter; i++) {
args.resize(0);
args.push_back(rhoBar);
args.push_back(j);
args.push_back(container);
integrateProcessingFunctional(
new IndexedInamuroIteration3D<T,VelFunction>(
VelFunction(param), 1.0 / param.omega[param.finestLevel], param.incompressibleModel),
rhoBar->getBoundingBox(), lattices->getLevel(param.finestLevel), args, pl);
pl++;
}
integrateProcessingFunctional(
new ExternalRhoJcollideAndStream3D<T,DESCRIPTOR>(),
lattices->getLevel(param.finestLevel).getBoundingBox(), lattice_rho_bar_j_arg, pl);
}
``````

Hello，chust：
I know it, i use it to simulate ,too. in this part, which one you choose
“global::timer(“lb-iter”).start();
global::timer(“solver”).start();
lattices.collideAndStream(0, useExecuteInternalProcessors, extProcFunIds, computeStats, statsId, ids, results);
global::timer(“solver”).stop();
global::timer(“lb-iter”).stop();”
Or
" global::timer(“lb-iter”).start();
lattice->executeInternalProcessors(); // Execute all processors and communicate appropriately.
global::timer(“lb-iter”).stop();
lattice->incrementTime();
}"

I use the first one.

``````    std::map<plint, bool> useExecuteInternalProcessors;
for (plint iLevel = 0; iLevel <= param.finestLevel; iLevel++) {
useExecuteInternalProcessors[iLevel] = false;
}
useExecuteInternalProcessors[param.finestLevel] = true;

//...
lattices->collideAndStream(0, useExecuteInternalProcessors, extProcFunIds, computeStats, statsId, ids, results);
``````

I think it was no problem. AND the model"Smagorinsky BGK" and incompressible ,i think whether the model is a problem? can you show the article about your case?

Maybe I should try a MRT model?
The case I am testing is a horizontally flapping wing (HFW) in this paper. The motion data and force are in Fig. 10.

but MRT model is not for this.( // The “order” is about how Palabos rescales the populations. For now, we work at order 0.
// RESCALER means: we use convective scaling,
// Palabos scales only the populations and no external scalars, and
// this works for BGK but not for MRT.
plint order = 0;)

I forgot this.

In next days， i will simulate it . if I succeed , i will inform you of it.

Hello，S. Chu:
Although this paper ,i find you can choose the model"incBGK" and param.incompressibleModel = true.ThenI tried to use IBM and grid refinement, but I fail it,Can you help me ?

Hello Lin,