Skip to content

Commit

Permalink
Fixed macro-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Nov 18, 2024
1 parent dc0daae commit 73848c6
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/Solvers/badia2024.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function Badia2024Solver(op::FEOperator,params)
Ω = params[]
= Measure(Ω,2*k)
Ωf = params[:Ωf]
dΩf = Measure(Ωf,2*k)
quad3D = params[:fespaces][:quadratures][3]
dΩf = Measure(Ωf,quad3D)
α_p = -1.0/(params[:fluid][] + params[:fluid][])
α_φ = -1.0/(1.0 + params[:fluid][])
a_Ip(p,v_p) = (α_p*p*v_p)*dΩf
Expand Down
29 changes: 27 additions & 2 deletions src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function add_default_params(_params)
if !isnothing(params[:continuation])
params[:continuation] = params_continuation(params)
end
display_params(params)
params
end

Expand All @@ -158,6 +159,30 @@ function duplicate_params(params)
return new_params
end

function display_params(params)
map_main(params[:ptimer].parts) do _
msg = params_to_string(params)
@info string("Parameters :: \n",msg...)
end
end

function params_to_string(params)
msg = String[]
for (key,value) in params
if isa(value,Dict)
sub_msg = params_to_string(value)
push!(msg," > $key => { \n")
for m in sub_msg
push!(msg," $m")
end
push!(msg," } \n")
elseif isa(value,Union{Number,String,Symbol,Nothing})
push!(msg," > $key => $value \n")
end
end
return msg
end

"""
Valid keys for `params[:solver]` are the following:
Expand Down Expand Up @@ -355,7 +380,7 @@ const FLUID_DISCRETIZATIONS = (;
:p_conformity => :L2,
:p_order => (k) -> k-1,
:rrule => Gridap.Adaptivity.BarycentricRefinementRule(TET)
),
),
)
)

Expand Down Expand Up @@ -390,7 +415,7 @@ function generate_quadratures(poly::Polytope{D},feparams) where D
poly,Gridap.Adaptivity.CompositeQuadrature(),feparams[:rrule],qdegree
)
else
Quadrature(p,qdegree)
Quadrature(p,2*qdegree)
end
end
else
Expand Down
48 changes: 35 additions & 13 deletions test/seq/channel_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,41 @@ module ChannelTestsSequential
using GridapMHD: channel
using GridapPETSc, SparseMatricesCSR


channel(nc=(4,4,4),vtk=true)

channel(backend=:mpi,np=(1,1,1),solver=:petsc,
sizes=(4,2,2),nc=(4,4,4),vtk=true)

channel(backend=:mpi,np=(1,1,1),solver=:petsc,
sizes=(8,2,2),nc=(4,8,8),B0=20,vtk=true,inlet=:shercliff)

channel(sizes=(4,1,1),nc=(16,4,4),vtk=true)

channel(sizes=(4,1,1),nc=(16,8,8,),debug=false,vtk=true,
bl_orders=(1,2,2),nonuniform_B=true,B0=20,inlet=:shercliff)
#channel(nc=(4,4,4),vtk=true)

solver = Dict(
:solver => :badia2024,
:matrix_type => SparseMatrixCSR{0,PetscScalar,PetscInt},
:vector_type => Vector{PetscScalar},
:block_solvers => [:petsc_mumps,:cg_jacobi,:cg_jacobi],
:petsc_options => "-ksp_error_if_not_converged true -ksp_converged_reason",
:rtol => 1.e-10
)

channel(
backend=:mpi,
np=(2,1,1),
solver=solver,
sizes=(6,3,3),
nc=(4,4,4),
order=3,
order_j=3,
simplexify=true,
bl_orders=(1,2,2),
convection=:none,
inlet=:shercliff,
rt_scaling = true,
B = (0.0,50.0,0.0),
ζ = 100.0,
)

#channel(backend=:mpi,np=(1,1,1),solver=:petsc,
# sizes=(8,2,2),nc=(4,8,8),B0=20,vtk=true,inlet=:shercliff)
#
#channel(sizes=(4,1,1),nc=(16,4,4),vtk=true)
#
#channel(sizes=(4,1,1),nc=(16,8,8,),debug=false,vtk=true,
# bl_orders=(1,2,2),nonuniform_B=true,B0=20,inlet=:shercliff)


end

0 comments on commit 73848c6

Please sign in to comment.