## Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
• Author
Posts
• #7110
navidkyo
Participant

it is relatively small. in order of 1e-7

it is zero at h=ly/2, and goes -1e-7 at h=0, and +1e-7 at h=y(top).

Unfortunately, I cannot attach the preview screenshot but I attached the y-dir velocity distribution along a line in the y direction. The X-direction velocity is zero.

0
-6.17E-07
-6.16E-07
-6.15E-07
-6.13E-07
-6.12E-07
-6.11E-07
-6.10E-07
-6.08E-07
-6.07E-07
-6.06E-07
-6.05E-07
-6.03E-07
-6.02E-07
-6.01E-07
-6.00E-07
-5.98E-07
-5.97E-07
-5.96E-07
-5.95E-07
-5.94E-07
-5.92E-07
-5.91E-07
-5.90E-07
-5.89E-07
-5.87E-07
-5.86E-07
-5.85E-07
-5.84E-07
-5.82E-07
-5.81E-07
-5.80E-07
-5.79E-07
-5.77E-07
-5.76E-07
-5.75E-07
-5.74E-07
-5.72E-07
-5.71E-07
-5.70E-07
-5.69E-07
-5.68E-07
-5.66E-07
-5.65E-07
-5.64E-07
-5.63E-07
-5.61E-07
-5.60E-07
-5.59E-07
-5.58E-07
-5.56E-07
-5.55E-07
-5.54E-07
-5.53E-07
-5.51E-07
-5.50E-07
-5.49E-07
-5.48E-07
-5.47E-07
-5.45E-07
-5.44E-07
-5.43E-07
-5.42E-07
-5.40E-07
-5.39E-07
-5.38E-07
-5.37E-07
-5.35E-07
-5.34E-07
-5.33E-07
-5.32E-07
-5.30E-07
-5.29E-07
-5.28E-07
-5.27E-07
-5.25E-07
-5.24E-07
-5.23E-07
-5.22E-07
-5.21E-07
-5.19E-07
-5.18E-07
-5.17E-07
-5.16E-07
-5.14E-07
-5.13E-07
-5.12E-07
-5.11E-07
-5.09E-07
-5.08E-07
-5.07E-07
-5.06E-07
-5.04E-07
-5.03E-07
-5.02E-07
-5.01E-07
-5.00E-07
-4.98E-07
-4.97E-07
-4.96E-07
-4.95E-07
-4.93E-07
-4.92E-07
-4.91E-07
-4.90E-07
-4.88E-07
-4.87E-07
-4.86E-07
-4.85E-07
-4.83E-07
-4.82E-07
-4.81E-07
-4.80E-07
-4.78E-07
-4.77E-07
-4.76E-07
-4.75E-07
-4.74E-07
-4.72E-07
-4.71E-07
-4.70E-07
-4.69E-07
-4.67E-07
-4.66E-07
-4.65E-07
-4.64E-07
-4.62E-07
-4.61E-07
-4.60E-07
-4.59E-07
-4.57E-07
-4.56E-07
-4.55E-07
-4.54E-07
-4.52E-07
-4.51E-07
-4.50E-07
-4.49E-07
-4.48E-07
-4.46E-07
-4.45E-07
-4.44E-07
-4.43E-07
-4.41E-07
-4.40E-07
-4.39E-07
-4.38E-07
-4.36E-07
-4.35E-07
-4.34E-07
-4.33E-07
-4.31E-07
-4.30E-07
-4.29E-07
-4.28E-07
-4.27E-07
-4.25E-07
-4.24E-07
-4.23E-07
-4.22E-07
-4.20E-07
-4.19E-07
-4.18E-07
-4.17E-07
-4.15E-07
-4.14E-07
-4.13E-07
-4.12E-07
-4.10E-07
-4.09E-07
-4.08E-07
-4.07E-07
-4.05E-07
-4.04E-07
-4.03E-07
-4.02E-07
-4.01E-07
-3.99E-07
-3.98E-07
-3.97E-07
-3.96E-07
-3.94E-07
-3.93E-07
-3.92E-07
-3.91E-07
-3.89E-07
-3.88E-07
-3.87E-07
-3.86E-07
-3.84E-07
-3.83E-07
-3.82E-07
-3.81E-07
-3.80E-07
-3.78E-07
-3.77E-07
-3.76E-07
-3.75E-07
-3.73E-07
-3.72E-07
-3.71E-07
-3.70E-07
-3.68E-07
-3.67E-07
-3.66E-07
-3.65E-07
-3.63E-07
-3.62E-07
-3.61E-07
-3.60E-07
-3.58E-07
-3.57E-07
-3.56E-07
-3.55E-07
-3.54E-07
-3.52E-07
-3.51E-07
-3.50E-07
-3.49E-07
-3.47E-07
-3.46E-07
-3.45E-07
-3.44E-07
-3.42E-07
-3.41E-07
-3.40E-07
-3.39E-07
-3.37E-07
-3.36E-07
-3.35E-07
-3.34E-07
-3.33E-07
-3.31E-07
-3.30E-07
-3.29E-07
-3.28E-07
-3.26E-07
-3.25E-07
-3.24E-07
-3.23E-07
-3.21E-07
-3.20E-07
-3.19E-07
-3.18E-07
-3.16E-07
-3.15E-07
-3.14E-07
-3.13E-07
-3.11E-07
-3.10E-07
-3.09E-07
-3.08E-07
-3.07E-07
-3.05E-07
-3.04E-07
-3.03E-07
-3.02E-07
-3.00E-07
-2.99E-07
-2.98E-07
-2.97E-07
-2.95E-07
-2.94E-07
-2.93E-07
-2.92E-07
-2.90E-07
-2.89E-07
-2.88E-07
-2.87E-07
-2.85E-07
-2.84E-07
-2.83E-07
-2.82E-07
-2.81E-07
-2.79E-07
-2.78E-07
-2.77E-07
-2.76E-07
-2.74E-07
-2.73E-07
-2.72E-07
-2.71E-07
-2.69E-07
-2.68E-07
-2.67E-07
-2.66E-07
-2.64E-07
-2.63E-07
-2.62E-07
-2.61E-07
-2.60E-07
-2.58E-07
-2.57E-07
-2.56E-07
-2.55E-07
-2.53E-07
-2.52E-07
-2.51E-07
-2.50E-07
-2.48E-07
-2.47E-07
-2.46E-07
-2.45E-07
-2.43E-07
-2.42E-07
-2.41E-07
-2.40E-07
-2.38E-07
-2.37E-07
-2.36E-07
-2.35E-07
-2.34E-07
-2.32E-07
-2.31E-07
-2.30E-07
-2.29E-07
-2.27E-07
-2.26E-07
-2.25E-07
-2.24E-07
-2.22E-07
-2.21E-07
-2.20E-07
-2.19E-07
-2.17E-07
-2.16E-07
-2.15E-07
-2.14E-07
-2.13E-07
-2.11E-07
-2.10E-07
-2.09E-07
-2.08E-07
-2.06E-07
-2.05E-07
-2.04E-07
-2.03E-07
-2.01E-07
-2.00E-07
-1.99E-07
-1.98E-07
-1.96E-07
-1.95E-07
-1.94E-07
-1.93E-07
-1.91E-07
-1.90E-07
-1.89E-07
-1.88E-07
-1.87E-07
-1.85E-07
-1.84E-07
-1.83E-07
-1.82E-07
-1.80E-07
-1.79E-07
-1.78E-07
-1.77E-07
-1.75E-07
-1.74E-07
-1.73E-07
-1.72E-07
-1.70E-07
-1.69E-07
-1.68E-07
-1.67E-07
-1.66E-07
-1.64E-07
-1.63E-07
-1.62E-07
-1.61E-07
-1.59E-07
-1.58E-07
-1.57E-07
-1.56E-07
-1.54E-07
-1.53E-07
-1.52E-07
-1.51E-07
-1.49E-07
-1.48E-07
-1.47E-07
-1.46E-07
-1.44E-07
-1.43E-07
-1.42E-07
-1.41E-07
-1.40E-07
-1.38E-07
-1.37E-07
-1.36E-07
-1.35E-07
-1.33E-07
-1.32E-07
-1.31E-07
-1.30E-07
-1.28E-07
-1.27E-07
-1.26E-07
-1.25E-07
-1.23E-07
-1.22E-07
-1.21E-07
-1.20E-07
-1.18E-07
-1.17E-07
-1.16E-07
-1.15E-07
-1.14E-07
-1.12E-07
-1.11E-07
-1.10E-07
-1.09E-07
-1.07E-07
-1.06E-07
-1.05E-07
-1.04E-07
-1.02E-07
-1.01E-07
-9.99E-08
-9.87E-08
-9.75E-08
-9.62E-08
-9.50E-08
-9.38E-08
-9.25E-08
-9.13E-08
-9.00E-08
-8.88E-08
-8.76E-08
-8.63E-08
-8.51E-08
-8.39E-08
-8.26E-08
-8.14E-08
-8.02E-08
-7.89E-08
-7.77E-08
-7.64E-08
-7.52E-08
-7.40E-08
-7.27E-08
-7.15E-08
-7.03E-08
-6.90E-08
-6.78E-08
-6.65E-08
-6.53E-08
-6.41E-08
-6.28E-08
-6.16E-08
-6.04E-08
-5.91E-08
-5.79E-08
-5.66E-08
-5.54E-08
-5.42E-08
-5.29E-08
-5.17E-08
-5.05E-08
-4.92E-08
-4.80E-08
-4.68E-08
-4.55E-08
-4.43E-08
-4.30E-08
-4.18E-08
-4.06E-08
-3.93E-08
-3.81E-08
-3.69E-08
-3.56E-08
-3.44E-08
-3.31E-08
-3.19E-08
-3.07E-08
-2.94E-08
-2.82E-08
-2.70E-08
-2.57E-08
-2.45E-08
-2.32E-08
-2.20E-08
-2.08E-08
-1.95E-08
-1.83E-08
-1.71E-08
-1.58E-08
-1.46E-08
-1.34E-08
-1.21E-08
-1.09E-08
-9.64E-09
-8.40E-09
-7.17E-09
-5.93E-09
-4.69E-09
-3.45E-09
-2.22E-09
-9.80E-10
2.57E-10
1.49E-09
2.73E-09
3.97E-09
5.21E-09
6.44E-09
7.68E-09
8.92E-09
1.02E-08
1.14E-08
1.26E-08
1.39E-08
1.51E-08
1.63E-08
1.76E-08
1.88E-08
2.00E-08
2.13E-08
2.25E-08
2.38E-08
2.50E-08
2.62E-08
2.75E-08
2.87E-08
2.99E-08
3.12E-08
3.24E-08
3.37E-08
3.49E-08
3.61E-08
3.74E-08
3.86E-08
3.98E-08
4.11E-08
4.23E-08
4.36E-08
4.48E-08
4.60E-08
4.73E-08
4.85E-08
4.97E-08
5.10E-08
5.22E-08
5.34E-08
5.47E-08
5.59E-08
5.72E-08
5.84E-08
5.96E-08
6.09E-08
6.21E-08
6.33E-08
6.46E-08
6.58E-08
6.71E-08
6.83E-08
6.95E-08
7.08E-08
7.20E-08
7.32E-08
7.45E-08
7.57E-08
7.70E-08
7.82E-08
7.94E-08
8.07E-08
8.19E-08
8.31E-08
8.44E-08
8.56E-08
8.68E-08
8.81E-08
8.93E-08
9.06E-08
9.18E-08
9.30E-08
9.43E-08
9.55E-08
9.67E-08
9.80E-08
9.92E-08
1.00E-07
1.02E-07
1.03E-07
1.04E-07
1.05E-07
1.07E-07
1.08E-07
1.09E-07
1.10E-07
1.12E-07
1.13E-07
1.14E-07
1.15E-07
1.17E-07
1.18E-07
1.19E-07
1.20E-07
1.21E-07
1.23E-07
1.24E-07
1.25E-07
1.26E-07
1.28E-07
1.29E-07
1.30E-07
1.31E-07
1.33E-07
1.34E-07
1.35E-07
1.36E-07
1.38E-07
1.39E-07
1.40E-07
1.41E-07
1.43E-07
1.44E-07
1.45E-07
1.46E-07
1.47E-07
1.49E-07
1.50E-07
1.51E-07
1.52E-07
1.54E-07
1.55E-07
1.56E-07
1.57E-07
1.59E-07
1.60E-07
1.61E-07
1.62E-07
1.64E-07
1.65E-07
1.66E-07
1.67E-07
1.68E-07
1.70E-07
1.71E-07
1.72E-07
1.73E-07
1.75E-07
1.76E-07
1.77E-07
1.78E-07
1.80E-07
1.81E-07
1.82E-07
1.83E-07
1.85E-07
1.86E-07
1.87E-07
1.88E-07
1.90E-07
1.91E-07
1.92E-07
1.93E-07
1.94E-07
1.96E-07
1.97E-07
1.98E-07
1.99E-07
2.01E-07
2.02E-07
2.03E-07
2.04E-07
2.06E-07
2.07E-07
2.08E-07
2.09E-07
2.11E-07
2.12E-07
2.13E-07
2.14E-07
2.16E-07
2.17E-07
2.18E-07
2.19E-07
2.20E-07
2.22E-07
2.23E-07
2.24E-07
2.25E-07
2.27E-07
2.28E-07
2.29E-07
2.30E-07
2.32E-07
2.33E-07
2.34E-07
2.35E-07
2.37E-07
2.38E-07
2.39E-07
2.40E-07
2.41E-07
2.43E-07
2.44E-07
2.45E-07
2.46E-07
2.48E-07
2.49E-07
2.50E-07
2.51E-07
2.53E-07
2.54E-07
2.55E-07
2.56E-07
2.58E-07
2.59E-07
2.60E-07
2.61E-07
2.63E-07
2.64E-07
2.65E-07
2.66E-07
2.67E-07
2.69E-07
2.70E-07
2.71E-07
2.72E-07
2.74E-07
2.75E-07
2.76E-07
2.77E-07
2.79E-07
2.80E-07
2.81E-07
2.82E-07
2.84E-07
2.85E-07
2.86E-07
2.87E-07
2.88E-07
2.90E-07
2.91E-07
2.92E-07
2.93E-07
2.95E-07
2.96E-07
2.97E-07
2.98E-07
3.00E-07
3.01E-07
3.02E-07
3.03E-07
3.05E-07
3.06E-07
3.07E-07
3.08E-07
3.10E-07
3.11E-07
3.12E-07
3.13E-07
3.14E-07
3.16E-07
3.17E-07
3.18E-07
3.19E-07
3.21E-07
3.22E-07
3.23E-07
3.24E-07
3.26E-07
3.27E-07
3.28E-07
3.29E-07
3.31E-07
3.32E-07
3.33E-07
3.34E-07
3.35E-07
3.37E-07
3.38E-07
3.39E-07
3.40E-07
3.42E-07
3.43E-07
3.44E-07
3.45E-07
3.47E-07
3.48E-07
3.49E-07
3.50E-07
3.52E-07
3.53E-07
3.54E-07
3.55E-07
3.57E-07
3.58E-07
3.59E-07
3.60E-07
3.61E-07
3.63E-07
3.64E-07
3.65E-07
3.66E-07
3.68E-07
3.69E-07
3.70E-07
3.71E-07
3.73E-07
3.74E-07
3.75E-07
3.76E-07
3.78E-07
3.79E-07
3.80E-07
3.81E-07
3.83E-07
3.84E-07
3.85E-07
3.86E-07
3.87E-07
3.89E-07
3.90E-07
3.91E-07
3.92E-07
3.94E-07
3.95E-07
3.96E-07
3.97E-07
3.99E-07
4.00E-07
4.01E-07
4.02E-07
4.04E-07
4.05E-07
4.06E-07
4.07E-07
4.08E-07
4.10E-07
4.11E-07
4.12E-07
4.13E-07
4.15E-07
4.16E-07
4.17E-07
4.18E-07
4.20E-07
4.21E-07
4.22E-07
4.23E-07
4.25E-07
4.26E-07
4.27E-07
4.28E-07
4.30E-07
4.31E-07
4.32E-07
4.33E-07
4.34E-07
4.36E-07
4.37E-07
4.38E-07
4.39E-07
4.41E-07
4.42E-07
4.43E-07
4.44E-07
4.46E-07
4.47E-07
4.48E-07
4.49E-07
4.51E-07
4.52E-07
4.53E-07
4.54E-07
4.55E-07
4.57E-07
4.58E-07
4.59E-07
4.60E-07
4.62E-07
4.63E-07
4.64E-07
4.65E-07
4.67E-07
4.68E-07
4.69E-07
4.70E-07
4.72E-07
4.73E-07
4.74E-07
4.75E-07
4.77E-07
4.78E-07
4.79E-07
4.80E-07
4.81E-07
4.83E-07
4.84E-07
4.85E-07
4.86E-07
4.88E-07
4.89E-07
4.90E-07
4.91E-07
4.93E-07
4.94E-07
4.95E-07
4.96E-07
4.98E-07
4.99E-07
5.00E-07
5.01E-07
5.02E-07
5.04E-07
5.05E-07
5.06E-07
5.07E-07
5.09E-07
5.10E-07
5.11E-07
5.12E-07
5.14E-07
5.15E-07
5.16E-07
5.17E-07
5.19E-07
5.20E-07
5.21E-07
5.22E-07
5.24E-07
5.25E-07
5.26E-07
5.27E-07
5.28E-07
5.30E-07
5.31E-07
5.32E-07
5.33E-07
5.35E-07
5.36E-07
5.37E-07
5.38E-07
5.40E-07
5.41E-07
5.42E-07
5.43E-07
5.45E-07
5.46E-07
5.47E-07
5.48E-07
5.50E-07
5.51E-07
5.52E-07
5.53E-07
5.54E-07
5.56E-07
5.57E-07
5.58E-07
5.59E-07
5.61E-07
5.62E-07
5.63E-07
5.64E-07
5.66E-07
5.67E-07
5.68E-07
5.69E-07
5.71E-07
5.72E-07
5.73E-07
5.74E-07
5.75E-07
5.77E-07
5.78E-07
5.79E-07
5.80E-07
5.82E-07
5.83E-07
5.84E-07
5.85E-07
5.87E-07
5.88E-07
5.89E-07
5.90E-07
5.92E-07
5.93E-07
5.94E-07
5.95E-07
5.97E-07
5.98E-07
5.99E-07
6.00E-07
6.01E-07
6.03E-07
6.04E-07
6.05E-07
6.06E-07
6.08E-07
6.09E-07
6.10E-07
6.11E-07
6.13E-07
6.14E-07
6.15E-07
6.16E-07
6.17E-07
0

#7103
navidkyo
Participant

Thank you Mathias for your help. I used the following code for defining the linear function and it seems the problem is solved: (The rest f the code is the same as above)

//*****************************************************************************************
AnalyticalLinear2D<T,T> T_ini((T)0, (converter.getLatticeTemperature(Tcold), converter.getLatticeTemperature(Thot))/ly,converter.getLatticeTemperature(Thot) );
//*****************************************************************************************

However, as I checked the initial velocity at t=0, I got a linear symmetrical distribution for the initial velocity as well, and I wondered why this happened. Is it due to velocity shift by forcing term? or I did I miss a point here?

I attached my code:

//*****************************************************************************************

#include “olb2D.h” //OK
#include “olb2D.hh” //OK

using namespace olb; //OK
using namespace olb::descriptors; //OK
using namespace olb::graphics; //OK

typedef double T; //OK

typedef D2Q9<FORCE> NSDESCRIPTOR; //OK
typedef D2Q5<VELOCITY> TDESCRIPTOR; //OK

// Parameters for the simulation setup

// const int SavingIter = 10.; ///use din line 316
const int N = 60; // resolution of the model //OK
const T L = 0.1/N; // latticeL //OK
const T lx = 6. ; // length of the channel //OK
const T ly = 4.+L; // height of the channel //OK
// const T Ra = 1e4; // Rayleigh number2000
// const T Pr = 0.71; // Prandtl number
const T Re = 76; //OK
const T maxPhysT = 500; // max. simulation time in s, SI unit //OK
const T epsilon = 1.e-5; // precision of the convergence (residuum) //NOT IN JUNWEI’S CODE*******************************

const T Thot = 5.; // temperature of the lower wall in Kelvin //OK
const T Tcold = 1.; // temperature of the fluid in Kelvin //OK
const T Tave = (Thot+Tcold)/2.0; // temperature of the fluid in Kelvin //OK
const T Tperturb = 1./5. * Tcold + 4./5. * Thot; // temperature of the perturbation //OK

const T centerCylinderX = 2.5; //OK
const T centerCylinderY = ly/2.0 +L/2.; //OK
const T radiusCylinder = 0.05; //OK

/// Stores geometry information in form of material numbers
void prepareGeometry(SuperGeometry<T,2>& superGeometry,
ThermalUnitConverter<T, NSDESCRIPTOR, TDESCRIPTOR> &converter)
{

OstreamManager clout(std::cout,”prepareGeometry”);
clout << “Prepare Geometry …” << std::endl;

superGeometry.rename(0,2); //OK
superGeometry.rename(2,1,{0,1}); //original: superGeometry.rename(2,1,0,1); //OK

std::vector<T> extend( 2, T(0) ); //OK
std::vector<T> origin( 2, T(0) ); //OK

origin[1] = -converter.getPhysLength(1); //OK
extend[0] = lx ; //OK
extend[1] = 2.*converter.getPhysLength(1); //OK
IndicatorCuboid2D<T> bottom(extend, origin); //OK

origin[1] = ly-converter.getPhysLength(1); //OK
IndicatorCuboid2D<T> top(extend, origin); //OK

superGeometry.rename(2,2,1,bottom);
superGeometry.rename(2,3,1,top);

// origin[0] = lx/2.;
// origin[1] = converter.getPhysLength(1);
// extend[0] = converter.getPhysLength(1);
// extend[1] = converter.getPhysLength(1);
// IndicatorCuboid2D<T> perturbation(extend, origin);

//************************ Inflow ******************** added by me
origin[0] = 0.0; //OK
origin[1] = 0.0; //OK
extend[0] = converter.getPhysLength(1.); //OK
extend[1] = ly; //OK
IndicatorCuboid2D<T> inflow(extend, origin); //OK
superGeometry.rename( 1,5,inflow ); //OK

//************************ outflow ******************** added by me
origin[0] = lx-converter.getPhysLength(1); //OK
extend[0] = 2.*converter.getPhysLength(1); //OK
IndicatorCuboid2D<T> outflow(extend, origin); //OK
superGeometry.rename( 1,6,1,outflow ); //????????????????

//************************ Cylinder ******************** added by me

Vector<T,2> center( centerCylinderX,centerCylinderY ); //OK
IndicatorCircle2D<T> circle( center, radiusCylinder ); //OK
superGeometry.rename( 1,4,circle ); //OK

/// Removes all not needed boundary voxels outside the surface
superGeometry.clean(); //OK
/// Removes all not needed boundary voxels inside the surface
superGeometry.innerClean(); //OK
superGeometry.checkForErrors(); //OK

superGeometry.print(); //OK

clout << “Prepare Geometry … OK” << std::endl;
}

void prepareLattice( ThermalUnitConverter<T, NSDESCRIPTOR, TDESCRIPTOR> &converter,
SuperLattice<T, NSDESCRIPTOR>& NSlattice,
SuperGeometry<T,2>& superGeometry )
{

OstreamManager clout(std::cout,”prepareLattice”); //OK

T Tomega = converter.getLatticeThermalRelaxationFrequency(); //OK
T NSomega = converter.getLatticeRelaxationFrequency(); //ADDED BY ME //OK

/// define lattice Dynamics
clout << “defining dynamics” << std::endl; //OK

NSlattice.defineDynamics<NoDynamics>(superGeometry, 0); //OK
NSlattice.defineDynamics<ForcedBGKdynamics>(superGeometry, 1); //OK
// NSlattice.defineDynamics<NoDynamics>(superGeometry, 2); //OK
// setSlipBoundary(NSlattice, superGeometry, 2); //OK
// NSlattice.defineDynamics<NoDynamics>(superGeometry, 3); //OK
// setSlipBoundary(NSlattice, superGeometry, 3); //OK
// NSlattice.defineDynamics<BounceBack>(superGeometry, 4); //OK

NSlattice.defineDynamics<BounceBack>(superGeometry, 2); //OK
NSlattice.defineDynamics<BounceBack>(superGeometry, 3); //OK

// Define Boundaries
setInterpolatedVelocityBoundary(NSlattice, NSomega, superGeometry, 5); //OK
setInterpolatedVelocityBoundary(NSlattice, NSomega, superGeometry, 6); //OK
// setLocalPressureBoundary<T,NSDESCRIPTOR>(NSlattice, NSomega, superGeometry, 6);

Vector<T,2> center(centerCylinderX,centerCylinderY );
IndicatorCircle2D<T> circle ( center, radiusCylinder );
setBouzidiZeroVelocityBoundary<T,NSDESCRIPTOR>(NSlattice, superGeometry, 4, circle);

// Vector<T,2> center( centerCylinderX,centerCylinderY );
// IndicatorCircle2D<T> circle ( center, radiusCylinder );
// NSlattice.defineDynamics<NoDynamics<T,NSDESCRIPTOR>>(superGeometry, 7);
// setBouzidiZeroVelocityBoundary<T,NSDESCRIPTOR>(NSlattice, superGeometry, 7, circle);

// /// Removes all not needed boundary voxels outside the surface
// superGeometry.clean();
// /// Removes all not needed boundary voxels inside the surface
// superGeometry.innerClean();
// superGeometry.checkForErrors();

/// define initial conditions
AnalyticalConst2D<T,T> rho(1.); //OK
AnalyticalConst2D<T,T> u0(0.0, 0.0); //OK
AnalyticalConst2D<T,T> T_cold(converter.getLatticeTemperature(Tcold)); //OK
AnalyticalConst2D<T,T> T_hot(converter.getLatticeTemperature(Thot)); //OK
AnalyticalConst2D<T,T> T_perturb(converter.getLatticeTemperature(Tperturb)); //OK
// AnalyticalLinear2D<T,T> T_ini( 0, -0.25, 0.25); //OK&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

AnalyticalLinear2D<T,T> T_ini((T)0, (converter.getLatticeTemperature(Tcold)-converter.getLatticeTemperature(Thot))/4.,converter.getLatticeTemperature(Thot) );

AnalyticalConst2D<T,T> T_ave((converter.getLatticeTemperature(Thot)+converter.getLatticeTemperature(Tcold))/2); //OK

/// for each material set Rho, U and the Equilibrium

// NSlattice.defineU(superGeometry,5,u0); //OK
// NSlattice.defineU(superGeometry,6,u0); //OK

NSlattice.defineRhoU(superGeometry, 1, rho, u0); //OK
NSlattice.iniEquilibrium(superGeometry, 1, rho, u0); //OK
NSlattice.defineRhoU(superGeometry, 2, rho, u0); //OK
NSlattice.iniEquilibrium(superGeometry, 2, rho, u0); //OK
NSlattice.defineRhoU(superGeometry, 3, rho,u0); //OK
NSlattice.iniEquilibrium(superGeometry, 3, rho, u0); //OK
NSlattice.defineRhoU(superGeometry, 5, rho,u0); //OK
NSlattice.iniEquilibrium(superGeometry, 5, rho, u0); //OK
NSlattice.defineRhoU(superGeometry, 6, rho,u0); //OK
NSlattice.iniEquilibrium(superGeometry, 6, rho, u0); //OK

NSlattice.setParameter<descriptors::OMEGA>(NSomega);

/// Make the lattice ready for simulation
NSlattice.initialize();

clout << “Prepare Lattice … OK” << std::endl;
}

void setBoundaryValues(ThermalUnitConverter<T, NSDESCRIPTOR, TDESCRIPTOR> &converter,
SuperLattice<T, NSDESCRIPTOR>& NSlattice,
int iT, SuperGeometry<T,2>& superGeometry)
{
{

OstreamManager clout( std::cout,”setBoundaryValues” );

// No of time steps for smooth start-up
int iTmaxStart = converter.getLatticeTime( maxPhysT*0.4 ); //original: int iTmaxStart = converter.getLatticeTime( maxPhysT*0.4 );
int iTupdate = 20; ///frequency of printing max vel on the console

if ( iT%iTupdate==0 && iT<= iTmaxStart ) {
// Smooth start curve, sinus
// SinusStartScale<T,int> StartScale(iTmaxStart, T(1));

// Smooth start curve, polynomial
PolynomialStartScale<T,T> StartScale( iTmaxStart, T( 1 ) );

// Creates and sets the Poiseuille inflow profile using functors
T iTvec[1] = {T( iT )};
T frac[1] = {};
StartScale( frac,iTvec );
// std::vector<T> maxVelocity( 2,0 );
T maxVelocity = converter.getCharLatticeVelocity()*frac[0];
// T maxVelocity2 = 0.0*frac[0];
T distance2Wall = converter.getPhysLength(1)/2.;
Poiseuille2D<T> poiseuilleU( superGeometry, 5, maxVelocity, distance2Wall );
// AnalyticalConst2D<T,T> poiseuilleU(maxVelocity, 0.0);

NSlattice.defineU( superGeometry, 5, poiseuilleU );
NSlattice.defineU( superGeometry, 6, poiseuilleU );

NSlattice.setProcessingContext<Array<momenta::FixedVelocityMomentumGeneric::VELOCITY>>(
ProcessingContext::Simulation);
clout << “step=” << iT << “; maxVel=” << maxVelocity << “; (%)maxVel=” << maxVelocity/converter.getCharLatticeVelocity() << std::endl;

}
}

// OstreamManager clout( std::cout,”setBoundaryValues” );

// // No of time steps for smooth start-up
// int iTmaxStart = converter.getLatticeTime( maxPhysT*0.4 );
// int iTupdate = 5;

// if ( iT%iTupdate==0 && iT<= iTmaxStart ) {
// // Smooth start curve, sinus
// // SinusStartScale<T,int> StartScale(iTmaxStart, T(1));

// // Smooth start curve, polynomial
// PolynomialStartScale<T,T> StartScale( iTmaxStart, T( 1 ) );

// // Creates and sets the Poiseuille inflow profile using functors
// T iTvec[1] = {T( iT )};
// T frac[1] = {};
// StartScale( frac,iTvec );
// T maxVelocity = converter.getCharLatticeVelocity()/200.*frac[0]; //*************CHECK: SETS MAX INLET VELOCITY ORIGINAL: 3./20.
// //T maxVelocity = 0.005 ; IT DOES NOT WORK LIKE THIS!!!!! maxVelocity is an ARRAY
// T distance2Wall = converter.getPhysLength(1)/2.;
// //Poiseuille2D<T> poiseuilleU( superGeometry, 5, maxVelocity, distance2Wall );
// AnalyticalConst2D<T,T> poiseuilleU( maxVelocity );
// //AnalyticalConst2D<T,T> constantU(maxVelocity, 0.0);
// NSlattice.defineU( superGeometry, 5, poiseuilleU );
// clout << “step=” << iT << “; maxVel=” << maxVelocity << std::endl;

// }
}

void getResults(ThermalUnitConverter<T, NSDESCRIPTOR, TDESCRIPTOR> &converter,
SuperLattice<T, NSDESCRIPTOR>& NSlattice,
SuperGeometry<T,2>& superGeometry,
util::Timer<T>& timer,
bool converged)
{

OstreamManager clout(std::cout,”getResults”);

SuperVTMwriter2D<T> vtkWriter(“rayleighBenard2d”);
SuperLatticePhysVelocity2D<T, NSDESCRIPTOR> velocity(NSlattice, converter);
SuperLatticePhysPressure2D<T, NSDESCRIPTOR> presure(NSlattice, converter);

SuperLatticeVelocity2D<T, NSDESCRIPTOR> velocityLatticeUnit(NSlattice);

const int saveIter = converter.getLatticeTime(1.); //fffffffffffffffffffffffffffffff

SuperLatticeField2D<T,NSDESCRIPTOR,olb::descriptors::FORCE> bodyForce (NSlattice); //ADDED BY ME

if (iT == 0) {
/// Writes the converter log file
// writeLogFile(converter,”rayleighBenard2d”);

/// Writes the geometry, cuboid no. and rank no. as vti file for visualization
SuperLatticeGeometry2D<T, NSDESCRIPTOR> geometry(NSlattice, superGeometry);
SuperLatticeCuboid2D<T, NSDESCRIPTOR> cuboid(NSlattice);
SuperLatticeRank2D<T, NSDESCRIPTOR> rank(NSlattice);
vtkWriter.write(geometry);
vtkWriter.write(cuboid);
vtkWriter.write(rank);

vtkWriter.createMasterFile();
}

/// Writes the VTK files and prints statistics
if (iT%saveIter == 0 || converged) {
/// Timer console output
timer.update(iT);
timer.printStep();

/// Lattice statistics console output
NSlattice.getStatistics().print(iT,converter.getPhysTime(iT));

vtkWriter.write(iT);

BlockReduction2D2D<T> planeReduction(temperature, 600, BlockDataSyncMode::ReduceOnly);
BlockGifWriter<T> gifWriter;
gifWriter.write(planeReduction, Tcold-0.1, Thot+0.1, iT, “temperature”);

// &***************************** Drag, lift, pressure drop &**********************************************
static Gnuplot<T> gplot( “drag” );
const int vtkIter = converter.getLatticeTime( .3 );

// Writes the vtk files
if ( iT%vtkIter == 0 && iT > 0 ) {
vtkWriter.write( iT );
}

// write pdf at last time step
if ( iT == converter.getLatticeTime( maxPhysT )-1 ) {
// writes pdf
gplot.writePDF();
}

//******************************
AnalyticalFfromSuperF2D<T> intpolatePressure( presure, true );
SuperLatticePhysDrag2D<T,NSDESCRIPTOR> drag( NSlattice, superGeometry, 4, converter );

T point1[2] = {};
T point2[2] = {};

point1[1] = centerCylinderY;

point2[1] = centerCylinderY;

T p1, p2;
intpolatePressure( &p1,point1 );
intpolatePressure( &p2,point2 );

clout << “pressure1=” << p1;
clout << “; pressure2=” << p2;

T pressureDrop = p1-p2;
clout << “; pressureDrop=” << pressureDrop;

int input[3] = {};
T _drag[drag.getTargetDim()];
drag( _drag,input );
clout << “; drag=” << _drag[0] << “; lift=” << _drag[1] << std::endl;

// set data for gnuplot: input={xValue, yValue(s), names (optional), position of key (optional)}
gplot.setData( converter.getPhysTime( iT ), {_drag[0], _drag[1]}, {“drag(openLB)”, “lift(OpenLB)”}, “bottom right”, {‘l’,’l’} );
// writes a png in one file for every timestep, if the file is open it can be used as a “liveplot”
gplot.writePNG();

// every (iT%vtkIter) write an png of the plot
if ( iT%( vtkIter ) == 0 ) {
// writes pngs: input={name of the files (optional), x range for the plot (optional)}
gplot.writePNG( iT, maxPhysT );
}

}
}

int main(int argc, char *argv[])
{

/// === 1st Step: Initialization ===
OstreamManager clout(std::cout,”main”);
olbInit(&argc, &argv);
singleton::directories().setOutputDir(“./tmp/”);

ThermalUnitConverter<T, NSDESCRIPTOR, TDESCRIPTOR> converter(
(T) 0.1/N, // physDeltaX
(T) 0.00043860, // physDeltaT = charLatticeVelocity / charPhysVelocity * physDeltaX
(T) 0.1, // charPhysLength
(T) Re*1.e-4/0.1, // charPhysVelocity
(T) 1.e-4, // physViscosity
(T) 1., // physDensity
(T) 0.03, // physThermalConductivity
(T) 210000, // physSpecificHeatCapacity
(T) 0.000143573, // physThermalExpansionCoefficient
(T) Tcold, // charPhysLowTemperature
(T) Thot // charPhysHighTemperature
);
converter.print();
converter.write(“olbUnitConverter”);

/// === 2nd Step: Prepare Geometry ===
std::vector<T> extend(2,T());
extend[0] = lx;
extend[1] = ly;
std::vector<T> origin(2,T());
IndicatorCuboid2D<T> cuboid(extend, origin);

/// Instantiation of a cuboidGeometry with weights
#ifdef PARALLEL_MODE_MPI
const int noOfCuboids = singleton::mpi().getSize();
#else
const int noOfCuboids = 7;
#endif
CuboidGeometry2D<T> cuboidGeometry(cuboid, converter.getPhysDeltaX(), noOfCuboids);

cuboidGeometry.setPeriodicity(false, false);

prepareGeometry(superGeometry, converter);

/// === 3rd Step: Prepare Lattice ===

SuperLattice<T, NSDESCRIPTOR> NSlattice(superGeometry);

// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
// This coupling must be necessarily be put on the Navier-Stokes lattice!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

std::vector<T> dir{0.0, 1.0};

T boussinesqForcePrefactor = -9.81 / converter.getConversionFactorVelocity() * converter.getConversionFactorTime() *
converter.getCharPhysTemperatureDifference() * converter.getPhysThermalExpansionCoefficient();
// T boussinesqForcePrefactor = 0.0 ;

NavierStokesAdvectionDiffusionCouplingGenerator2D<T,NSDESCRIPTOR> coupling(0, converter.getLatticeLength(lx), 0, converter.getLatticeLength(ly), boussinesqForcePrefactor, (converter.getLatticeTemperature(Tcold)+converter.getLatticeTemperature(Thot))/2., 1., dir);

/// === 4th Step: Main Loop with Timer ===
util::Timer<T> timer(converter.getLatticeTime(maxPhysT), superGeometry.getStatistics().getNvoxel() );
timer.start();

util::ValueTracer<T> converge(converter.getLatticeTime(50.),epsilon);
for (std::size_t iT = 0; iT < converter.getLatticeTime(maxPhysT); ++iT) {

if (converge.hasConverged()) {
clout << “Simulation converged.” << std::endl;
getResults(converter, NSlattice, ADlattice, iT, superGeometry, timer, converge.hasConverged());

clout << “Time ” << iT << “.” << std::endl;

break;
}

/// === 5th Step: Definition of Initial and Boundary Conditions ===

/// === 6th Step: Collide and Stream Execution ===
NSlattice.collideAndStream();

NSlattice.executeCoupling();

/// === 7th Step: Computation and Output of the Results ===
getResults(converter, NSlattice, ADlattice, iT, superGeometry, timer, converge.hasConverged());
}

timer.stop();
timer.printSummary();
}

//*****************************************************************************************

Thank you very much

#6753
navidkyo
Participant

Hello Mathias,

This is the RayleighBernard2D example of OpenLB V1.4. Material 4 is defined to implement a perturbation; it is not inflow or outflow.

I will redefine material 4 and let you know if the error is resolved.

#6749
navidkyo
Participant

Dear Julius,

Thank you for your time and response. The problem with compiling went away but the simulation still crashes. Here is the error:

