ICFERST  22-06
Reservoir simulator based on DCVFEM, Dynamic Mesh optimisation and Surface-based modelling
matrix_operations Module Reference

This module contain subroutines to deal with the ICFERST matrices format. This includes MATVECS and MATMAT operations All of this should be replaced by PETSc. More...

Functions/Subroutines

subroutine matdmatinv (DMAT, DMATINV, NLOC)
 calculate DMATINV More...
 
subroutine matinv (A, N, NMAX)
 : This sub finds the inverse of the matrix A and puts it back in A. MAT, MAT2, X and B are working vectors. More...
 
subroutine matinvold (A, N, MAT, B)
 : This sub finds the inverse of the matrix A and puts it back in A. MAT, MAT2, X and B are working vectors. More...
 
subroutine smlinngot (A, X, B, NMX, IPIV, GOTDEC)
 Calculate the inverse using the LU decomposition L can be provided, speeding up the method to O(n) More...
 
subroutine color_get_cmc_pha (Mdims, Mspars, ndgln, Mmat, DIAG_SCALE_PRES, DIAG_SCALE_PRES_COUP, INV_B, CMC_petsc, CMC_PRECON, IGOT_CMC_PRECON, MASS_MN_PRES, pipes_aux, got_free_surf, MASS_SUF, FEM_continuity_equation)
 :Initialize the momentum equation (CMC) and introduces the corresponding values in it. COLOR_GET_CMC_PHA_FAST is very memory hungry, so we let the user decide or if we are using a compacted lumped mass matrix then the memory reduction compensates this extra memory usage More...
 
subroutine mass_matrix_inversion (PIVIT_MAT, Mdims, eles_with_pipe)
 : Inversion of the mass matrix. If compacted this is much more efficient More...
 
subroutine mass_matrix_matvec (U, BLOCK_MAT, CDP, NDIM, NPHASE, TOTELE, U_NLOC, U_NDGLN)
 : U = Mass_matrix * Vector (tipically vector is Grad * P + RHS and this is used to obtain the velocity) More...
 
subroutine pha_block_mat_vec (U, BLOCK_MAT, CDP, U_NONODS, NDIM, NPHASE, TOTELE, U_NLOC, U_NDGLN)
 : performs U = BLOCK_MAT * CDP, where block_mat More...
 
subroutine pha_block_mat_vec2 (U, BLOCK_MAT, CDP, NDIM, NPHASE, TOTELE, U_NLOC, U_NDGLN)
 :U = BLOCK_MAT * CDP More...
 
subroutine pha_block_mat_vec_many2 (U, BLOCK_MAT, CDP, U_NONODS, NDIM, NPHASE, NBLOCK, TOTELE, U_NLOC, U_NDGLN)
 : U = BLOCK_MAT * CDP More...
 
subroutine pha_block_mat_vec_many (U, BLOCK_MAT, CDP, NDIM, NPHASE, NBLOCK, TOTELE, U_NLOC, U_NDGLN)
 : U = BLOCK_MAT * CDP More...
 
subroutine pha_block_mat_vec_many_reusing (BLOCK_MAT, CDP, NDIM, NPHASE, NBLOCK, TOTELE, U_NLOC, U_NDGLN)
 : U = BLOCK_MAT * CDP The difference with PHA_BLOCK_MAT_VEC_MANY is that the input CDP is overwritten with the output More...
 
subroutine ct_mult (CV_RHS, U, V, W, CV_NONODS, U_NONODS, NDIM, NPHASE, CT, NCOLCT, FINDCT, COLCT)
 : CV_RHS=CT*U More...
 
subroutine ct_mult2 (CV_RHS, U, CV_NONODS, U_NONODS, NDIM, NPHASE, CT, NCOLCT, FINDCT, COLCT)
 :CV_RHS=CT*U More...
 
subroutine ct_mult_many (CV_RHS, U, CV_NONODS, U_NONODS, NDIM, NPHASE, NBLOCK, CT, NCOLCT, FINDCT, COLCT)
 : CV_RHS = CT * U More...
 
subroutine c_mult_many (CDP, DP, CV_NONODS, U_NONODS, NDIM, NPHASE, NBLOCK, C, NCOLC, FINDC, COLC)
 : CDP=C*DP More...
 
subroutine c_mult2 (CDP, DP, CV_NONODS, U_NONODS, NDIM, NPHASE, C, NCOLC, FINDC, COLC)
 : CDP=C*DP More...
 
subroutine c_mult2_multi_pres (Mdims, Mspars, Mmat, deltap, CDP_tensor)
 : Performs the multiplication CDP_tensor = MmatC * deltap More...
 
subroutine ct_mult_with_c (DP, U_LONG, U_NONODS, NDIM, NPHASE, C, NCOLC, FINDC, COLC)
 : DP = (C)^T U_LONG More...
 
