Skip to content

achodankar

Forum Replies Created

Viewing 15 posts - 31 through 45 (of 67 total)
  • Author
    Posts
  • achodankar
    Participant

    Hello Julius,
    I can manage the csv file format. I don’t understand the part of how to extract the values from functors.

    From example:
    After defining this statement,

    SuperLatticeVelocity2D<T, DESCRIPTOR> velocity_lat( sLattice);

    Normally in arrays, I access the values using the index, but I am not aware how to go about it with functors. This has been a bottleneck issue for me presently.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Julius,
    Your feedback has been of great help to me. Thank you. Without using interpolation techniques(analytical functors & Blockreduction techniques), how I can store the velocity data from functors in a csv file. What would be the syntax for it? My coding background is weak for advanced C++ like functors. In the vtmwriter, I can view the results in Paraview, but for plotting my data, I would need the raw data in the form of csv files. I have been saving the data in csv files using interpolation methods in the past.
    In regard to the cell method, how would the syntax be to extract the velocity/pressure/density values?(as you mentioned computeU and computeRho)?

    Thank you.

    Your sincerely

    Abhijeet C.

    achodankar
    Participant

    Hello Julius,
    Thank you for your prompt response again. The source code has the offset. The formula for lattice pressure in the code is given as: p= cs2 * (rho-1). You had mentioned earlier the offset is for the reason of numerical accuracy. But, I am unable to comprehend how the pressure values will match.

    template <typename T, typename DESCRIPTOR>
    bool BlockLatticePhysPressure2D<T,DESCRIPTOR>::operator() (T output[], const int input[])
    {
    // lattice pressure = c_s^2 ( rho -1 )
    T latticePressure = ( this->_blockLattice.get( input[0], input[1] ).computeRho()-1) / descriptors::invCs2<T,DESCRIPTOR>();
    output[0] = this->_converter.getPhysPressure(latticePressure);

    return true;
    }

    There is no offset in the density in the source code:

    template <typename T, typename DESCRIPTOR>
    bool BlockLatticeDensity2D<T,DESCRIPTOR>::operator() (T output[], const int input[])
    {
    output[0] = this->_blockLattice.get( input[0], input[1] ).computeRho();
    return true;
    }

    Thank you once again for your patience and help. I really appreciate it.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Julius,
    I defined the characteristic pressure as 101325 Pa using the unit converter.

    Here is the code snippet:

    UnitConverterFromResolutionAndRelaxationTime<T, DESCRIPTOR> const converter(
    int {N}, // resolution: number of voxels per charPhysL
    (T) lat_relax_time,//0.8 // latticeRelaxationTime: relaxation time, have to be greater than 0.5!
    (T) char_phys_length, // charPhysLength: reference length of simulation geometry
    (T) char_phys_velocity, // charPhysVelocity: maximal/highest expected velocity during simulation in __m / s__
    (T) phys_kinematic_viscosity, // physViscosity: physical kinematic viscosity in __m^2 / s__
    (T) phys_density, // physDensity: physical density in __kg / m^3__
    (T) 101325. //charphysPressure
    );
    (latticePhysPressure2D.hh) Here is the code snippet where I removed the offset for pressure:

    template <typename T, typename DESCRIPTOR>
    bool BlockLatticePhysPressure2D<T,DESCRIPTOR>::operator() (T output[], const int input[])
    {
    // lattice pressure = c_s^2 ( rho -1 )
    T latticePressure = ( this->_blockLattice.get( input[0], input[1] ).computeRho()) / descriptors::invCs2<T,DESCRIPTOR>();
    output[0] = this->_converter.getPhysPressure(latticePressure);

    return true;
    }

    Thank you.

    Yours sincerely,

    Abhijeet C.

    in reply to: Bounceback boundaries(Physical and lattice coordinates) #5910
    achodankar
    Participant

    Hello Julius,
    I understand now. Thank you for your prompt response.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Julius,
    Actually, I removed the offset one from the SuperLatticePhysPressure2D code file. That’s how my results are matching now. Before that, the results were differing and incorrect values. Will removing the offset make a difference ? I don’t understand how it is related to numerical accuracy. Thank you for your time once again.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    in reply to: AnalyticalLinear2D Functor Syntax Query #5908
    achodankar
    Participant

    Hello Julius,
    Thank you for your prompt response. I understand it now.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Mathias,
    Once that 1 is removed from the formula inputted in the code file, the pressure values do match properly. I would be grateful if you can point if I am doing anything wrong. Thank you once again for your responses.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Mathias,
    I did follow the procedure as you suggested. The density value is already set in the unit converter.

    SuperLatticeDensity2D<T,DESCRIPTOR> densityF(sLattice);
    AnalyticalFfromSuperF2D<T> intpolatedensity_lat(densityF, true );

    intpolatedensity_lat( density_lat,point );

    //compute lattice pressure
    pressure_lat[0]=(density_lat[0])/descriptors::invCs2<T,DESCRIPTOR>();

    //Compute physical pressure
    pressure_phys[0] = (pressure_lat[0] * converter.getConversionFactorPressure())+converter.getCharPhysPressure();

    If I set characteristic pressure as 101325 Pa, the lattice pressure is 0.3333 and the physical pressure is 101349 Pa.
    However, when I extract the pressure values from the usual method, the value of physical pressure is 101325 Pa, which is not correct. I tried the code to extract lattice pressure from one of the previous posts in the forum but was unable to extract. What would the syntax be? The commented lines compile without any errors. I am unable to extract those values. Also, why do we subtract 1. Based on equation of state: P = rho * cs^2 (in the blocklatticepressurephys code file also they have subtracted one).

    Here is the code snippet:

    SuperLatticePhysPressure2D<T, DESCRIPTOR> pressure_phys(sLattice, converter);
    AnalyticalFfromSuperF2D<T> intpolatepressure_phys( pressure_phys, true );
    intpolatepressure_phys( numericalpressure_phys,point );

    //Store the lattice Pressure
    // SuperLatticeDensity2D<T,DESCRIPTOR> densityF(sLattice);
    // auto latticePressureF = (functor_dsl::lift(densityF) – 1.0) / descriptors::invCs2<T,DESCRIPTOR>();

    I would be grateful for your suggestions on this issue

    Thank you.

    Yours sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Mathias,
    I see in the util.h file mentioning the equation of state, which can be employed to set the pressure values. However, in the code, I don’t know understand how the pressure values are set using the equation of set. There are functions to initialise the density, velocity, and momenta, but nothing for pressure. I have been using Doxygen for the same. The two searches closest to pressure are: PressureBM and pressureFromDensity. I would be grateful if you can direct me how the pressureFromDensity function is employed while setting the local and interpolated pressure values. In the pressureBM file, they compute density, velocity, momenta, and stress, but no mention of pressure. I have seen the same pattern while browsing through other code files. I would appreciate any help on this matter.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    in reply to: Bounceback boundaries(Physical and lattice coordinates) #5898
    achodankar
    Participant

    Poiseuille2D example

    in reply to: Extract Lattice data #5892
    achodankar
    Participant

    Hello Adrian,
    The issue is fixed now. Thank you for patience and time. I really appreciate it.

    Here is the code snippet:

    int latticeNew[3];
    T physNew[2];
    ofstream pfile9;
    pfile9.open(“physical_to_lattice_Coordinates.csv”);
    pfile9 <<“phys_x,”<<“phys_y,”<<“i,” << “j” <<endl;

    // 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)
    {
    physNew[0] = x_phys[iC][iX][iY];
    physNew[1] = y_phys[iC][iX][iY];
    cuboidGeometry.getLatticeR(latticeNew, physNew);
    pfile9<<physNew[0]<<“,”<<physNew[1]<<“,”<<latticeNew[1]<<“,”<<latticeNew[2]<<endl;
    }
    }
    }
    pfile9.close();

    Thank you.

    Your sincerely,

    Abhijeet C.

    achodankar
    Participant

    Hello Adrian,
    Thank you. This issue is resolved now.

    Thank you.

    Yours sincerely,

    Abhijeet C.

    in reply to: Poiseuille 2D physical kinematic viscosity (no output) #5889
    achodankar
    Participant

    This problem is fixed. I had to change the lattice relaxation time. All is good now

    in reply to: Extract Lattice data #5888
    achodankar
    Participant

    Hello Adrian,
    Same result.

    int latticeNew[2];
    T physNew[2];
    ofstream pfile9;
    pfile9.open(“physical_to_lattice_Coordinates.csv”);
    pfile9 <<“phys_x,”<<“phys_y,”<<“i,” << “j” <<endl;

    // 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)
    {
    physNew[0] = x_phys[iC][iX][iY];
    physNew[1] = y_phys[iC][iX][iY];
    cuboidGeometry.getLatticeR(latticeNew, physNew);

    pfile9<<physNew[0]<<“,”<<physNew[1]<<“,”<<latticeNew[0]<<“,”<<latticeNew[1]<<endl;
    }
    }
    }
    pfile9.close();

    Thank you.

    Yours sincerely,

    Abhijeet

Viewing 15 posts - 31 through 45 (of 67 total)