| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e3f7a54 commit 5963c4c
57 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | ! Copyright (C) 2006 Imperial College London and others. | |
| 2 | - ! | ||
| 2 | + ! | ||
| 3 | 3 | ! Please see the AUTHORS file in the main source directory for a full list | |
| 4 | 4 | ! of copyright holders. | |
| 5 | 5 | ! | |
@@ -9,7 +9,7 @@ | |||
| 9 | 9 | ! Imperial College London | |
| 10 | 10 | ! | |
| 11 | 11 | ! amcgsoftware@imperial.ac.uk | |
| 12 | - ! | ||
| 12 | + ! | ||
| 13 | 13 | ! This library is free software; you can redistribute it and/or | |
| 14 | 14 | ! modify it under the terms of the GNU Lesser General Public | |
| 15 | 15 | ! License as published by the Free Software Foundation, | |
@@ -45,10 +45,10 @@ module assemble_CMC | |||
| 45 | 45 | use field_options | |
| 46 | 46 | use fefields | |
| 47 | 47 | ||
| 48 | - implicit none | ||
| 48 | + implicit none | ||
| 49 | 49 | ||
| 50 | 50 | private | |
| 51 | - | ||
| 51 | + | ||
| 52 | 52 | public :: assemble_cmc_dg, assemble_masslumped_cmc, & | |
| 53 | 53 | assemble_masslumped_ctm, repair_stiff_nodes, zero_stiff_nodes, & | |
| 54 | 54 | assemble_diagonal_schur, assemble_scaled_pressure_mass_matrix | |
@@ -70,21 +70,21 @@ subroutine assemble_cmc_dg(CMC, CTP, CT, inverse_mass) | |||
| 70 | 70 | integer :: dim, dim2 | |
| 71 | 71 | ||
| 72 | 72 | call zero(CMC) | |
| 73 | - | ||
| 73 | + | ||
| 74 | 74 | if(inverse_mass%diagonal) then | |
| 75 | 75 | ||
| 76 | 76 | do dim=1, blocks(CT,2) | |
| 77 | - | ||
| 77 | + | ||
| 78 | 78 | ! This is a borrowed reference so no need to deallocate. | |
| 79 | 79 | CT_block=block(CT, 1, dim) | |
| 80 | 80 | CTP_block=block(CTP, 1, dim) | |
| 81 | - | ||
| 81 | + | ||
| 82 | 82 | CM=matmul_T(CTP_block, block(inverse_mass,dim,dim), CT%sparsity) | |
| 83 | - | ||
| 83 | + | ||
| 84 | 84 | CMC_tmp=matmul_T(CM, CT_block, model=CMC%sparsity) | |
| 85 | - | ||
| 85 | + | ||
| 86 | 86 | call addto(CMC, CMC_tmp) | |
| 87 | - | ||
| 87 | + | ||
| 88 | 88 | call deallocate(CM) | |
| 89 | 89 | call deallocate(CMC_tmp) | |
| 90 | 90 | ||
@@ -94,17 +94,17 @@ subroutine assemble_cmc_dg(CMC, CTP, CT, inverse_mass) | |||
| 94 | 94 | ||
| 95 | 95 | do dim=1, blocks(CT,2) | |
| 96 | 96 | do dim2 = 1, blocks(CT,2) | |
| 97 | - | ||
| 97 | + | ||
| 98 | 98 | ! This is a borrowed reference so no need to deallocate. | |
| 99 | 99 | CT_block=block(CT, 1, dim) | |
| 100 | 100 | CTP_block=block(CTP, 1, dim2) | |
| 101 | - | ||
| 101 | + | ||
| 102 | 102 | CM=matmul_T(CTP_block, block(inverse_mass,dim2,dim), CT%sparsity) | |
| 103 | - | ||
| 103 | + | ||
| 104 | 104 | CMC_tmp=matmul_T(CM, CT_block, model=CMC%sparsity) | |
| 105 | - | ||
| 105 | + | ||
| 106 | 106 | call addto(CMC, CMC_tmp) | |
| 107 | - | ||
| 107 | + | ||
| 108 | 108 | call deallocate(CM) | |
| 109 | 109 | call deallocate(CMC_tmp) | |
| 110 | 110 | end do | |
@@ -129,13 +129,13 @@ subroutine assemble_masslumped_cmc(cmc_m, ctp_m, inverse_masslump, ct_m) | |||
| 129 | 129 | ewrite(1,*) 'Entering assemble_masslumped_cmc' | |
| 130 | 130 | ||
| 131 | 131 | call mult_div_vector_div_T(cmc_m, ctp_m, inverse_masslump, ct_m) | |
| 132 | - | ||
| 132 | + | ||
| 133 | 133 | ewrite_minmax(cmc_m) | |
| 134 | 134 | ||
| 135 | 135 | end subroutine assemble_masslumped_cmc | |
| 136 | 136 | ||
| 137 | 137 | subroutine assemble_diagonal_schur(schur_diagonal_matrix,u,inner_m,ctp_m,ct_m) | |
| 138 | - !!< Assemble the matrix C_P^T * [(Big_m)_diagonal]^-1 * C. | ||
| 138 | + !!< Assemble the matrix C_P^T * [(Big_m)_diagonal]^-1 * C. | ||
| 139 | 139 | !!< This is used as a preconditioner for the full projection solve | |
| 140 | 140 | !!< when using the full momentum matrix. | |
| 141 | 141 | ||
@@ -144,14 +144,12 @@ subroutine assemble_diagonal_schur(schur_diagonal_matrix,u,inner_m,ctp_m,ct_m) | |||
| 144 | 144 | ! Divergence matrices: | |
| 145 | 145 | type(block_csr_matrix), intent(in) :: ctp_m, ct_m | |
| 146 | 146 | ! Inner matrix of Schur complement: | |
| 147 | - type(petsc_csr_matrix), intent(inout) :: inner_m | ||
| 147 | + type(petsc_csr_matrix), intent(inout) :: inner_m | ||
| 148 | 148 | ! Product matrix: | |
| 149 | 149 | type(csr_matrix), intent(inout):: schur_diagonal_matrix | |
| 150 | 150 | ! Diagonal of inner_m - required to set up preconditioner matrix for Stokes problems | |
| 151 | 151 | ! (i.e. DiagonalSchurComplement): | |
| 152 | - type(vector_field) :: inner_m_diagonal | ||
| 153 | - | ||
| 154 | - integer :: i | ||
| 152 | + type(vector_field) :: inner_m_diagonal | ||
| 155 | 153 | ||
| 156 | 154 | ewrite(1,*) 'Entering assemble_diagonal_schur' | |
| 157 | 155 | ||
@@ -180,7 +178,7 @@ subroutine assemble_scaled_pressure_mass_matrix(state, scaled_pressure_mass_matr | |||
| 180 | 178 | ! This routine assembles the scaled_pressure_mass_matrix at the | |
| 181 | 179 | ! quadrature points. It is scaled by the inverse of viscosity. | |
| 182 | 180 | ||
| 183 | - type(state_type), intent(in) :: state | ||
| 181 | + type(state_type), intent(in) :: state | ||
| 184 | 182 | ! Scaled pressure mass matrix - already allocated in Momentum_Eq: | |
| 185 | 183 | type(csr_matrix), intent(inout) :: scaled_pressure_mass_matrix | |
| 186 | 184 | ||
@@ -189,7 +187,7 @@ subroutine assemble_scaled_pressure_mass_matrix(state, scaled_pressure_mass_matr | |||
| 189 | 187 | real, intent(in) :: dt | |
| 190 | 188 | ||
| 191 | 189 | ! Viscosity tensor: | |
| 192 | - type(tensor_field), pointer :: viscosity | ||
| 190 | + type(tensor_field), pointer :: viscosity | ||
| 193 | 191 | ! Viscosity component: | |
| 194 | 192 | type(scalar_field) :: viscosity_component | |
| 195 | 193 | ! Positions: | |
@@ -202,7 +200,7 @@ subroutine assemble_scaled_pressure_mass_matrix(state, scaled_pressure_mass_matr | |||
| 202 | 200 | real, dimension(:,:), allocatable :: mass_matrix | |
| 203 | 201 | real, dimension(:), allocatable :: mu_gi | |
| 204 | 202 | ||
| 205 | - ewrite(1,*) 'Entering assemble_scaled_pressure_mass_matrix' | ||
| 203 | + ewrite(1,*) 'Entering assemble_scaled_pressure_mass_matrix' | ||
| 206 | 204 | ||
| 207 | 205 | ! Positions: | |
| 208 | 206 | positions => extract_vector_field(state, "Coordinate") | |
@@ -217,7 +215,7 @@ subroutine assemble_scaled_pressure_mass_matrix(state, scaled_pressure_mass_matr | |||
| 217 | 215 | allocate(detwei(ele_ngi(p_mesh, 1)), & | |
| 218 | 216 | mass_matrix(ele_loc(p_mesh, 1), ele_loc(p_mesh, 1)), & | |
| 219 | 217 | mu_gi(ele_ngi(viscosity_component, 1))) | |
| 220 | - | ||
| 218 | + | ||
| 221 | 219 | call zero(scaled_pressure_mass_matrix) | |
| 222 | 220 | ||
| 223 | 221 | do ele = 1, ele_count(p_mesh) | |
@@ -234,25 +232,25 @@ subroutine assemble_scaled_pressure_mass_matrix(state, scaled_pressure_mass_matr | |||
| 234 | 232 | deallocate(detwei, mass_matrix, mu_gi) | |
| 235 | 233 | ||
| 236 | 234 | end subroutine assemble_scaled_pressure_mass_matrix | |
| 237 | - | ||
| 235 | + | ||
| 238 | 236 | subroutine repair_stiff_nodes(cmc_m, stiff_nodes_list) | |
| 239 | - | ||
| 237 | + | ||
| 240 | 238 | type(csr_matrix), intent(inout) :: cmc_m | |
| 241 | 239 | type(ilist), intent(inout) :: stiff_nodes_list | |
| 242 | - | ||
| 240 | + | ||
| 243 | 241 | integer :: row | |
| 244 | 242 | real, pointer :: row_diag | |
| 245 | 243 | integer, dimension(:), pointer :: row_m | |
| 246 | 244 | real, dimension(:), pointer :: row_val | |
| 247 | 245 | real :: tolerance | |
| 248 | - | ||
| 246 | + | ||
| 249 | 247 | ewrite(1,*) 'in repair_stiff_nodes()' | |
| 250 | - | ||
| 248 | + | ||
| 251 | 249 | tolerance = maxval(cmc_m%val)*epsilon(0.0) | |
| 252 | 250 | ewrite(2,*) 'tolerance = ', tolerance | |
| 253 | - | ||
| 251 | + | ||
| 254 | 252 | call flush_list(stiff_nodes_list) | |
| 255 | - | ||
| 253 | + | ||
| 256 | 254 | do row = 1, size(cmc_m, 1) | |
| 257 | 255 | row_diag=>diag_val_ptr(cmc_m, row) | |
| 258 | 256 | row_m=>row_m_ptr(cmc_m, row) | |
@@ -265,27 +263,27 @@ subroutine repair_stiff_nodes(cmc_m, stiff_nodes_list) | |||
| 265 | 263 | call insert(stiff_nodes_list, row) | |
| 266 | 264 | end if | |
| 267 | 265 | end do | |
| 268 | - | ||
| 266 | + | ||
| 269 | 267 | call print_list(stiff_nodes_list, 2) | |
| 270 | 268 | ||
| 271 | 269 | end subroutine repair_stiff_nodes | |
| 272 | - | ||
| 270 | + | ||
| 273 | 271 | subroutine zero_stiff_nodes(rhs, stiff_nodes_list) | |
| 274 | - | ||
| 272 | + | ||
| 275 | 273 | type(scalar_field), intent(inout) :: rhs | |
| 276 | 274 | type(ilist), intent(in) :: stiff_nodes_list | |
| 277 | - | ||
| 275 | + | ||
| 278 | 276 | real, dimension(:), pointer :: row_val | |
| 279 | - | ||
| 277 | + | ||
| 280 | 278 | ewrite(1,*) 'in zero_stiff_nodes()' | |
| 281 | - | ||
| 279 | + | ||
| 282 | 280 | if(stiff_nodes_list%length>0) then | |
| 283 | 281 | ewrite(2,*) 'before node_val = ', node_val(rhs, list2vector(stiff_nodes_list)) | |
| 284 | 282 | call set(rhs, list2vector(stiff_nodes_list), spread(0.0, 1, stiff_nodes_list%length)) | |
| 285 | 283 | end if | |
| 286 | 284 | ||
| 287 | 285 | end subroutine zero_stiff_nodes | |
| 288 | - | ||
| 286 | + | ||
| 289 | 287 | subroutine assemble_masslumped_ctm(ctm_m, ctp_m, masslump) | |
| 290 | 288 | !!< Assemble the matrix C_P^T M_l^{-1} | |
| 291 | 289 | !!< This currently does not support rotations. | |
@@ -320,5 +318,5 @@ subroutine assemble_masslumped_ctm(ctm_m, ctp_m, masslump) | |||
| 320 | 318 | ewrite_minmax(ctm_m) | |
| 321 | 319 | ||
| 322 | 320 | end subroutine assemble_masslumped_ctm | |
| 323 | - | ||
| 321 | + | ||
| 324 | 322 | end module assemble_cmc | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,7 +49,7 @@ subroutine calculate_drainage_source_absor(state) | |||
| 49 | 49 | ||
| 50 | 50 | type(state_type), intent(inout) :: state | |
| 51 | 51 | ||
| 52 | - integer :: i, stat | ||
| 52 | + integer :: i | ||
| 53 | 53 | type(vector_field), pointer :: K1, foamvel, liquidvelocity, liqcontentvel, source, absor | |
| 54 | 54 | type(scalar_field), pointer :: p, liquidcontent, K2 | |
| 55 | 55 | ||
@@ -79,7 +79,7 @@ subroutine calculate_drainage_source_absor(state) | |||
| 79 | 79 | liquidvelocity => extract_vector_field(state,'Velocity') | |
| 80 | 80 | call zero(liqcontentvel) | |
| 81 | 81 | call allocate(rho_remap, liquidvelocity%mesh, 'RemappedLiquidContent') | |
| 82 | - call remap_field(liquidcontent, rho_remap) | ||
| 82 | + call remap_field(liquidcontent, rho_remap) | ||
| 83 | 83 | do i=1, node_count(liqcontentvel) | |
| 84 | 84 | call set(liqcontentvel, i, ( node_val(rho_remap, i)*node_val(liquidvelocity, i) ) ) | |
| 85 | 85 | enddo | |
@@ -93,14 +93,14 @@ subroutine calculate_drainage_source_absor(state) | |||
| 93 | 93 | source => extract_vector_field(state,'VelocitySource') | |
| 94 | 94 | if (have_option(trim(source%option_path)//'/diagnostic')) then | |
| 95 | 95 | call get_option(trim(p%option_path)//'/prognostic/atmospheric_pressure', & | |
| 96 | - atmospheric_pressure, default=0.0) | ||
| 96 | + atmospheric_pressure, default=0.0) | ||
| 97 | 97 | call zero(source) | |
| 98 | 98 | ||
| 99 | 99 | call allocate(p_remap, source%mesh, 'RemappedPressure') | |
| 100 | 100 | call allocate(K1_remap, source%dim, source%mesh, 'RemappedK1') | |
| 101 | 101 | call allocate(K2_remap, source%mesh, 'RemappedK2') | |
| 102 | 102 | call allocate(foamvel_remap, source%dim, source%mesh, 'RemappedFoamVelocity') | |
| 103 | - call remap_field(p, p_remap) | ||
| 103 | + call remap_field(p, p_remap) | ||
| 104 | 104 | call remap_field(K1, K1_remap) | |
| 105 | 105 | call remap_field(K2, K2_remap) | |
| 106 | 106 | call remap_field(foamvel, foamvel_remap) | |
@@ -127,9 +127,9 @@ subroutine calculate_drainage_source_absor(state) | |||
| 127 | 127 | call allocate(p_remap, absor%mesh, 'RemappedPressure') | |
| 128 | 128 | call allocate(K2_remap, source%mesh, 'RemappedK2') | |
| 129 | 129 | call remap_field(p, p_remap) | |
| 130 | - call remap_field(K2, K2_remap) | ||
| 130 | + call remap_field(K2, K2_remap) | ||
| 131 | 131 | ||
| 132 | - allocate (absor_val(absor%dim)) | ||
| 132 | + allocate (absor_val(absor%dim)) | ||
| 133 | 133 | ||
| 134 | 134 | do i=1, node_count(absor) | |
| 135 | 135 | absor_val = (1/node_val(K2_remap, i))*(node_val(p_remap, i)+atmospheric_pressure )**0.5 | |
@@ -146,7 +146,3 @@ subroutine calculate_drainage_source_absor(state) | |||
| 146 | 146 | end subroutine calculate_drainage_source_absor | |
| 147 | 147 | ||
| 148 | 148 | end module foam_drainage | |
| 149 | - | ||
| 150 | - | ||
| 151 | - | ||
| 152 | - | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -288,16 +288,15 @@ subroutine calculate_foam_velocity(state, foamvel) | |||
| 288 | 288 | ||
| 289 | 289 | type(state_type), intent(inout) :: state | |
| 290 | 290 | type(vector_field), pointer, intent(out) :: foamvel | |
| 291 | - type(vector_field), pointer :: liquidvelocity | ||
| 292 | 291 | type(scalar_field), pointer :: field | |
| 293 | 292 | type(csr_sparsity) :: gradient_sparsity | |
| 294 | 293 | type(block_csr_matrix) :: C_m | |
| 295 | 294 | type(csr_sparsity) :: mass_sparsity | |
| 296 | 295 | type(csr_matrix) :: mass | |
| 297 | 296 | type(vector_field) :: cfield | |
| 298 | 297 | ||
| 299 | - integer :: i, stat | ||
| 300 | - | ||
| 298 | + integer :: i | ||
| 299 | + | ||
| 301 | 300 | foamvel => extract_vector_field(state, foamvel_name) | |
| 302 | 301 | if (have_option(trim(foamvel%option_path)//'/diagnostic')) then | |
| 303 | 302 | field=>extract_scalar_field(state, "FoamVelocityPotential") | |
@@ -344,5 +343,3 @@ end subroutine calculate_foam_velocity | |||
| 344 | 343 | ||
| 345 | 344 | ||
| 346 | 345 | end module foam_flow_module | |
| 347 | - | ||
| 348 | - | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments