Skip to content

Commit

Permalink
Cleaned up horizontal limiting convex combination
Browse files Browse the repository at this point in the history
  • Loading branch information
OsKnoth committed Jul 9, 2023
1 parent 9c825fe commit f1ffe89
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 189 deletions.
215 changes: 64 additions & 151 deletions Examples/testAdvectionConvSphere.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RadEarth = parsed_args["RadEarth"]
nz = parsed_args["nz"]
nPanel = parsed_args["nPanel"]
H = parsed_args["H"]
stretch = parsed_args["stretch"]
Stretch = parsed_args["Stretch"]
OrdPoly = parsed_args["OrdPoly"]
# Viscosity
HyperVisc = parsed_args["HyperVisc"]
Expand All @@ -59,182 +59,95 @@ Flat = parsed_args["Flat"]
Param = CGDycore.Parameters(Problem)

MPI.Init()
comm = MPI.COMM_WORLD
Proc = MPI.Comm_rank(comm) + 1
ProcNumber = MPI.Comm_size(comm)
ParallelCom = CGDycore.ParallelCom()
ParallelCom.Proc = Proc
ParallelCom.ProcNumber = ProcNumber
print("$Proc: \n")
print("$ProcNumber: \n")

OrdPolyZ=1
Parallel = true

# Physical parameters
Phys=CGDycore.PhysParameters()

#ModelParameters
Model = CGDycore.Model()
# Initial conditions
Model.Equation="Compressible"
Model.NumV=NumV
Model.NumTr=NumTr
Model.Problem=Problem
if ProfRho == ""
Model.ProfRho = Problem
else
Model.ProfRho = ProfRho
end
if ProfTheta == ""
Model.ProfTheta = Problem
else
Model.ProfTheta = ProfTheta
end
if ProfVel == ""
Model.ProfVel = Problem
else
Model.ProfVel = ProfVel
end
if ProfVelW == ""
Model.ProfVelW = Problem
else
Model.ProfVelW = ProfVelW
end
if ProfTr == ""
Model.ProfTr = Problem
else
Model.ProfTr = ProfTr
end
Model.RhoPos=1
Model.uPos=0
Model.vPos=0
Model.wPos=0
Model.HorLimit = HorLimit
Model.Upwind = Upwind

if RadEarth == 0.0
RadEarth = Phys.RadEarth
end


# Grid
Topography=(TopoS=TopoS,H=H,Rad=RadEarth)
TimeStepper=CGDycore.TimeStepper()

Grid=CGDycore.Grid(nz,Topography)
if GridType == "Helix"
Grid=CGDycore.InputGridH("Grid/mesh_H12_no_pp.nc",
CGDycore.OrientFaceSphere,RadEarth,Grid)
elseif GridType == "SQuadGen"
Grid=CGDycore.InputGrid("Grid/baroclinic_wave_2deg_x4.g",
CGDycore.OrientFaceSphere,RadEarth,Grid)
elseif GridType == "CubedSphere"
Grid=CGDycore.CubedGrid(nPanel,CGDycore.OrientFaceSphere,RadEarth,Grid)
end
if Parallel
if Decomp == "Hilbert"
CGDycore.HilbertFaceSphere!(Grid)
CellToProc = CGDycore.Decompose(Grid,ProcNumber)
elseif Decomp == "EqualArea"
CellToProc = CGDycore.DecomposeEqualArea(Grid,ProcNumber)
else
CellToProc = ones(Int,Grid.NumFaces)
println(" False Decomp method ")
end
SubGrid = CGDycore.ConstructSubGrid(Grid,CellToProc,Proc)

if stretch
sigma = 1.0
lambda = 3.16
CGDycore.AddStretchICONVerticalGrid!(SubGrid,nz,H,sigma,lambda)
else
CGDycore.AddVerticalGrid!(SubGrid,nz,H)
end
Exchange = CGDycore.InitExchangeCG(SubGrid,OrdPoly,CellToProc,Proc,ProcNumber,Parallel,HorLimit)
Output=CGDycore.Output(Topography)
Global = CGDycore.Global(SubGrid,Model,TimeStepper,ParallelCom,Phys,Output,Exchange,OrdPoly+1,nz,NumV,NumTr,())
Global.Metric=CGDycore.Metric(OrdPoly+1,OrdPolyZ+1,SubGrid.NumFaces,nz)
(CG,Global)=CGDycore.DiscretizationCG(OrdPoly,OrdPolyZ,CGDycore.JacobiSphere3,Global)
# Output partition
nzTemp = Global.Grid.nz
Global.Grid.nz = 1
vtkCachePart = CGDycore.vtkInit3D(1,CGDycore.TransSphereX,CG,Global)
CGDycore.unstructured_vtkPartition(vtkCachePart, Global.Grid.NumFaces, Proc, ProcNumber)
Global.Grid.nz = nzTemp

