Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does BoundaryConditions not work? #53

Closed
tyszwh opened this issue Apr 29, 2024 · 4 comments
Closed

Does BoundaryConditions not work? #53

tyszwh opened this issue Apr 29, 2024 · 4 comments

Comments

@tyszwh
Copy link

tyszwh commented Apr 29, 2024

Hi, Prof Boris Kaus
I'm trying to set the initial boundary conditions using Lamem.jl and the bvel_face option doesn't seem to work properly?

Model.BoundaryConditions = BoundaryConditions(  #noslip = [0, 0, 0, 0],
                                                bvel_face         = Right,
                                                bvel_face_out     = -1,
                                                velin_num_periods = 3,
                                                bvel_velin       =  -2.0, 0, 2.0,#
                                                bvel_top         =  0,  #
                                                bvel_bot         =  -60,   #        
                                                open_top_bound     =1,)

The error message is as follows

UndefVarError: `Right` not defined

Stacktrace:
 [1] top-level scope
   @ [~/lamem_model/model_test/compression.ipynb:1](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/~/lamem_model/model_test/compression.ipynb:1)
@boriskaus
Copy link
Member

well Right needs to be a string... "Right"

@tyszwh
Copy link
Author

tyszwh commented Apr 29, 2024

Okay, Thanks for that. I tried single quotes before.

But now it's still having problems.

Model.BoundaryConditions = BoundaryConditions(  #noslip = [0, 0, 0, 0],## No slip lower boundary; the rest is free slip
                                                bvel_face         = "Right",
                                                bvel_face_out     = -1,
                                               # velin_num_periods = 3,
                                                #velin_time_delims = 2,5,
                                                bvel_velin       =  -2.0,# inflow velocity for each time interval(Multiple values required if velinnumperiods>1)
                                                bvel_top         =  0,  #Top coordinate of inflow window
                                                bvel_bot         =  -60,   # Bottom coordinate of inflow window             
                                                #bvel_velbot      =  1,   #bottom inflow velocity for use with bvel_face=CompensatingInflow
                                                #bvel_relax_d            #vert.distance from bvelbot and bveltop over which velocity is reduced linearly
                                                open_top_bound     =1,)

This also seems to be the wrong format, the vector format of bvel_velin

MethodError: Cannot `convert` an object of type 
  Float64 to an object of type 
  Vector

Closest candidates are:
  convert(::Type{Vector}, !Matched::StatsBase.UnitWeights{T}) where T
   @ StatsBase [~/.julia/packages/StatsBase/ebrT3/src/weights.jl:317](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/~/.julia/packages/StatsBase/ebrT3/src/weights.jl:317)
  convert(::Type{Vector}, !Matched::StatsBase.AbstractWeights)
   @ StatsBase [~/.julia/packages/StatsBase/ebrT3/src/weights.jl:35](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/~/.julia/packages/StatsBase/ebrT3/src/weights.jl:35)
  convert(::Type{T}, !Matched::T) where T
   @ Base Base.jl:84
  ...


