Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/Tests/Density/density.sif
3206 views
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Solve for an analytical solution of the density  !
! of the form (exponential) 	      	  	   !
! D  = di - (di-d0)*exp(-C*(H-z))		   !
! Output -> Vertical profil			   !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Check Keywords Warn

Header
  Mesh DB "." "mesh"
End

$d0 = 0.3
$di = 0.9
$C = 0.05
$H = 100.0
$factorvelo = -10.0

$ function D(z) \
  import d0, di, C, H, factorvelo {\
  _D  = di - (di-d0)*exp(-C*(H-z)) ;\
}

$ function Ezz(z) \
  import d0, di, C, H, factorvelo {\
  _Ezz  = factorvelo*(di-d0)*C*exp(-C*(H-z))/D(z)^2 ;\
}

$ function dDdz(z) \
  import d0, di, C, H, factorvelo {\
  _dDdz  = -(di-d0)*C*exp(-C*(H-z)) ;\
}

$ function uz(z) \
  import d0, di, C, H, factorvelo {\
  _uz  = factorvelo/D(z) ;\
}

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Simulation
  Coordinate System = Cartesian 2D

  Simulation Type = Steady State

  Steady State Max Iterations  = 1
  Steady State Min Iterations  = 1 
  
  Output Intervals = 10

  Post File   = "density.vtu"
  max output level = 4
End  

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Body 1
   Equation = 1
   Material = 1
   Body Force = 1
   Initial Condition = 1
End

Body Force 1
  DGDens Source = Real 0.0 
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Material 1
! Relative density must stay < 1
   DGDens Upper Limit = Real 1.0

! a minimum relative density is recommended for the Porous solver 
   DGDens Lower Limit = Real 0.2

!Reaction rate is equal to Zero
   DGDens Gamma = Real 0.0
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Initial Condition 1
  DGDens  = REal $d0 
  Relative Density = Real $d0
  Porous 1 = Real 0.0
  Porous 2 = Variable Coordinate 2
    Real MATC "uz(tx)"
  Porous 3 = Real 0.0
  DensAna = Variable Coordinate 2
    Real MATC "D(tx)"
  Ezz = Variable Coordinate 2
    Real MATC "Ezz(tx)"
  dDdz = Variable Coordinate 2
    Real MATC "dDdz(tx)"
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Solver 1
  Exec solver = Never 
  Equation = String "PorousFlow"
  Procedure = "ElmerIceSolvers" "PorousSolver"
  Variable = "Porous"
  Variable DOFs = 3

  Exported Variable 1 = DensAna
  Exported Variable 1 DOFs = 1

  Exported Variable 2 = Ezz
  Exported Variable 2 DOFs = 1

  Exported Variable 3 = dDdz
  Exported Variable 3 DOFs = 1

  Optimize Bandwidth = False
! Use p elements
  Stablization Method = String pBubbles

  Linear System Solver = "Direct"

  Nonlinear System Convergence Tolerance = 1.0E-05
  Nonlinear System Max Iterations = 50
End

Solver 2
  Equation = "AdvReact"
  Exec Solver = "After Timestep"
  Procedure = File "AdvectionReaction" "AdvectionReactionSolver"
! this is the DG variable, which is not part of the output
  Variable =  -nooutput "DGdens"
! this tells that the solver is run on DG mesh
  Discontinuous Galerkin = Logical True
! the solver can account for upper and lower limits of the variable
! imposed by formulation of an variational inequality (VI)
! next line switches the VI to be accounted for
  Limit Solution = Logical True
   
  Linear System Solver = Direct
! Variational inequality makes it a non-linear problem
  Nonlinear System Max Iterations = 40
  Nonlinear System Min Iterations = 20
  Nonlinear System Convergence Tolerance = 1.0e-06
  
! This is the variable that is used to interpolate
! the DG solution to the regular FEM mesh in order
! to get a correct output
  Exported Variable 1 = Relative Density
  Exported Variable 1 DOFS = 1
End 

!Solver 3
!  Exec Solver =  After All
!  Procedure = File "SaveData" "SaveLine"
 ! Filename =  "results.dat"
!  File Append = Logical False
!End

Solver 3
  Exec Solver =  After All
  Procedure = File "SaveData" "SaveScalars"
  Filename =  "results.dat"
  File Append = Logical False
  Variable 1 = String "Time"

  Variable 2 = String "Relative Density"
  Operator 2 = String "max"

  Variable 3 = String "Relative Density"
  Operator 3 = String "min"
 ! Comparison with DensAna : max/min  
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Equation 1
    Active Solvers(3) = Integer 1 2 3 
    Flow Solution Name = String "Porous"
    Convection = Computed
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Boundary Condition 1
   Target Boundaries  = 3
   DGDens = Real $d0 
End

Boundary Condition 2
   Target Boundaries  = 2
   Save Line = Logical True
End

Solver 2 :: Reference Norm = Real 0.79464064
Solver 2 :: Reference Norm Tolerance = Real 1E-06