Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/ComputationalModels/BoundaryConditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function _get_bc_func(tags_::Vector{String}, values_, bc_timesteps)
@inbounds for i in eachindex(tags_)

if values_[i] === DirichletCoupling || typeof(values_[i]) <: DirichletCoupling
bc_func_[i] = (Λ) -> (x) -> x
bc_func_[i] = (Λ) -> (x) -> x
else
if isnothing(bc_timesteps[i])
bc_func_[i] = values_[i]
Expand Down Expand Up @@ -97,6 +97,16 @@ struct DirichletBC{A} <: BoundaryCondition
caches = (bc_values)
new{typeof(caches)}(tags_, funcs_, bc_timesteps, caches)
end


function DirichletBC(bc_tags::Vector{String}, bc_values)
@assert(length(bc_tags) == length(bc_values))
bc_timesteps = [Λ -> 1.0 for _ in 1:length(bc_tags)]
tags_, funcs_ = _get_bc_func(bc_tags, bc_values, bc_timesteps)
caches = (bc_values)
new{typeof(caches)}(tags_, funcs_, bc_timesteps, caches)
end

end

function updateBC!(m::DirichletBC, bc_values, bc_timesteps)
Expand Down Expand Up @@ -206,7 +216,7 @@ struct InterpolableBC{A,B,C} <: DirichletCoupling
dim = length(U.space.fe_dof_basis.trian.model.grid.node_coordinates[1])
mask = U.space.dirichlet_dof_tag .== dcmask[1]
vals = U.dirichlet_values[mask]
Interface_coords_ = reshape(vals, dim,:)'
Interface_coords_ = reshape(vals, dim, :)'
coords = VectorValue.(eachrow(Interface_coords_))
v = evaluate(Interpolable(1.0), coords)
bc_values = reduce(vcat, map(x -> get_array(x), v))
Expand All @@ -228,4 +238,3 @@ function InterpolableBC!(U::TrialFESpace, bc::DirichletBC, interface_tags::Strin
return obj
end


6 changes: 3 additions & 3 deletions src/Solvers/NonlinearSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function _solve_nr!(x, A, b, dx, ns, nls, op)

α = linesearch(x, dx, b, op)
x .+= α * dx
if α < 1.0 && Int(log.verbose)>0
println("Activated line-search: $α")
end
# if α < 1.0 && Int(log.verbose)>0
# println("Activated line-search: $α")
# end
# Check convergence for the current residual
# residual!(b, op, x)
res = norm(b)
Expand Down