This subroutine appends the list of meshInfo variables (e.g. element volume, element volume fraction, treeID, ... )
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_varSys_type), | intent(inout) | :: | varSys |
global variable system to which meshInfoVar to be appended |
subroutine tem_varSys_append_meshInfoVar( varSys ) ! -------------------------------------------------------------------- ! !> global variable system to which meshInfoVar to be appended type(tem_varSys_type), intent(inout) :: varSys ! -------------------------------------------------------------------- ! integer :: iVar, addedPos, nComponents logical :: wasAdded procedure(tem_varSys_proc_point), pointer :: get_point => NULL() procedure(tem_varSys_proc_element), pointer :: get_element => NULL() procedure(tem_varSys_proc_setParams), pointer :: set_params => null() procedure(tem_varSys_proc_getParams), pointer :: get_params => null() procedure(tem_varSys_proc_setupIndices), pointer :: & & setup_indices => null() procedure(tem_varSys_proc_getValOfIndex), pointer :: & & get_valOfIndex => null() ! Mesh info variables integer :: nMeshVars character(len=labelLen), allocatable :: meshInfoVar(:) ! -------------------------------------------------------------------- ! write(logUnit(5),*) 'Append meshInfo variables to varSys' nMeshVars = 9 allocate(meshInfoVar(nMeshVars)) meshInfoVar = [ 'treeid ', 'process ', & & 'weight ', & & 'elem_vol ', 'vol_frac ', & & 'level ', 'solidified ', & & 'has_ibm ', 'has_sendhalos' ] do iVar = 1, nMeshVars ! all meshInfo variables are scalar. ! If not change nComp for that variable nComponents = 1 select case( trim(adjustl(meshInfoVar(iVar))) ) case ('treeid') get_element => getTreeID case ('weight') get_element => getElemWeight case ('process') get_element => getMPIproc case ('elem_vol') get_element => deriveElemVol case ('vol_frac') get_element => deriveVolFrac case ('solidified', 'has_ibm', 'has_sendhalos') get_element => deriveProperty case ('level') get_element => deriveLevel case default write(logUnit(1),*) 'WARNING: Cannot append meshInfo variable: ' & & // trim(meshInfoVar(iVar)) write(logUnit(1),*) 'without variable operation routine' cycle !go to next variable end select ! append variable to varSys call tem_varSys_append_derVar( me = varSys, & & varName = trim(meshInfoVar(iVar)), & & operType = 'st_fun', & & nComponents = nComponents, & & method_data = c_null_ptr, & & get_point = get_point, & & get_element = get_element, & & set_params = set_params, & & get_params = get_params, & & setup_indices = setup_indices, & & get_valOfIndex = get_valOfIndex, & & pos = addedPos, & & wasAdded = wasAdded ) if (wasAdded) then write(logUnit(10),*) ' Appended variable:'//trim(meshInfoVar(iVar)) else if (addedpos < 1) then write(logUnit(1),*) 'Error: variable '//trim(meshInfoVar(iVar)) & & // ' is not added to variable system' end if end do ! iVar end subroutine tem_varSys_append_meshInfoVar