Stacktrace:
 [1] convert(::Type{Union{Nothing, Vector}}, x::Float64)
   @ Base [./some.jl:37](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/some.jl:37)
 [2] BoundaryConditions(noslip::Vector{Int64}, open_top_bound::Int64, temp_top::Float64, temp_bot::Float64, exx_num_periods::Int64, exx_time_delims::Vector{Float64}, exx_strain_rates::Vector{Float64}, eyy_num_periods::Int64, eyy_time_delims::Vector{Float64}, eyy_strain_rates::Vector{Float64}, exy_num_periods::Int64, exy_time_delims::Vector{Float64}, exy_strain_rates::Vector{Float64}, exz_num_periods::Int64, exz_time_delims::Vector{Float64}, exz_strain_rates::Vector{Float64}, eyz_num_periods::Int64, eyz_time_delims::Vector{Float64}, eyz_strain_rates::Vector{Float64}, bg_ref_point::Vector{Float64}, VelocityBoxes::Vector{Any}, BCBlocks::Vector{Any}, VelCylinders::Vector{Any}, bvel_face::String, bvel_face_out::Int64, bvel_bot::Int64, bvel_top::Int64, velin_num_periods::Nothing, velin_time_delims::Nothing, bvel_velin::Float64, bvel_velout::Nothing, bvel_relax_d::Nothing, bvel_velbot::Nothing, bvel_veltop::Nothing, bvel_temperature_inflow::Nothing, bvel_thermal_age::Nothing, bvel_temperature_mantle::Nothing, bvel_temperature_top::Nothing, bvel_temperature_constant::Nothing, bvel_num_phase::Nothing, bvel_phase::Nothing, bvel_phase_interval::Nothing, open_bot_bound::Nothing, permeable_phase_inflow::Nothing, fix_phase::Nothing, fix_cell::Nothing, fix_cell_file::Nothing, temp_bot_num_periods::Nothing, temp_bot_time_delim::Nothing, Plume_InflowBoundary::Nothing, Plume_Type::Nothing, Plume_Dimension::Nothing, Plume_areaFrac::Nothing, Plume_Phase::Nothing, Plume_Depth::Nothing, Plume_Mantle_Phase::Nothing, Plume_Temperature::Nothing, Plume_Inflow_Velocity::Nothing, Plume_VelocityType::Nothing, Plume_Center::Nothing, Plume_Radius::Nothing, Plume_Phase_Mantle::Nothing, pres_top::Nothing, pres_bot::Nothing, init_pres::Nothing, init_temp::Nothing)
   @ LaMEM.LaMEM_Model [~/.julia/packages/LaMEM/bw6yg/src/LaMEM_ModelGeneration/BoundaryConditions.jl:259](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/~/.julia/packages/LaMEM/bw6yg/src/LaMEM_ModelGeneration/BoundaryConditions.jl:259)
 [3] BoundaryConditions(; noslip::Vector{Int64}, open_top_bound::Int64, temp_top::Float64, temp_bot::Float64, exx_num_periods::Int64, exx_time_delims::Vector{Float64}, exx_strain_rates::Vector{Float64}, eyy_num_periods::Int64, eyy_time_delims::Vector{Float64}, eyy_strain_rates::Vector{Float64}, exy_num_periods::Int64, exy_time_delims::Vector{Float64}, exy_strain_rates::Vector{Float64}, exz_num_periods::Int64, exz_time_delims::Vector{Float64}, exz_strain_rates::Vector{Float64}, eyz_num_periods::Int64, eyz_time_delims::Vector{Float64}, eyz_strain_rates::Vector{Float64}, bg_ref_point::Vector{Float64}, VelocityBoxes::Vector{Any}, BCBlocks::Vector{Any}, VelCylinders::Vector{Any}, bvel_face::String, bvel_face_out::Int64, bvel_bot::Int64, bvel_top::Int64, velin_num_periods::Nothing, velin_time_delims::Nothing, bvel_velin::Float64, bvel_velout::Nothing, bvel_relax_d::Nothing, bvel_velbot::Nothing, bvel_veltop::Nothing, bvel_temperature_inflow::Nothing, bvel_thermal_age::Nothing, bvel_temperature_mantle::Nothing, bvel_temperature_top::Nothing, bvel_temperature_constant::Nothing, bvel_num_phase::Nothing, bvel_phase::Nothing, bvel_phase_interval::Nothing, open_bot_bound::Nothing, permeable_phase_inflow::Nothing, fix_phase::Nothing, fix_cell::Nothing, fix_cell_file::Nothing, temp_bot_num_periods::Nothing, temp_bot_time_delim::Nothing, Plume_InflowBoundary::Nothing, Plume_Type::Nothing, Plume_Dimension::Nothing, Plume_areaFrac::Nothing, Plume_Phase::Nothing, Plume_Depth::Nothing, Plume_Mantle_Phase::Nothing, Plume_Temperature::Nothing, Plume_Inflow_Velocity::Nothing, Plume_VelocityType::Nothing, Plume_Center::Nothing, Plume_Radius::Nothing, Plume_Phase_Mantle::Nothing, pres_top::Nothing, pres_bot::Nothing, init_pres::Nothing, init_temp::Nothing)
   @ LaMEM.LaMEM_Model [~/.julia/packages/LaMEM/bw6yg/src/LaMEM_ModelGeneration/BoundaryConditions.jl:257](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/~/.julia/packages/LaMEM/bw6yg/src/LaMEM_ModelGeneration/BoundaryConditions.jl:257)
 [4] top-level scope
   @ [~/lamem_model/model_test/compression.ipynb:1](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/tysz/lamem_model/model_test/~/lamem_model/model_test/compression.ipynb:1)

Another question is how to set the inflow/outflow velocity on both sides of the boundary, but the position of the settings on both sides (e.g. left or right) is not symmetrical. In other words, how to set the inflow/outflow boundary conditions separately for different boundaries.

@boriskaus
Copy link
Member

As the error message states, bvel_velin should be provided as a vector, which can also be seen here in the implementation of this code.

Non-symmetrical inflow boundary conditions are not supported at the moment. You are welcome to make a pull request to LaMEM to add this.

@tyszwh
Copy link
Author

tyszwh commented Apr 29, 2024

Hi, Prof Boris Kaus
Resolved. Thank you for your help for newcomers. What you mean is that LaMem itself does not support setting boundary conditions individually. So julia wrapping doesn't exist.

@tyszwh tyszwh closed this as completed Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants