Mike
Forum Replies Created
-
AuthorPosts
-
MikeParticipant
Here is my code, I do use discretnormal directions to get unknownIndexes.
As for setter code, it is like:
setHalfBounceBackBoundary(NSlattice, omega, supergeometry, 4);
4 means solid node, which is implemented with nodynamics.template<typename T, typename DESCRIPTOR, class MixinDynamics>
void setHalfBounceBackBoundary(BlockLatticeStructure2D<T,DESCRIPTOR>& block, T omega, BlockIndicatorF2D<T>& indicator, bool includeOuterCells)
{
OstreamManager clout(std::cout, “setHalfBounceBackBoundary2D”);
auto& blockGeometryStructure = indicator.getBlockGeometryStructure();
const int margin = includeOuterCells ? 0 : 1;
/*
*x0,x1,y0,y1 Range of cells to be traversed
**/
int x0 = margin;
int y0 = margin;
int x1 = blockGeometryStructure.getNx()-1 -margin;
int y1 = blockGeometryStructure.getNy()-1 -margin;
std::vector<int> discreteNormal(3, 0);
for (int iX = x0; iX <= x1; ++iX) {
for (int iY = y0; iY <= y1; ++iY) {
//momenta vector provisionally inside src/core/blockLatticeStructure3D.h
Momenta<T, DESCRIPTOR>* momenta = nullptr;
Dynamics<T, DESCRIPTOR>* dynamics = nullptr;
// Momenta<T, DESCRIPTOR>* momenta = new BulkMomenta<T, DESCRIPTOR>();
// Dynamics<T, DESCRIPTOR>* dynamics = new NoDynamics<T, DESCRIPTOR>();
PostProcessorGenerator2D<T, DESCRIPTOR>* postProcessor = nullptr;
if (indicator(iX, iY)) {
discreteNormal = indicator.getBlockGeometryStructure().getStatistics().getType(iX, iY);
clout << discreteNormal[0] << ” ” << discreteNormal[1] << ” ” << discreteNormal[2] << std::endl;if (discreteNormal[0] == 0) {
//set the momenta,dynamics and post processor on the indicated local velocity boundary cells
if (discreteNormal[1] == 1) {
postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 0, 1>(iX, iY);
}
else if (discreteNormal[1] == -1) {postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 0, -1>(iX, iY);
}
else if (discreteNormal[2] == 1) {postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, 1>(iX, iY);
}
else if (discreteNormal[2] == -1) {postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, -1>(iX, iY);
}
else {
clout << “here “<< “Could not setHalfBounceBackBoundary2D (” << iX
<< “, ” << iY << “)” << std::endl;
clout << discreteNormal[0] << ” ” << discreteNormal[1] << ” ” << discreteNormal[2] << std::endl;
}
}
else if (discreteNormal[0] == 1) {
//sets the momenta, dynamics and post processors on indicated localVelocityCornerBoundary cells
if (discreteNormal[1] == 1) {
if (discreteNormal[2] == 1) {
postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, 8>(iX, iY);
}
else if (discreteNormal[2] == -1) {
// clout << “5” << endl;postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, -8>(iX, iY);
}
else {
clout << “Could not setHalfBounceBackBoundary2D (” << iX
<< “, ” << iY << “)” << std::endl;
}
}
else if (discreteNormal[1] == -1) {
if (discreteNormal[2] == 1) {
postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, 9>(iX, iY);
}
else if (discreteNormal[2] == -1) {
postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, -9>(iX, iY);
}
else {
clout << “Could not setHalfBounceBackBoundary2D (” << iX
<< “, ” << iY << “)” << std::endl;
}
}
}
//sets momenta, dynamics and postProcessors on local InnerVelocityCornerBoundary Cells
else if (discreteNormal[0] == 2) {
if (discreteNormal[1] == 1) {
if (discreteNormal[2] == 1) {postProcessor = nullptr;
}
else if (discreteNormal[2] == -1) {postProcessor = nullptr;
}
else {
clout << “Could not setHalfBounceBackBoundary2D (” << iX
<< “, ” << iY << “)” << std::endl;
}
}
else if (discreteNormal[1] == -1) {
if (discreteNormal[2] == 1) {postProcessor = nullptr;
}
else if (discreteNormal[2] == -1) {
clout << “6” << endl;// postProcessor = new BoundaryStreamPostProcessorGenerator2D<T, DESCRIPTOR, 1, 8>(iX, iY);
}
else {
clout << “Could not setHalfBounceBackBoundary2D (” << iX
<< “, ” << iY << “)” << std::endl;
}
}
}setBoundary<T, DESCRIPTOR, MixinDynamics>(block, omega, iX,iY, momenta, dynamics, postProcessor);
}
}
}}
MikeParticipantSorry, I answered too fast and has used up my modified limit…
your idea seems different from what I thought before, yours in code is:
cell.neighbor(descriptors::c<DESCRIPTOR>(unknownIndexes[i]))[util::opposite<DESCRIPTOR>(unknownIndexes[i])] = cell[unknownIndexes[i]];am I right?
I will change code and see if the result is fine. Thank you and sorry to bother again…MikeParticipantThank you for your reply!
I agree with your idea.
Below is my code :
std::vector<int> unknownIndexes;
// east-top
// I change the oritation in self-defined sethalfbbboundary.hh
if(orientation == 8){unknownIndexes = {3};
}
//east bottom
else if(orientation == -8){unknownIndexes = {1};
}
// west top
else if(orientation == 9){unknownIndexes = {5};
}
// west bottom
else if(orientation == -9){
unknownIndexes = {7};}
else{
unknownIndexes = util::subIndexOutgoing<DESCRIPTOR, direction,
orientation>();
}
auto cell = blockLattice.get(x, y);for (unsigned i = 0; i < unknownIndexes.size(); ++i) {
cell[unknownIndexes[i]] = cell.neighbor(descriptors::c<DESCRIPTOR>(unknownIndexes[i]))[util::opposite<DESCRIPTOR>(unknownIndexes[i])];
}
as in main function, I define solid boundaries nodynamics.
MikeParticipantHello Adian,
Does the class BounceBack in olb-1.4 means full-way bounce back? I am running transient cases, and I learned that half-way bounce back is more accurate than full-way in time. so I wonder how to implement it in openlb.
since you have mentioned postprocessor previously, then I tried with that but it didn’t work well. Could you elaborate how to implement it? Thank you in advance.
Here is my plan, since half-way only change streaming process, I define walls with bulk dynamics and use a postprocessor to make modifications, which basically implement bounce-back rules according to their directions.
Yours,
MikeMikeParticipantHello Mathias,
Thank you for your reply again! I understand that stafanmelting2d is a benchmark case that can be compared with non-LBM approaches to demonstrate the capabilities of the current LBM method, and the results match very well.
However, when I developed another self-coded program concerning phase change and used the harmonic mean value for “cp_ref,” the simulation diverged. On the other hand, when I used “cp_s” for “cp_ref,” the simulation converged. Interestingly, the simulation diverged regardless of whether “cp_ref” was larger or smaller than “cp_s.”
Therefore, if “cp_ref” affects the accuracy, I may need to conduct a verification experiment. This is why I want to figure this out.
Best regards,
MikeMikeParticipantHello Mathias,
Thanks for your reply! From the perspective of results, “cp_ref” seems to have a serious impact on the simulation accuracy. And the paper mentioned above also mentioned that value of “cp_ref” affects the numerical stability. But when I look into the introduction process of “cp_ref”, it seems that “cp_ref” can be eliminated finally, which may not affect the accuracy of results.
I am uncertain if I have misunderstood this, and I look forward to your response!
Best regards,
MikeMikeParticipantHello Fedor,
Thank you for your reply! I’ll take a look at the dynamics class and boundary implementing.
Greetings
MikeMikeParticipantHello Fedor,
Thanks for your reply, I would definitely take a look at GPU accelerating.
Yours
MikeMikeParticipantHello everyone,
I also wonder why pcm specific heat is set as 1, which I think it should be set as converter.getLatticeSpecificHeatCapacity(physSpecificHeatCapacity), it will be much appreciated if anyone can help solve this!
Best
MikeMikeParticipantDear stephan,
thanks for your reply!
BR
MikeMikeParticipantDear Adrian,
Thank you again for your reply! Earlier I was thinking something goes wrong within my code about IndicatorSin2D, or there exist a parameter I don’t find deep inside the Indicator like a geometry resolution or something, which can be adjusted to refine the Indicator shape.
Also I’m curious about what lead to the problem that the fin-shape is not the same as I suppose.Is it because that I created in a wrong way or is it about the display problem or something else.What’s more, when I use ug or freecad to create 3D geometry model and import it to openlb, the fin-shape is pretty nice.What is the mechanism behind this.I would appreciate it if you can help!
Best
MikeMikeParticipantDear Adrian,
Thanks for your reply! Yes, the fin-shape get finer if I increase the resolution, which does not make sense and prolong the simulation time.Also, I have tried to find if I can solve this problem by change some parameters in heatmap namespace,but I can not.What’s more, I notice that the fin-shape in paraview is similar to what it looks like in openlb getresults,which persuade me it may has nothing to do with heatmap, I don’t know if I get this right……
As for VTK output, I know little about it.And it is too long and unreadable that I hesitate to put it here.But if it helps, I would be glad to do this!
Best
Mike- This reply was modified 3 years, 1 month ago by Mike.
MikeParticipantHello Mathias,
Thanks for your apply! By “incomplete” I mean the fin shape showed in the post-process image is not what I imagine, it seems part of the fin is missing due to resolution setting or something else.
The image is listed blow,I intend to design a sin-shaped fin, but it came out as a triangle like.
temperature image
Best
Mike- This reply was modified 3 years, 1 month ago by Mike.
MikeParticipantDear Stephan,
Thanks for your reply!I am sorry for my carelessness.Your reply really helps a lot,thanks again!
Best Regards,
MikeMikeParticipantDear Adrian,
thanks for your reply!
Best Regards,
Mike -
AuthorPosts