ndjinga / SOLVERLAB

PDE solver lab using SALOME/MEDCoupling meshes and PETSc matrices
GNU Lesser General Public License v2.1
18 stars 3 forks source link

Variables arrangement? #1

Open AliE89 opened 6 hours ago

AliE89 commented 6 hours ago

Hi @ndjinga,

I have a cell-centered pressure-based fully coupled code with PETSc as solver engine. Currently, I'am using differnet flavours of fieldpslit to precodition the system. Recently, I hit this work and I am keen to try it out. Your scirpts are wll-written and I'have understood all the steps. Thanks a lot for this.

The only thing I am in doubt is the variable arrangement:

I might have a differenr arrangement than yours and I would like to get it right!

Thanks a lot!

AliE89 commented 6 hours ago

Ah sorry, you are getting the strides here:

MatCreateSubMatrix(A_input,is_U, is_U,MAT_INITIAL_MATRIX,&M);
MatCreateSubMatrix(A_input,is_U, is_P,MAT_INITIAL_MATRIX,&G);
MatCreateSubMatrix(A_input,is_P, is_U,MAT_INITIAL_MATRIX,&D);
MatCreateSubMatrix(A_input,is_P, is_P,MAT_INITIAL_MATRIX,&C);

N is momentum and C the pressure,

I guess the only obscure thing is the swap betwen pressure and velocity here:

//Swap the pressure and velocity components
VecGetSubVector( b_input, is_P, &b_input_p);
VecGetSubVector( b_input, is_U, &b_input_u);
X_array[0] = b_input_p;
X_array[1] = b_input_u;

Cheers