subroutine ct_mult_with_c3 (DP, U_ALL, U_NONODS, NDIM, NPHASE, C, NCOLC, FINDC, COLC)
 : DP = (C)^T U_ALL More...
 
subroutine ct_mult_with_c_many (DP, U_LONG, U_NONODS, NDIM, NPHASE, C, FINDC, COLC)
 : DP = (C)^T U_LONG More...
 
subroutine ulong_2_uvw (U, V, W, UP, U_NONODS, NDIM, NPHASE)
 
subroutine posinmat (posmat, globi, globj, findrm, colm)
 : Find position in matrix POSMAT which has column GLOBJ More...
 
subroutine assemble_global_multiphase_csr (global_csr, block_csr, dense_block_matrix, block_to_global, global_dense_block)
 
subroutine allocate_global_multiphase_petsc_csr (global_petsc, sparsity, tracer, nphase)
 
type(petsc_csr_matrix) function allocate_momentum_matrix (sparsity, velocity)
 

Detailed Description

This module contain subroutines to deal with the ICFERST matrices format. This includes MATVECS and MATMAT operations All of this should be replaced by PETSc.

Function/Subroutine Documentation

◆ allocate_global_multiphase_petsc_csr()

subroutine matrix_operations::allocate_global_multiphase_petsc_csr ( type(petsc_csr_matrix)  global_petsc,
type(csr_sparsity)  sparsity,
type(tensor_field)  tracer,
integer, intent(in)  nphase 
)
Here is the caller graph for this function:

◆ allocate_momentum_matrix()

type(petsc_csr_matrix) function matrix_operations::allocate_momentum_matrix ( type(csr_sparsity), intent(inout)  sparsity,
type(tensor_field), intent(inout)  velocity 
)
Here is the caller graph for this function:

◆ assemble_global_multiphase_csr()

subroutine matrix_operations::assemble_global_multiphase_csr ( real, dimension(:), intent(out)  global_csr,
real, dimension(:), intent(in)  block_csr,
real, dimension(:,:,:), intent(in)  dense_block_matrix,
integer, dimension(:), intent(in)  block_to_global,
integer, dimension(:,:), intent(in)  global_dense_block 
)

◆ c_mult2()

subroutine matrix_operations::c_mult2 ( real, dimension( ndim, nphase, u_nonods ), intent(inout)  CDP,
real, dimension( cv_nonods ), intent(in)  DP,
integer, intent(in)  CV_NONODS,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
real, dimension( ndim, nphase, ncolc ), intent(in)  C,
integer, intent(in)  NCOLC,
integer, dimension( u_nonods + 1 ), intent(in)  FINDC,
integer, dimension( ncolc ), intent(in)  COLC 
)

: CDP=C*DP

Here is the caller graph for this function:

◆ c_mult2_multi_pres()

subroutine matrix_operations::c_mult2_multi_pres ( type(multi_dimensions), intent(in)  Mdims,
type (multi_sparsities), intent(in)  Mspars,
type (multi_matrices), intent(in)  Mmat,
real, dimension(mdims%npres,mdims%cv_nonods), intent(in)  deltap,
type(tensor_field), intent(inout)  CDP_tensor 
)

: Performs the multiplication CDP_tensor = MmatC * deltap

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_mult_many()

subroutine matrix_operations::c_mult_many ( real, dimension( :, :, :, : ), intent(inout)  CDP,
real, dimension( :, : ), intent(in)  DP,
integer, intent(in)  CV_NONODS,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  NBLOCK,
real, dimension( :, :, : ), intent(in)  C,
integer, intent(in)  NCOLC,
integer, dimension( : ), intent(in)  FINDC,
integer, dimension( : ), intent(in)  COLC 
)

: CDP=C*DP

Here is the caller graph for this function:

◆ color_get_cmc_pha()

subroutine matrix_operations::color_get_cmc_pha ( type(multi_dimensions), intent(in)  Mdims,
type (multi_sparsities), intent(in)  Mspars,
type(multi_ndgln), intent(in)  ndgln,
type (multi_matrices), intent(inout)  Mmat,
real, dimension( :, : ), intent(in)  DIAG_SCALE_PRES,
real, dimension( :, :, : ), intent(in)  DIAG_SCALE_PRES_COUP,
real, dimension( :, :, : ), intent(in)  INV_B,
type(petsc_csr_matrix), intent(inout)  CMC_petsc,
real, dimension( :, :, : ), intent(inout)  CMC_PRECON,
integer, intent(in)  IGOT_CMC_PRECON,
real, dimension( : ), intent(in)  MASS_MN_PRES,
type (multi_pipe_package), intent(in)  pipes_aux,
logical, intent(in)  got_free_surf,
real, dimension( : ), intent(in)  MASS_SUF,
logical, intent(in)  FEM_continuity_equation 
)