if TopoS == "EarthOrography"
SubGrid = CGDycore.StencilFace(SubGrid)
zS = CGDycore.Orography(CG,Global)
Output.RadPrint = H
Output.Flat=false
nzTemp = Global.Grid.nz
Global.Grid.nz = 1
vtkCacheOrography = CGDycore.vtkInit2D(CG.OrdPoly,CGDycore.TransSphereX,CG,Global)
CGDycore.unstructured_vtkOrography(zS,vtkCacheOrography, Global.Grid.NumFaces, CG, Proc, ProcNumber)
Global.Grid.nz = nzTemp
end
Model.Equation="Compressible"
Model.NumV=NumV
Model.NumTr=NumTr
Model.Problem=Problem
if ProfRho == ""
Model.ProfRho = Problem
else
CellToProc=zeros(0)
Proc = 0
ProcNumber = 0
sigma = 1.0
lambda = 3.16
CGDycore.AddStretchICONVerticalGrid!(Grid,nz,H,sigma,lambda)
Exchange = CGDycore.InitExchange(Grid,OrdPoly,CellToProc,Proc,ProcNumber,Parallel)
Output=CGDycore.Output(Topography)
Global = CGDycore.Global(Grid,Model,Phys,Output,Exchange,OrdPoly+1,nz,NumV,NumTr,())
Global.Metric=CGDycore.Metric(OrdPoly+1,OrdPolyZ+1,Grid.NumFaces,nz)
Model.ProfRho = ProfRho
end
if TopoS == "EarthOrography"
(CG,Global)=CGDycore.DiscretizationCG(OrdPoly,OrdPolyZ,CGDycore.JacobiSphere3,Global,zS)
if ProfTheta == ""
Model.ProfTheta = Problem
else
(CG,Global)=CGDycore.DiscretizationCG(OrdPoly,OrdPolyZ,CGDycore.JacobiSphere3,Global)
end

Model.ProfTheta = ProfTheta
end
if ProfVel == ""
Model.ProfVel = Problem
else
Model.ProfVel = ProfVel
end
if ProfVelW == ""
Model.ProfVelW = Problem
else
Model.ProfVelW = ProfVelW
end
if ProfTr == ""
Model.ProfTr = Problem
else
Model.ProfTr = ProfTr
end
Model.RhoPos=1
Model.uPos=0
Model.vPos=0
Model.wPos=0
Model.HorLimit = HorLimit
Model.Upwind = Upwind
Model.HyperVisc = HyperVisc
Model.HyperDCurl = HyperDCurl # =7.e15
Model.HyperDGrad = HyperDGrad # =7.e15
Model.HyperDDiv = HyperDDiv # =7.e15

if RadEarth == 0.0
RadEarth = Phys.RadEarth
end

U = CGDycore.InitialConditionsAdvection(CG,Global,Param)

# Output partition
nzTemp = Global.Grid.nz
Global.Grid.nz = 1
vtkCachePart = CGDycore.vtkInit2D(1,CGDycore.TransSphereX,CG,Global)
Global.Grid.nz = nzTemp
CGDycore.unstructured_vtkPartition(vtkCachePart, Global.Grid.NumFaces, Proc, ProcNumber)
# Grid
Topography=(TopoS=TopoS,H=H,Rad=RadEarth)

(CG,Global) = CGDycore.InitSphere(OrdPoly,OrdPolyZ,nz,nPanel,H,GridType,Topography,Decomp,Model,Phys)

U = CGDycore.InitialConditionsAdvection(CG,Global,Param)

