Skip to content

Commit

Permalink
Merge pull request #12 from DJ4Earth/add_scale_output
Browse files Browse the repository at this point in the history
Add scale output depend on the result enum
  • Loading branch information
Cheng Gong authored Apr 12, 2024
2 parents 4f5dd62 + b565ad8 commit 0fe8dfb
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/core/modules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,15 @@ function OutputResultsx(femmodel::FemModel, md::model, solutionkey::Symbol)# {{{
for i in 1:length(femmodel.results)
result = femmodel.results[i]
step = femmodel.results[i].step
(output[step])[EnumToString(result.enum)] = result.value
scale = OutputEnumToScale(md, result.enum)
(output[step])[EnumToString(result.enum)] = result.value .* scale
end
else
output = Dict()
for i in 1:length(femmodel.results)
result = femmodel.results[i]
output[EnumToString(result.enum)] = result.value
scale = OutputEnumToScale(md, result.enum)
output[EnumToString(result.enum)] = result.value .* scale
end
end

Expand Down Expand Up @@ -421,3 +423,14 @@ function GetMaskOfIceVerticesLSMx0(femmodel::FemModel) #{{{

return nothing
end#}}}
function OutputEnumToScale(md::model, result::IssmEnum) #{{{
if (result == VxEnum) scale = md.constants.yts
elseif (result == VyEnum) scale = md.constants.yts
elseif (result == VzEnum) scale = md.constants.yts
elseif (result == VelEnum) scale = md.constants.yts
elseif (result == CalvingCalvingrateEnum) scale = md.constants.yts
else scale = 1.0
end

return scale
end#}}}

0 comments on commit 0fe8dfb

Please sign in to comment.