Exemple #1
0
void VelocityBufferReadStencil::applyBackWall   (FlowField & flowField, int i, int j, int k){
    const int index = 3 * (i + (flowField.getNx()+3) * j);
    flowField.getVelocity().getVector(i, j, flowField.getNz()+2)[0] = _backBufferIn[ index ];
    flowField.getVelocity().getVector(i, j, flowField.getNz()+2)[1] = _backBufferIn[index+1];
    flowField.getVelocity().getVector(i, j, flowField.getNz()+2)[2] = _backBufferIn[index+2];
}
Exemple #2
0
void VelocityBufferFillStencil::applyFrontWall  (FlowField & flowField, int i, int j, int k){
    const int index = 3 * (i + (flowField.getNx()+3) * j);
    _frontBufferOut[ index ] = flowField.getVelocity().getVector(i, j, 2)[0];
    _frontBufferOut[index+1] = flowField.getVelocity().getVector(i, j, 2)[1];
    _frontBufferOut[index+2] = flowField.getVelocity().getVector(i, j, 2)[2];
}
Exemple #3
0
void VelocityBufferReadStencil::applyLeftWall (FlowField & flowField, int i, int j){
    flowField.getVelocity().getVector(0, j)[0] = _leftBufferIn[ 2*j ];
    flowField.getVelocity().getVector(1, j)[1] = _leftBufferIn[2*j+1];
}
Exemple #4
0
void PressureBufferReadStencil::applyBackWall   (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * j;
    flowField.getPressure().getScalar(i, j, flowField.getNz()+2) = _backBufferIn[index];
}
Exemple #5
0
void VelocityBufferFillStencil::applyRightWall  (FlowField & flowField, int i, int j, int k){
    const int index = 3 * (j + (flowField.getNy()+3) * k);
    _rightBufferOut[ index ] = flowField.getVelocity().getVector(flowField.getNx(),   j, k)[0];
    _rightBufferOut[index+1] = flowField.getVelocity().getVector(flowField.getNx()+1, j, k)[1];
    _rightBufferOut[index+2] = flowField.getVelocity().getVector(flowField.getNx()+1, j, k)[2];
}
Exemple #6
0
void PressureBufferReadStencil::applyBottomWall (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * k;
    flowField.getPressure().getScalar(i, 1, k) = _bottomBufferIn[index];
}
Exemple #7
0
void PressureBufferReadStencil::applyTopWall    (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * k;
    flowField.getPressure().getScalar(i, flowField.getNy()+2, k) = _topBufferIn[index];
}
Exemple #8
0
void PressureBufferFillStencil::applyRightWall  (FlowField & flowField, int i, int j, int k){
    const int index = j + (flowField.getNy()+3) * k;
    _rightBufferOut[index] = flowField.getPressure().getScalar(flowField.getNx()+1, j, k);
}
Exemple #9
0
void PressureBufferFillStencil::applyBottomWall (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * k;
    _bottomBufferOut[index] = flowField.getPressure().getScalar(i, 2, k);
}
Exemple #10
0
void PressureBufferFillStencil::applyBottomWall (FlowField & flowField, int i, int j){
    _bottomBufferOut[i] = flowField.getPressure().getScalar(i, 2);
}
Exemple #11
0
void PressureBufferFillStencil::applyTopWall    (FlowField & flowField, int i, int j){
    _topBufferOut[i] = flowField.getPressure().getScalar(i, flowField.getNy()+1);
}
Exemple #12
0
void PressureBufferFillStencil::applyRightWall  (FlowField & flowField, int i, int j){
    _rightBufferOut[j] = flowField.getPressure().getScalar(flowField.getNx()+1, j);
}
Exemple #13
0
void VelocityBufferFillStencil::applyLeftWall (FlowField & flowField, int i, int j){
    _leftBufferOut[ 2*j ] = flowField.getVelocity().getVector(2, j)[0];
    _leftBufferOut[2*j+1] = flowField.getVelocity().getVector(2, j)[1];
}
Exemple #14
0
void PressureBufferFillStencil::applyLeftWall   (FlowField & flowField, int i, int j){
    _leftBufferOut[j] = flowField.getPressure().getScalar(2, j);
}
Exemple #15
0
void PressureBufferReadStencil::applyTopWall    (FlowField & flowField, int i, int j){
    flowField.getPressure().getScalar(i, flowField.getNy()+2) = _topBufferIn[i];
}
Exemple #16
0
void PressureBufferFillStencil::applyTopWall    (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * k;
    _topBufferOut[index] = flowField.getPressure().getScalar(i, flowField.getNy()+1, k);
}
Exemple #17
0
void PressureBufferReadStencil::applyRightWall  (FlowField & flowField, int i, int j, int k){
    const int index = j + (flowField.getNy()+3) * k;
    flowField.getPressure().getScalar(flowField.getNx()+2, j, k) = _rightBufferIn[index];
}
Exemple #18
0
void PressureBufferFillStencil::applyFrontWall  (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * j;
    _frontBufferOut[index] = flowField.getPressure().getScalar(i, j, 2);
}
Exemple #19
0
void VelocityBufferFillStencil::applyBottomWall (FlowField & flowField, int i, int j){
    _bottomBufferOut[ 2*i ] = flowField.getVelocity().getVector(i, 2)[0];
    _bottomBufferOut[2*i+1] = flowField.getVelocity().getVector(i, 2)[1];
}
Exemple #20
0
void PressureBufferFillStencil::applyBackWall   (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * j;
    _backBufferOut[index] = flowField.getPressure().getScalar(i, j, flowField.getNz()+1);
}
Exemple #21
0
void PressureBufferReadStencil::applyFrontWall  (FlowField & flowField, int i, int j, int k){
    const int index = i + (flowField.getNx()+3) * j;
    flowField.getPressure().getScalar(i, j, 1) = _frontBufferIn[index];
}
Exemple #22
0
void VelocityBufferFillStencil::applyRightWall (FlowField & flowField, int i, int j){
    _rightBufferOut[ 2*j ] = flowField.getVelocity().getVector(flowField.getNx()  , j)[0];
    _rightBufferOut[2*j+1] = flowField.getVelocity().getVector(flowField.getNx()+1, j)[1];
}
Exemple #23
0
void VelocityBufferFillStencil::applyTopWall (FlowField & flowField, int i, int j){
    _topBufferOut[ 2*i ] = flowField.getVelocity().getVector(i, flowField.getNy()+1)[0];
    _topBufferOut[2*i+1] = flowField.getVelocity().getVector(i, flowField.getNy()  )[1];
}
Exemple #24
0
void PressureBufferReadStencil::applyLeftWall   (FlowField & flowField, int i, int j){
    flowField.getPressure().getScalar(1, j) = _leftBufferIn[j];
}
Exemple #25
0
void VelocityBufferFillStencil::applyTopWall    (FlowField & flowField, int i, int j, int k){
    const int index = 3 * (i + (flowField.getNx()+3) * k);
    _topBufferOut[ index ] = flowField.getVelocity().getVector(i, flowField.getNy()+1, k)[0];
    _topBufferOut[index+1] = flowField.getVelocity().getVector(i, flowField.getNy()  , k)[1];
    _topBufferOut[index+2] = flowField.getVelocity().getVector(i, flowField.getNy()+1, k)[2];
}
Exemple #26
0
void PressureBufferReadStencil::applyRightWall  (FlowField & flowField, int i, int j){
    flowField.getPressure().getScalar(flowField.getNx()+2, j) = _rightBufferIn[j];
}
Exemple #27
0
void VelocityBufferFillStencil::applyBackWall   (FlowField & flowField, int i, int j, int k){
    const int index = 3 * (i + (flowField.getNx()+3) * j);
    _backBufferOut[ index ] = flowField.getVelocity().getVector(i, j, flowField.getNz()+1)[0];
    _backBufferOut[index+1] = flowField.getVelocity().getVector(i, j, flowField.getNz()+1)[1];
    _backBufferOut[index+2] = flowField.getVelocity().getVector(i, j, flowField.getNz()  )[2];
}
Exemple #28
0
void PressureBufferReadStencil::applyBottomWall (FlowField & flowField, int i, int j){
    flowField.getPressure().getScalar(i, 1) = _bottomBufferIn[i];
}
Exemple #29
0
void VelocityStencil::apply ( FlowField & flowField, int i, int j, int k ){

    const FLOAT dt = _parameters.timestep.dt;
    const int obstacle = flowField.getFlags().getValue(i, j, k);
    VectorField & velocity = flowField.getVelocity();

    if ((obstacle & OBSTACLE_SELF) == 0) {
        if ((obstacle & OBSTACLE_RIGHT) == 0) {
            const FLOAT dx = 0.5*(_parameters.meshsize->getDx(i,j,k)+_parameters.meshsize->getDx(i+1,j,k));
            velocity.getVector(i,j,k)[0] = flowField.getFGH().getVector(i,j,k)[0] - dt/dx *
                (flowField.getPressure().getScalar(i+1,j,k) - flowField.getPressure().getScalar(i,j,k));
        } else {
            velocity.getVector(i, j, k)[0] = 0.0;
        }
        if ((obstacle & OBSTACLE_TOP) == 0) {
            const FLOAT dy = 0.5*(_parameters.meshsize->getDy(i,j,k)+_parameters.meshsize->getDy(i,j+1,k));
            velocity.getVector(i,j,k)[1] = flowField.getFGH().getVector(i,j,k)[1] - dt/dy *
                (flowField.getPressure().getScalar(i,j+1,k) - flowField.getPressure().getScalar(i,j,k));
        } else {
            velocity.getVector(i, j, k)[1] = 0.0;
        }
        if ((obstacle & OBSTACLE_BACK) == 0) {
            const FLOAT dz = 0.5*(_parameters.meshsize->getDz(i,j,k)+_parameters.meshsize->getDz(i,j,k+1));
            velocity.getVector(i,j,k)[2] = flowField.getFGH().getVector(i,j,k)[2] - dt/dz *
                (flowField.getPressure().getScalar(i,j,k+1) - flowField.getPressure().getScalar(i,j,k));
        } else {
            velocity.getVector(i, j, k)[2] = 0.0;
        }
    }
}
Exemple #30
0
void VelocityBufferReadStencil::applyFrontWall  (FlowField & flowField, int i, int j, int k){
    const int index = 3 * (i + (flowField.getNx()+3) * j);
    flowField.getVelocity().getVector(i, j, 1)[0] = _frontBufferIn[ index ];
    flowField.getVelocity().getVector(i, j, 1)[1] = _frontBufferIn[index+1];
    flowField.getVelocity().getVector(i, j, 0)[2] = _frontBufferIn[index+2];
}