Skip to content

Commit

Permalink
Merge pull request #5 from mvertens/feature/fix_sourcemods
Browse files Browse the repository at this point in the history
fix sourcemods capability and pass hstokes back to mediator
  • Loading branch information
mvertens authored May 25, 2023
2 parents a59c6a0 + f22db07 commit 3734e3e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
9 changes: 5 additions & 4 deletions model/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ message(STATUS "list of switch files is : ${switch_files}")
# Now check in SourceMods to see if the file should be used instead
#-------------------------
list(APPEND srcfiles ${ftn_src} ${switch_files})
foreach(file srcfiles )
if(EXISTS "${CASEROOT}/SourceMods/src.ww3/${file}")
foreach(file ${srcfiles} )
if(EXISTS "${CASEROOT}/SourceMods/src.ww3dev/${file}")
message("Using ${file} from ${CASEROOT}/SourceMods/src.ww3dev")
list(REMOVE_ITEM srcfiles ${file})
list(APPEND srcfiles "${CASEROOT}/SourceMods/src.dww3/${file}")
message("Using ${file} from ${CASEROOT}/SourceMods/src.ww3")
list(APPEND srcfiles "${CASEROOT}/SourceMods/src.ww3dev/${file}")
message(STATUS "Using ${file} from ${CASEROOT}/SourceMods/src.ww3dev")
endif()
endforeach()

Expand Down
20 changes: 18 additions & 2 deletions model/src/wav_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ subroutine advertise_fields(importState, ExportState, flds_scalar_name, rc)
call fldlist_add(fldsFrWav_num, fldsFrWav, 'Sw_lamult' )
call fldlist_add(fldsFrWav_num, fldsFrWav, 'Sw_ustokes')
call fldlist_add(fldsFrWav_num, fldsFrWav, 'Sw_vstokes')
!call fldlist_add(fldsFrWav_num, fldsFrWav, 'Sw_hstokes')
call fldlist_add(fldsFrWav_num, fldsFrWav, 'Sw_hstokes')
else
call fldlist_add(fldsFrWav_num, fldsFrWav, 'Sw_z0')
end if
Expand Down Expand Up @@ -588,7 +588,7 @@ subroutine export_fields (gcomp, rc)
use w3gdatmd , only : nseal, mapsf, MAPSTA, USSPF, NK, w3setg
use w3iogomd , only : CALC_U3STOKES
#ifdef W3_CESMCOUPLED
use w3adatmd , only : LAMULT
use w3adatmd , only : LAMULT, LASLPJ
#else
use wmmdatmd , only : mdse, mdst, wmsetm
#endif
Expand Down Expand Up @@ -618,6 +618,7 @@ subroutine export_fields (gcomp, rc)
real(r8), pointer :: sw_lamult(:)
real(r8), pointer :: sw_ustokes(:)
real(r8), pointer :: sw_vstokes(:)
real(r8), pointer :: sw_hstokes(:)

! d2 is location, d1 is frequency - nwav_elev_spectrum frequencies will be used
real(r8), pointer :: wave_elevation_spectrum(:,:)
Expand Down Expand Up @@ -692,6 +693,21 @@ subroutine export_fields (gcomp, rc)
endif
enddo
end if
if (state_fldchk(exportState, 'Sw_hstokes')) then
call state_getfldptr(exportState, 'Sw_hstokes', sw_hstokes, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
sw_hstokes(:) = fillvalue
do jsea=1, nseal_cpl
call init_get_isea(isea, jsea)
ix = mapsf(isea,1)
iy = mapsf(isea,2)
if (mapsta(iy,ix) == 1) then
sw_hstokes(jsea) = LASLPJ(jsea)
else
sw_hstokes(jsea) = 0.
endif
enddo
end if

if (state_fldchk(exportState, 'Sw_ch')) then
call state_getfldptr(exportState, 'charno', charno, rc=rc)
Expand Down

0 comments on commit 3734e3e

Please sign in to comment.