# Output
Output.vtkFileName=string(vtkFileName*"_")
Output.vtk=0
Output.Flat=Flat
Output.nPanel=nPanel
Output.RadPrint=H
Output.H=H
Output.cNames = [
Global.Output.vtkFileName=string(vtkFileName*"_")
Global.Output.vtk=0
Global.Output.Flat=Flat
Global.Output.nPanel=nPanel
Global.Output.RadPrint=H
Global.Output.H=H
Global.Output.cNames = [
"Rho",
"Tr1",
]
Output.PrintDays = PrintDays
Output.PrintHours = PrintHours
Output.PrintSeconds = PrintSeconds
Output.PrintTime = PrintTime
Output.PrintStartDays = 0
Output.OrdPrint=CG.OrdPoly
Global.vtkCache = CGDycore.vtkInit3D(Output.OrdPrint,CGDycore.TransSphereX,CG,Global)
Global.Output.PrintDays = PrintDays
Global.Output.PrintHours = PrintHours
Global.Output.PrintSeconds = PrintSeconds
Global.Output.PrintTime = PrintTime
Global.Output.PrintStartTime = 0
Global.Output.OrdPrint = CG.OrdPoly
Global.vtkCache = CGDycore.vtkStruct(Global.Output.OrdPrint,CGDycore.TransSphereX,CG,Global)

# TimeStepper
time=[0.0]
TimeStepper.IntMethod = IntMethod
TimeStepper.Table = Table
TimeStepper.dtau = dtau
TimeStepper.SimDays = SimDays
TimeStepper.SimHours = SimHours
TimeStepper.SimMinutes = SimMinutes
TimeStepper.SimSeconds = SimSeconds
TimeStepper.SimTime = SimTime
Global.TimeStepper.IntMethod = IntMethod
Global.TimeStepper.Table = Table
Global.TimeStepper.dtau = dtau
Global.TimeStepper.SimDays = SimDays
Global.TimeStepper.SimHours = SimHours
Global.TimeStepper.SimMinutes = SimMinutes
Global.TimeStepper.SimSeconds = SimSeconds
Global.TimeStepper.SimTime = SimTime

CGDycore.TimeStepperAdvectionConv!(U,CGDycore.TransSphereX,CG,Global,Param)
7 changes: 3 additions & 4 deletions Jobs/JobAdvectionConvSlottedCylinder
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ mpirun -n 1 julia --project Examples/testAdvectionConvSphere.jl \
--Decomp="EqualArea" \
--vtkFileName="SlottedCylinderConvSquad" \
--SimTime=5.0 \
--PrintTime=0.25 \
--Flat=true \
--PrintTime=0.00048 \
--Flat=false \
--dtau=0.00048 \
--IntMethod="SSPRungeKutta" \
--Table="SSP32" \
--TopoS="" \
--stretch=false \
--GridType="SQuadGen" \
--GridType="CubedSphere" \
--nz=1 \
--nPanel=32 \
--RadEarth=1.0 \
Expand Down
13 changes: 7 additions & 6 deletions Jobs/JobNHBaroWaveDrySphere
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mpirun -n 16 --use-hwthread-cpus julia --project Examples/testNHSphere.jl \
mpirun -n 6 julia --project Examples/testNHSphere.jl \
--Problem="BaroWaveDrySphere" \
--NumV=5 \
--NumTr=0 \
Expand All @@ -12,28 +12,29 @@ mpirun -n 16 --use-hwthread-cpus julia --project Examples/testNHSphere.jl \
--ModelType="VectorInvariant" \
--Coriolis=true \
--Upwind=true \
--HorLimit=true \
--Buoyancy=true \
--Decomp="EqualArea" \
--SimDays=10 \
--SimSeconds=0 \
--PrintSeconds=0 \
--PrintMinutes=0 \
--PrintHours=0 \
--PrintDays=1 \
--PrintHours=12 \
--PrintDays=0 \
--StartAverageDays=0 \
--Flat=true \
--dtau=100 \
--dtau=300 \
--IntMethod="Rosenbrock" \
--Table="SSP-Knoth" \
--TopoS="" \
--Stretch=true \
--StretchType="Exp" \
--GridType="SQuadGen" \
--GridType="CubedSphere" \
--nz=45 \
--nPanel=16 \
--H=30000.0 \
--OrdPoly=3 \
--HyperVisc=true \
--HyperDCurl=1.e16 \
--HyperDGrad=1.e16 \
--HyperDDiv=1.e16
--HyperDDiv=0.e16
8 changes: 4 additions & 4 deletions Jobs/JobNHHeldSuarezDrySphere
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mpirun -n 1 julia --project --check-bounds=yes Examples/testNHSphere.jl \
mpirun -n 6 julia --project --check-bounds=yes Examples/testNHSphere.jl \
--Problem="HeldSuarezDrySphere" \
--NumV=5 \
--NumTr=0 \
Expand All @@ -8,13 +8,13 @@ mpirun -n 1 julia --project --check-bounds=yes Examples/testNHSphere.jl \
--Source=true \
--Coriolis=true \
--Upwind=true \
--HorLimit=true \
--ModelType="VectorInvariant" \
--Curl=true \
--SurfaceFluxMom=false \
--VerticalDiffusionMom=false \
--HorLimit=false \
--Decomp="EqualArea" \
--SimDays=100 \
--SimDays=10 \
--SimSeconds=0 \
--PrintDays=0 \
--PrintSeconds=300 \
Expand All @@ -33,5 +33,5 @@ mpirun -n 1 julia --project --check-bounds=yes Examples/testNHSphere.jl \
--HyperVisc=true \
--HyperDCurl=1.e16 \
--HyperDGrad=1.e16 \
--HyperDDiv=1.e16
--HyperDDiv=0.e16

4 changes: 2 additions & 2 deletions Jobs/JobNHHeldSuarezDrySphereOro
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ mpirun -n 6 julia --project Examples/testNHSphere.jl \
--Source=true \
--Coriolis=true \
--Upwind=true \
--HorLimit=true \
--ModelType="VectorInvariant" \
--Curl=true \
--SurfaceFluxMom=false \
--VerticalDiffusionMom=false \
--HorLimit=false \
--Damping=true \
--StrideDamp=10000 \
--Relax=1.0e-3 \
Expand All @@ -34,5 +34,5 @@ mpirun -n 6 julia --project Examples/testNHSphere.jl \
--HyperVisc=true \
--HyperDCurl=1.e16 \
--HyperDGrad=1.e16 \
--HyperDDiv=1.e16
--HyperDDiv=0.e16

Loading

0 comments on commit f1ffe89

Please sign in to comment.