Permalink
Browse files

Fix sign when adding Neumann integrated values for free RHS values

  • Loading branch information...
1 parent 7af1abd commit 54fecf97647d2fcbb6aedcc997c56846f0628cf8 @adamreeve committed May 30, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/solver_routines.f90
View
@@ -10388,7 +10388,7 @@ SUBROUTINE SOLVER_MATRICES_DYNAMIC_ASSEMBLE(SOLVER,SELECTION_TYPE,ERR,ERROR,*)
CALL FIELD_PARAMETER_SET_GET_LOCAL_DOF(RHS_VARIABLE%FIELD,RHS_VARIABLE_TYPE, &
& FIELD_INTEGRATED_NEUMANN_SET_TYPE,rhs_variable_dof,RHS_INTEGRATED_VALUE, &
& ERR,ERROR,*999)
- RHS_VALUE=RHS_VALUE+RHS_INTEGRATED_VALUE
+ RHS_VALUE=RHS_VALUE-RHS_INTEGRATED_VALUE
@chrispbradley

chrispbradley May 31, 2012

Why is it that we are subtracting here? Isn't b=f + Nq???

@adamreeve

adamreeve May 31, 2012

Owner

Yes but here, RHS_VALUE is taken from the equations set RHS, rather than the RHS field directly, so is already been negated.

@chrispbradley

chrispbradley May 31, 2012

Yes, but isn't the equations set rhs on the rhs and thus +?

@adamreeve

adamreeve May 31, 2012

Owner

It looks like the "right hand side" field variable is on the left hand side, and is moved to the solver right hand side. Whereas the equations set right hand side is already on the right hand side. In the RHS fixed DOF case, -1 * the right hand side field value is put on the right hand side of the solver.

If I reverse the - and + signs I definitely get the normal derivative in the wrong direction.

@chrispbradley

chrispbradley May 31, 2012

Hmm, is this for a nonlinear problem? For the nonlinear case we are solving f = r - b = 0. Otherwise we should be dealing with rhs vectors on the rhs? Maybe some comments are required to explain things here?

@adamreeve

adamreeve May 31, 2012

Owner

I've been testing with linear problems, but should check it with nonlinear too. This is in solver_matrices_static_assemble and solver_matrices_dynamic_assemble so should be general for both linear and nonlinear. It looks like this part might be wrong then:

VALUE=-1.0_DP*RHS_VALUE*row_coupling_coefficient
CALL DISTRIBUTED_VECTOR_VALUES_ADD(SOLVER_RHS_VECTOR,solver_row_number,VALUE, &
  & ERR,ERROR,*999)

I haven't tested any dynamic examples but the dynamic case doesn't actually have the negative sign here.

END IF
!Loop over the solver rows associated with this equations set row
DO solver_row_idx=1,SOLVER_MAPPING%EQUATIONS_SET_TO_SOLVER_MAP(equations_set_idx)% &
@@ -11518,7 +11518,7 @@ SUBROUTINE SOLVER_MATRICES_STATIC_ASSEMBLE(SOLVER,SELECTION_TYPE,ERR,ERROR,*)
CALL FIELD_PARAMETER_SET_GET_LOCAL_DOF(RHS_VARIABLE%FIELD,RHS_VARIABLE_TYPE, &
& FIELD_INTEGRATED_NEUMANN_SET_TYPE,rhs_variable_dof,RHS_INTEGRATED_VALUE, &
& ERR,ERROR,*999)
- RHS_VALUE=RHS_VALUE+RHS_INTEGRATED_VALUE
+ RHS_VALUE=RHS_VALUE-RHS_INTEGRATED_VALUE
END IF
!Loop over the solver rows associated with this equations set row
DO solver_row_idx=1,SOLVER_MAPPING%EQUATIONS_SET_TO_SOLVER_MAP(equations_set_idx)% &

0 comments on commit 54fecf9

Please sign in to comment.