achodankar
Forum Replies Created
-
AuthorPosts
-
achodankarParticipant
Hello Mathias,
Thank you very much. I understand it well now.Yours sincerely,
Abhijeet
achodankarParticipantHello Mathias,
Thank you for your response. I used two ways to declare the values:
1) const T
2) size_t (as done in the code)Why use size_t over const T declaration? I get the same values. I understand the rounding part as you suggested.
Here is the code snippet I tested with
cout<<“The physical simulation time is “<<maxPhysT<<endl;
size_t lattice_time = (maxPhysT/converter.getConversionFactorTime()+0.5);OR
const T lattice_time = maxPhysT/converter.getConversionFactorTime();
cout<<“The Lattice time is “<<converter.getLatticeTime(maxPhysT)<<endl;
cout<<“The Lattice time is “<<lattice_time<<endl;Thank you.
Yours sincerely,
Abhijeet D. Chodankar
achodankarParticipantHello Adrian,
I employed your suggestion, however, the same issue shows up again. Here is the code snippet://——————Convert physical coordinates to lattice coordinates————–
//std::vector<int> latticeR(2,T());
int latticeNew[2];
T physNew[2];cout<<“——-Convert Physical coordinates to Lattice coordinates———-“<<endl;
for (int iC=0; iC < cuboidGeometry.getNc(); ++iC)
{
for (int iX=0; iX < cuboidGeometry.get(iC).getNx(); ++iX)
{
for (int iY=0; iY < cuboidGeometry.get(iC).getNy(); ++iY)
{
// physCord[0] = x_phys[iX][iY][iC];
// physCord[1] = y_phys[iX][iY][iC];
// cuboidGeometry.getLatticeR(physCord, latticeR);
physNew[0] = x_phys[iX][iY][iC];
physNew[1] = y_phys[iX][iY][iC];
cuboidGeometry.getLatticeR(latticeNew, physNew);
// cout<<physCord[0]<<“,”<<physCord[1]<<“,”<<latticeR[0]<<“,”<<latticeR[1]<<endl;
cout<<physNew[0]<<“,”<<physNew[1]<<“,”<<latticeNew[0]<<“,”<<latticeNew[1]<<endl;
}
cout<<endl;
}
cout<<endl;
}
cout<<“—————————————————————“<<endl;
//———————————————————————————–Thank you.
Yours sincerely,
Abhijeet
July 28, 2021 at 9:06 pm in reply to: Poiseuille 2D (Erroneous results for lx and ly smaller than 1) #5857achodankarParticipantHello Adrian,
I change the geometric domain values, i.e lx and ly are set to values smaller than 1. For example: lx=0.2 and ly=0.1. The output vtk files don’t show up for this case.Thank you.
Yours sincerely,
Abhijeet
July 28, 2021 at 4:34 am in reply to: Extract force values from Lattice(Poiseuille 2D example) #5853achodankarParticipantHello Adrian,
This worked perfect.Thank you very much!!!
Yours sincerely,
Abhijeet
achodankarParticipantHello Adrian,
I forgot to include the code. My apologies. Here is the code://——————Convert physical coordinates to lattice coordinates————–
std::vector<int> latticeR(2,T());cout<<“——-Convert Physical coordinates to Lattice coordinates———-“<<endl;
for (int iC=0; iC < cuboidGeometry.getNc(); ++iC)
{
for (int iX=0; iX < cuboidGeometry.get(iC).getNx(); ++iX)
{
for (int iY=0; iY < cuboidGeometry.get(iC).getNy(); ++iY)
{
physCord[0] = x_phys[iX][iY][iC];
physCord[1] = y_phys[iX][iY][iC];
cuboidGeometry.getLatticeR(physCord, latticeR);
cout<<physCord[0]<<“,”<<physCord[1]<<“,”<<latticeR[0]<<“,”<<latticeR[1]<<endl;
}
cout<<endl;
}
cout<<endl;
}
cout<<“—————————————————————“<<endl;
//———————————————————————————–Thank you.
Yours sincerely,
Abhijeet
achodankarParticipantHello Adrian,
Thank you very much for your prompt reply and help. I got the physical coordinates and material no using the following code, and its working fine.for (int iC=0; iC < cuboidGeometry.getNc(); ++iC)
{
//cuboid = cuboidGeometry.get(iC);
for (int iX=0; iX < cuboidGeometry.get(iC).getNx(); ++iX)
{
for (int iY=0; iY < cuboidGeometry.get(iC).getNy(); ++iY)
{
latticeE[0] = iX;
latticeE[1] = iY;
physCord=cuboidGeometry.getPhysR(iC, iX, iY);
x_phys[iX][iY][iC] = physCord[0];
y_phys[iX][iY][iC] = physCord[1];
x_lattice[iX][iY][iC] = latticeE[0];
y_lattice[iX][iY][iC] = latticeE[1];
materialno = superGeometry.getBlockGeometry(iC).get(iX, iY);
material_no[iX][iY][iC] = superGeometry.getBlockGeometry(iC).get(iX, iY);
cout<<iC<<“,”<<latticeE[0]<<“,”<<latticeE[1]<<“,”<<materialno<<“,”<<physCord[0]<<“,”<<physCord[1]<<endl;
myfile9<<iC<<“,”<<latticeE[0]<<“,”<<latticeE[1]<<“,”<<materialno<<“,”<<physCord[0]<<“,”<<physCord[1]<<endl;
}
cout<<endl;
}
cout<<endl;
}I have saved the physical coordinates in an array and then trying to convert it to lattice coordinates using the following code, but it is not working correctly. The y lattice coordinate remains the same for the same x and updates for changing x. The x lattice coordinate doesn’t update.
For example:
———————————————–
physical coordinates lattice coordinates
———————————————–
(0,0) (0,0)
(0,0.1) (0,0)
(0,0.2) (0,0)
………………………….
………………………..
(0,1) (0,1)
———————————-
(0.1,0) (0,1)
(0.1,0.1) (0,1)
(0.1,0.2) (0,1)
………………………….
………………………..
(0.1,1) (0,1)
—————————————I would really appreciate your suggestion.
Thank you for your patience.
Yours sincerely,
Abhijeet
achodankarParticipantHello Adrian,
I would like to save the material no besides the corresponding lattice points. You mentioned earlier to pass the lattice locations to the superGeometry. I don’t understand on how to implement it. I found two code snippets related to this in the source code. I would really appreciate any suggestion on this matter.!!!—————————————————————————–
template<typename T>
461 std::unique_ptr<SuperIndicatorF2D<T>> SuperGeometry2D<T>::getMaterialIndicator(
462 std::vector<int>&& materials)
463 {
464 return this->getIndicator<SuperIndicatorMaterial2D>(
465 std::forward<std::vector<int>>(materials));
466 }
467
468 template<typename T>
469 std::unique_ptr<SuperIndicatorF2D<T>> SuperGeometry2D<T>::getMaterialIndicator(int material)
470 {
471 return this->getMaterialIndicator(std::vector<int> { material });
472 }
!!———————————————————————————————-Thank you.
Yours sincerely,
Abhijeet
achodankarParticipantHello Adrian,
I followed your procedure and was able to get the physical coordinates from lattice coordinates. However, I was unable to get obtain the lattice coordinates from given physical coordinates. I would appreciate your suggestions on this matter.The code snippet is as follows:
!!—————————————————————————————-
//——————Convert physical coordinates to lattice coordinates————–
std::vector<int> latticeR(2,T());cout<<“——-Convert Physical coordinates to Lattice coordinates———-“<<endl;
for (int iC=0; iC < cuboidGeometry.getNc(); ++iC)
{
for (int iX=0; iX < cuboidGeometry.get(iC).getNx(); ++iX)
{
for (int iY=0; iY < cuboidGeometry.get(iC).getNy(); ++iY)
{
physCord[0] = double(iX)*cuboidGeometry.getMinDeltaR();
physCord[1] = double(iY)*cuboidGeometry.getMinDeltaR();
cuboidGeometry.getLatticeR(physCord, latticeR);
cout<<physCord[0]<<“,”<<physCord[1]<<“,”<<latticeR[0]<<“,”<<latticeR[1]<<endl;
}
cout<<endl;
}
cout<<endl;
}
cout<<“—————————————————————“<<endl;
//———————————————————————————–
!!————————————————————————————————Thank you.
Yours sincerely,
Abhijeet
achodankarParticipantHello Adrian,
I am trying to store the physical coordinates using the following code, but it is not working. All values are zero in output. Also, is it correct to use the getMaxLatticeVolume() and getMinLatticeVolume() functions to obtain the no of points in x and y direction i.e nx and ny? I tried using the getNx and getNy functions, but it didn’t work. I would really appreciate your feedback.!!!———————————————————————————————-
int latticeE[3] { };
T output[2]{ };cuboidGeometry.getPhysR(output,latticeE);
//superGeometry.getPhysR(output,latticeE);for (latticeE[0]=0; latticeE[0] < cuboidGeometry.getMaxLatticeVolume(); ++latticeE[0])
{
for (latticeE[1]=0; latticeE[1] < cuboidGeometry.getMinLatticeVolume(); ++latticeE[1])
{
cout << latticeE[0] << “,” << latticeE[1] << “,”<< output[0] << “,”<< output[1] << std::endl;
}
cout<<std::endl;
}!!!———————————————————————————————-
Thank you.
Yours sincerely,
Abhijeet
July 19, 2021 at 10:55 pm in reply to: Storing data in a csv file error (running code in parallel) #5824achodankarParticipantHello Adrian,
Thank you for your feedback. I will try to work it out and meanwhile use the default VTK results temporarily.Thank you.
Yours sincerely,
Abhijeet
July 19, 2021 at 10:04 pm in reply to: Storing data in a csv file error (running code in parallel) #5822achodankarParticipantHello Adrian,
What do you mean by “IO only happens in the main process”? The code snippet is included in the getResults function and called in the main program. I would really appreciate help in this matter.Thank you.
Yours sincerely,
Abhijeet
achodankarParticipantHello Mathias,
Thank you for the prompt response. I understand it now.Thank you.
Yours sincerely,
Abhijeet
achodankarParticipantHello Mathias,
How should I get the numerical solution equal to the analytical solution for this case?Thank you.
Yours sincerely,
Abhijeet
achodankarParticipantHello Adrian,
The problem is resolved. I am getting the correct velocity values stored in it. While trying to fix the earlier problem, I put these code lines (T vel[2] { };velocityPlane(vel, latticeR);”) before the for loop. After placing it back in the for loop, it’s working fine. Everything is working now. Thank you very much for your prompt response.Yours sincerely,
Abhijeet
-
AuthorPosts