[ThermalUnitConv] —————– UnitConverter information —————–
[ThermalUnitConv] — Parameters:
[ThermalUnitConv] Resolution: N= 10
[ThermalUnitConv] Lattice velocity: latticeU= 0.1
[ThermalUnitConv] Lattice relaxation frequency: omega= 1.90375
[ThermalUnitConv] Lattice relaxation time: tau= 0.525278
[ThermalUnitConv] Thermal Lattice relaxation frequency: omega_AD= 1.86705
[ThermalUnitConv] Thermal Lattice relaxation time: tau_AD= 0.535603
[ThermalUnitConv] Characteristical length(m): charL= 0.1
[ThermalUnitConv] Characteristical speed(m/s): charU= 0.0118678
[ThermalUnitConv] Phys. kinematic viscosity(m^2/s): charNu= 1e-05
[ThermalUnitConv] Phys. density(kg/m^d): charRho= 1
[ThermalUnitConv] Characteristical pressure(N/m^2): charPressure= 0
[ThermalUnitConv] Reynolds number: reynoldsNumber= 118.678
[ThermalUnitConv] ————————————————————-
[ThermalUnitConv] —————– ThermalUnitConverter information —————–
[ThermalUnitConv] — Parameters:
[ThermalUnitConv] Phys. Delta X(m): physDeltaX= 0.01
[ThermalUnitConv] Phys. Delta T(s): physDeltaT= 0.0842615
[ThermalUnitConv] Characteristical pressure(N/m^2): charPressure= 0
[ThermalUnitConv] Phys. Thermal Conductivity(W/m/K): physThermalCondcticity= 0.03
[ThermalUnitConv] Phys. specific Heat Capacity(J/kg/K): physSpecificHeatCapacity= 2130
[ThermalUnitConv] Phys. Thermal Expasion Coefficent(K^-1): physThermalExpansionCoefficent= 0.000143573
[ThermalUnitConv] Characteristical Phys. low Temperature(K): charPhysLowTemperature= 273.15
[ThermalUnitConv] Characteristical Phys. high Temperature(K): charPhysHighTemperature= 274.15
[ThermalUnitConv] Prandtl number: prandtlNumber= 0.71
[ThermalUnitConv] Rayleigh number: rayleighNumber= 10000
[ThermalUnitConv] ————————————————————-
[ThermalUnitConv] —————– Conversion factors:—————–
[ThermalUnitConv] Voxel length(m): physDeltaX= 0.01
[ThermalUnitConv] Time step(s): physDeltaT= 0.0842615
[ThermalUnitConv] Velocity factor(m/s): physVelocity= 0.118678
[ThermalUnitConv] Density factor(kg/m^3): physDensity= 1
[ThermalUnitConv] Mass factor(kg): physMass= 1e-06
[ThermalUnitConv] Viscosity factor(m^2/s): physViscosity= 0.00118678
[ThermalUnitConv] Force factor(N): physForce= 1.40845e-06
[ThermalUnitConv] Pressure factor(N/m^2): physPressure= 0.0140845
[ThermalUnitConv] ————————————————————-
[ThermalUnitConv] —————– ThermalConversion factors:—————–
[ThermalUnitConv] Temperature(K): temperature= 1
[ThermalUnitConv] Thermal Duffusity(m^2/s): physThermalDiffusity= 0.00118678
[ThermalUnitConv] specific Heat Capacity(J/kg): physSpecificHeatCapacity= 0.0140845
[ThermalUnitConv] Thermal Coductivity(W/m/K): physThermalCondcticity= 1.67152e-05
[ThermalUnitConv] HeatFlux(W): physHeatFlux= 0.00167152
[ThermalUnitConv] ————————————————————-
[prepareGeometry] Prepare Geometry …
[SuperGeometry2D] cleaned 0 outer boundary voxel(s)
[SuperGeometry2D] cleaned 1 inner boundary voxel(s)
[SuperGeometry2D] the model is correct!
[CuboidGeometry2D] —Cuboid Stucture Statistics—
[CuboidGeometry2D] Number of Cuboids: 1
[CuboidGeometry2D] Delta (min): 0.01
[CuboidGeometry2D] (max): 0.01
[CuboidGeometry2D] Ratio (min): 1
[CuboidGeometry2D] (max): 1.9901
[CuboidGeometry2D] Nodes (min): 20301
[CuboidGeometry2D] (max): 20301
[CuboidGeometry2D] ——————————–
[SuperGeometryStatistics2D] materialNumber=1; count=19898; minPhysR=(0,0.01); maxPhysR=(2,0.99)
[SuperGeometryStatistics2D] materialNumber=2; count=201; minPhysR=(0,0); maxPhysR=(2,0)
[SuperGeometryStatistics2D] materialNumber=3; count=201; minPhysR=(0,1); maxPhysR=(2,1)
[SuperGeometryStatistics2D] materialNumber=4; count=1; minPhysR=(1,0.01); maxPhysR=(1,0.01)
[prepareGeometry] Prepare Geometry … OK
[prepareLattice] defining dynamics
[prepareLattice] Prepare Lattice … OK
[Timer] step=0; percent=0; passedTime=0.049; remTime=581.483; MLUPs=0
[LatticeStatistics] step=0; t=0; uMax=1.49167e-154; avEnergy=0; avRho=1
terminate called after throwing an instance of ‘std::invalid_argument’
what(): This MultiFieldArrayD does not provide FIELD.
[fedora:17569] *** Process received signal ***
[fedora:17569] Signal: Aborted (6)
[fedora:17569] Signal code: (-6)
[fedora:17569] [ 1] /lib64/libc.so.6(gsignal+0x142)[0x7fd0de8662a2]
[fedora:17569] [ 2] /lib64/libc.so.6(abort+0x116)[0x7fd0de84f8a4]
[fedora:17569] [ 3] /lib64/libstdc++.so.6(+0xa1a26)[0x7fd0dec1ba26]
[fedora:17569] [ 7] ./rayleighBenard2d[0x4880b1]
[fedora:17569] [ 8] ./rayleighBenard2d[0x485654]
[fedora:17569] [ 9] ./rayleighBenard2d[0x481c9e]
[fedora:17569] [10] ./rayleighBenard2d[0x47e656]
[fedora:17569] [11] ./rayleighBenard2d[0x474f16]
[fedora:17569] [12] ./rayleighBenard2d[0x47a5f7]
[fedora:17569] [13] ./rayleighBenard2d[0x421741]
[fedora:17569] [14] ./rayleighBenard2d[0x41741c]
[fedora:17569] [15] ./rayleighBenard2d[0x40ae14]
[fedora:17569] [16] ./rayleighBenard2d[0x40ba22]
[fedora:17569] [17] /lib64/libc.so.6(__libc_start_main+0xd5)[0x7fd0de850b75]
[fedora:17569] [18] ./rayleighBenard2d[0x4092ae]
[fedora:17569] *** End of error message ***
Aborted (core dumped)

Bests,
Navid

Viewing 4 posts - 1 through 4 (of 4 total)