:Initialize the momentum equation (CMC) and introduces the corresponding values in it. COLOR_GET_CMC_PHA_FAST is very memory hungry, so we let the user decide or if we are using a compacted lumped mass matrix then the memory reduction compensates this extra memory usage

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ct_mult()

subroutine matrix_operations::ct_mult ( real, dimension( cv_nonods ), intent(inout)  CV_RHS,
real, dimension( u_nonods * nphase ), intent(in)  U,
real, dimension( u_nonods * nphase ), intent(in)  V,
real, dimension( u_nonods * nphase ), intent(in)  W,
integer, intent(in)  CV_NONODS,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
real, dimension( ndim, nphase, ncolct ), intent(in)  CT,
integer, intent(in)  NCOLCT,
integer, dimension( cv_nonods + 1 ), intent(in)  FINDCT,
integer, dimension( ncolct ), intent(in)  COLCT 
)

: CV_RHS=CT*U

Here is the caller graph for this function:

◆ ct_mult2()

subroutine matrix_operations::ct_mult2 ( real, dimension( cv_nonods ), intent(inout)  CV_RHS,
real, dimension( ndim, nphase, u_nonods ), intent(in)  U,
integer, intent(in)  CV_NONODS,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
real, dimension( ndim, nphase, ncolct ), intent(in)  CT,
integer, intent(in)  NCOLCT,
integer, dimension( cv_nonods + 1 ), intent(in)  FINDCT,
integer, dimension( ncolct ), intent(in)  COLCT 
)

:CV_RHS=CT*U

Here is the caller graph for this function:

◆ ct_mult_many()

subroutine matrix_operations::ct_mult_many ( real, dimension( nblock, cv_nonods ), intent(inout)  CV_RHS,
real, dimension( nblock, ndim, nphase, u_nonods ), intent(in)  U,
integer, intent(in)  CV_NONODS,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  NBLOCK,
real, dimension( :, :, : ), intent(in)  CT,
integer, intent(in)  NCOLCT,
integer, dimension( : ), intent(in)  FINDCT,
integer, dimension( : ), intent(in)  COLCT 
)

: CV_RHS = CT * U

Here is the caller graph for this function:

◆ ct_mult_with_c()

subroutine matrix_operations::ct_mult_with_c ( real, dimension( : ), intent(inout)  DP,
real, dimension( : ), intent(in)  U_LONG,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
real, dimension( :, :, : ), intent(in)  C,
integer, intent(in)  NCOLC,
integer, dimension( : ), intent(in)  FINDC,
integer, dimension( : ), intent(in)  COLC 
)

: DP = (C)^T U_LONG

Here is the caller graph for this function:

◆ ct_mult_with_c3()

subroutine matrix_operations::ct_mult_with_c3 ( real, dimension( : ), intent(inout)  DP,
real, dimension( :, :, : ), intent(in)  U_ALL,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
real, dimension( :, :, : ), intent(in)  C,
integer, intent(in)  NCOLC,
integer, dimension( : ), intent(in)  FINDC,
integer, dimension( : ), intent(in)  COLC 
)

: DP = (C)^T U_ALL

Here is the caller graph for this function:

◆ ct_mult_with_c_many()

subroutine matrix_operations::ct_mult_with_c_many ( real, dimension( :, : ), intent(inout)  DP,
real, dimension( :, :, :, : ), intent(in)  U_LONG,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
real, dimension( :, :, : ), intent(in)  C,
integer, dimension( : ), intent(in)  FINDC,
integer, dimension( : ), intent(in)  COLC 
)

: DP = (C)^T U_LONG

Here is the caller graph for this function:

◆ mass_matrix_inversion()

subroutine matrix_operations::mass_matrix_inversion ( real, dimension( : , : , : ), intent(inout), contiguous  PIVIT_MAT,
type(multi_dimensions), intent(in)  Mdims,
type(pipe_coords), dimension(:), intent(in)  eles_with_pipe 
)

: Inversion of the mass matrix. If compacted this is much more efficient

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mass_matrix_matvec()

subroutine matrix_operations::mass_matrix_matvec ( real, dimension( ndim * nphase * u_nloc * totele ), intent(inout)  U,
real, dimension( :, :, : ), intent(in), target  BLOCK_MAT,
real, dimension( :, :, : ), intent(in)  CDP,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  TOTELE,
integer, intent(in)  U_NLOC,
integer, dimension( : ), intent(in), target  U_NDGLN 
)

: U = Mass_matrix * Vector (tipically vector is Grad * P + RHS and this is used to obtain the velocity)

Here is the caller graph for this function:

◆ matdmatinv()

subroutine matrix_operations::matdmatinv ( real, dimension( :, : ), intent(in)  DMAT,
real, dimension( :, : ), intent(inout)  DMATINV,
integer, intent(in)  NLOC 
)

calculate DMATINV

Here is the call graph for this function:
Here is the caller graph for this function:

◆ matinv()

subroutine matrix_operations::matinv ( real, dimension( :, : ), intent(inout)  A,
integer, intent(in)  N,
integer, intent(in)  NMAX 
)

: This sub finds the inverse of the matrix A and puts it back in A. MAT, MAT2, X and B are working vectors.

Here is the caller graph for this function:

◆ matinvold()

subroutine matrix_operations::matinvold ( real, dimension( :, : ), intent(inout)  A,
integer, intent(in)  N,
real, dimension( :, : ), intent(inout)  MAT,
real, dimension( : ), intent(inout)  B 
)

: This sub finds the inverse of the matrix A and puts it back in A. MAT, MAT2, X and B are working vectors.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pha_block_mat_vec()

subroutine matrix_operations::pha_block_mat_vec ( real, dimension( : ), intent(inout)  U,
real, dimension( :, :, : ), intent(in), target  BLOCK_MAT,
real, dimension( ndim, nphase, u_nonods ), intent(inout)  CDP,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  TOTELE,
integer, intent(in)  U_NLOC,
integer, dimension( : ), intent(in), target  U_NDGLN 
)

: performs U = BLOCK_MAT * CDP, where block_mat

Here is the caller graph for this function:

◆ pha_block_mat_vec2()

subroutine matrix_operations::pha_block_mat_vec2 ( real, dimension( :, :, : ), intent(inout)  U,
real, dimension( :, :, : ), intent(in), target  BLOCK_MAT,
real, dimension( :, :, : ), intent(in)  CDP,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  TOTELE,
integer, intent(in)  U_NLOC,
integer, dimension( : ), intent(in), target  U_NDGLN 
)

:U = BLOCK_MAT * CDP

◆ pha_block_mat_vec_many()

subroutine matrix_operations::pha_block_mat_vec_many ( real, dimension( :, :, :, : ), intent(inout), target, contiguous  U,
real, dimension( :, : , : ), intent(in), contiguous  BLOCK_MAT,
real, dimension( :, : , :, : ), intent(in), target, contiguous  CDP,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  NBLOCK,
integer, intent(in)  TOTELE,
integer, intent(in)  U_NLOC,
integer, dimension( : ), intent(in)  U_NDGLN 
)

: U = BLOCK_MAT * CDP

◆ pha_block_mat_vec_many2()

subroutine matrix_operations::pha_block_mat_vec_many2 ( real, dimension( :, : ), intent(inout)  U,
real, dimension( :, :, : ), intent(in), target  BLOCK_MAT,
real, dimension( :, : ), intent(in)  CDP,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  NBLOCK,
integer, intent(in)  TOTELE,
integer, intent(in)  U_NLOC,
integer, dimension( : ), intent(in), target  U_NDGLN 
)

: U = BLOCK_MAT * CDP

◆ pha_block_mat_vec_many_reusing()

subroutine matrix_operations::pha_block_mat_vec_many_reusing ( real, dimension( :, : , : ), intent(in), contiguous  BLOCK_MAT,
real, dimension( :, : , :, : ), intent(inout), target, contiguous  CDP,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE,
integer, intent(in)  NBLOCK,
integer, intent(in)  TOTELE,
integer, intent(in)  U_NLOC,
integer, dimension( : ), intent(in)  U_NDGLN 
)

: U = BLOCK_MAT * CDP The difference with PHA_BLOCK_MAT_VEC_MANY is that the input CDP is overwritten with the output

Here is the caller graph for this function:

◆ posinmat()

subroutine matrix_operations::posinmat ( integer, intent(inout)  posmat,
integer, intent(in)  globi,
integer, intent(in)  globj,
integer, dimension( : ), intent(in)  findrm,
integer, dimension( : ), intent(in)  colm 
)

: Find position in matrix POSMAT which has column GLOBJ

Here is the caller graph for this function:

◆ smlinngot()

subroutine matrix_operations::smlinngot ( real, dimension( :, : ), intent(inout)  A,
real, dimension( : ), intent(inout)  X,
real, dimension( : ), intent(in)  B,
integer  NMX,
integer, dimension(:), intent(inout)  IPIV,
logical, intent(in)  GOTDEC 
)

Calculate the inverse using the LU decomposition L can be provided, speeding up the method to O(n)

Here is the caller graph for this function:

◆ ulong_2_uvw()

subroutine matrix_operations::ulong_2_uvw ( real, dimension( : ), intent(inout)  U,
real, dimension( : ), intent(inout)  V,
real, dimension( : ), intent(inout)  W,
real, dimension( : ), intent(in)  UP,
integer, intent(in)  U_NONODS,
integer, intent(in)  NDIM,
integer, intent(in)  NPHASE 
)
Here is the caller graph for this function: