idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Segmentation fault when using displaced mesh with NS kernels #5959

Closed mlesueur closed 8 years ago

mlesueur commented 8 years ago

Hi, I'm working on a Navier-Stokes simulation in a granular rock matrix that looks at the effects of grain's dilation on permeability (calculated with Darcy's Law).

I use the variables disp_x and disp_y to make my grains swell but Navier Stokes flow is not affected by the swelling! undisplaced_simulation displaced_simulation Although the velocity should increase in the channels that are tightening.

I figured out that I have to put in my Mesh block: displacements = 'disp_x disp_y' and put in everything that operates spatially: use_displaced_mesh = true In my input file, it means BC, Kernels and Postprocessors.

But when I turn everything on, I got a segmentation fault. So I tried to localise the problem and realise that the only things that are not working with use_displaced_mesh = true are the Navier Stokes kernels.

For an example of usage, you can follow my post on the mailing list: https://groups.google.com/forum/#!topic/moose-users/KvJZvdritew

Cheers,

Martin Lesueur

friedmud commented 8 years ago

I'm not sure what's going on here... I just wanted to report that the whole team is REALLY busy right now so don't be discouraged if we are a bit slow to respond!

This looks like a really cool application, and I'll take a look into this soon (if someone else doesn't get to it first).

aeslaughter commented 8 years ago

I just downloaded your mesh and executed "with_ns_displacement.i" and did not receive a seg. fault:

~/projects/moose/modules/navier_stokes/navier_stokes-oprof -i with_ns_displacement.i Outputs/print_linear_residuals=false

Framework Information:
MOOSE version:           git commit 3f801dd on 2015-11-23
PETSc Version:           3.6.1
Current Time:            Mon Nov 23 09:59:24 2015
Executable Timestamp:    Mon Nov 23 09:50:33 2015

Parallelism:
  Num Processors:          1
  Num Threads:             1

Mesh: 
  Distribution:            serial
  Mesh Dimension:          2
  Spatial Dimension:       3
  Nodes:                   
    Total:                 1789
    Local:                 1789
  Elems:                   
    Total:                 854
    Local:                 854
  Num Subdomains:          2
  Num Partitions:          1

Nonlinear System:
  Num DOFs:                4246
  Num Local DOFs:          4246
  Variables:               { "vel_x" "vel_y" } "p" { "disp_x" "disp_y" } "fake" 
  Finite Element Types:    "LAGRANGE" "LAGRANGE" "LAGRANGE" "LAGRANGE" 
  Approximation Orders:    "SECOND" "FIRST" "FIRST" "FIRST" 

Execution Information:
  Executioner:             Transient
  TimeStepper:             ConstantDT
  Solver Mode:             Preconditioned JFNK

Time Step  0, time = 0
                dt = 0

Postprocessor Values:
+----------------+----------------+----------------+----------------+
| time           | p_multiapp     | permeability   | v_right        |
+----------------+----------------+----------------+----------------+
|   0.000000e+00 |   1.000000e+00 |   0.000000e+00 |   0.000000e+00 |
+----------------+----------------+----------------+----------------+

Time Step  1, time = 10
                dt = 10
 0 Nonlinear |R| = 3.875486e+00
 1 Nonlinear |R| = 2.638056e-06
 2 Nonlinear |R| = 5.405136e-13
 Solve Converged!
WARNING: At least one element took more than 10 iterations to converge in inverse_map()...
Rerun in devel/dbg mode for more details.

Outlier Variable Residual Norms:
  vel_x: 4.758999e-13

Postprocessor Values:
+----------------+----------------+----------------+----------------+
| time           | p_multiapp     | permeability   | v_right        |
+----------------+----------------+----------------+----------------+
|   0.000000e+00 |   1.000000e+00 |   0.000000e+00 |   0.000000e+00 |
|   1.000000e+01 |   1.000000e+00 |   2.720808e-03 |   2.720808e-03 |
+----------------+----------------+----------------+----------------+
mlesueur commented 8 years ago

Sorry Andrew, The file had the displacement set up, but not activated. This following file should fail. It is the same file than before but I activated use_displaced_mesh=true on the NS kernels.

[GlobalParams]

Dummy parameters

gravity = '0 0 0' rho = 1 mu = 1 []

[Mesh] type = FileMesh file = mesh_navier-meca.msh dim = 2 boundary_name = 'top grain_edges right bottom left' block_name = 'pore grains' boundary_id = '4 1 5 6 7' block_id = '2 3' displacements = 'disp_x disp_y' []

[Variables]

x-velocity

y-velocity

Pressure

[./vel_x] order = SECOND block = pore [../] [./vel_y] order = SECOND block = pore [../] [./p] order = FIRST family = LAGRANGE initial_condition = 1 block = pore [../] [./disp_x] initial_condition = 0 [../] [./disp_y] [../] [./fake] block = grains [../] []

[Functions] [./perm_f] type = ParsedFunction value = v/p vals = 'v_right p_multiapp' vars = 'v p' [../] [./displ] type = ParsedFunction value = -0.6_y_sin(y_3.14)_max(0,x-0.2) [../] []

[Kernels]

mass

x-momentum, time

x-momentum, space

y-momentum, time

y-momentum, space

active = 'y_momentum_space tdy x_momentum_space tdx mass td' [./mass] type = INSMass variable = p u = vel_x v = vel_y p = p block = pore use_displaced_mesh = true [../] [./x_momentum_time] type = INSMomentumTimeDerivative variable = vel_x block = pore use_displaced_mesh = true [../] [./x_momentum_space] type = INSMomentum variable = vel_x u = vel_x v = vel_y p = p component = 0 block = pore use_displaced_mesh = true [../] [./y_momentum_time] type = INSMomentumTimeDerivative variable = vel_y block = pore use_displaced_mesh = true [../] [./y_momentum_space] type = INSMomentum variable = vel_y u = vel_x v = vel_y p = p component = 1 block = pore use_displaced_mesh = true [../] [./td] type = TimeDerivative variable = fake block = grains use_displaced_mesh = true [../] [./tdx] type = TimeDerivative variable = disp_x use_displaced_mesh = true [../] [./tdy] type = TimeDerivative variable = disp_y use_displaced_mesh = true [../] []

[BCs] active = 'highp x_no_slip lowp y_no_slip test' [./x_no_slip] type = DirichletBC variable = vel_x boundary = 'top bottom grain_edges' value = 0.0 use_displaced_mesh = true [../] [./y_no_slip] type = DirichletBC variable = vel_y boundary = 'top bottom grain_edges' value = 0.0 use_displaced_mesh = true [../] [./highp] type = PostprocessorDirichletBC variable = p boundary = left postprocessor = p_multiapp use_displaced_mesh = true [../] [./lowp] type = DirichletBC variable = p boundary = right value = 0 use_displaced_mesh = true [../] [./inlet] type = DirichletBC variable = vel_x boundary = left value = 0 use_displaced_mesh = true [../] [./test] type = NSImposedVelocityBC variable = vel_x boundary = left desired_velocity = 0 use_displaced_mesh = true [../] []

[Postprocessors] [./p_multiapp] type = Receiver default = 1 use_displaced_mesh = true [../] [./v_right] type = SideAverageValue variable = vel_x boundary = right use_displaced_mesh = true [../] [./permeability] type = FunctionValuePostprocessor function = perm_f use_displaced_mesh = true [../] []

[Preconditioning] [./SMP_PJFNK]

Preconditioned JFNK (default)

type = SMP
full = true
solve_type = PJFNK

[../] []

[Executioner]

type = Steady

type = Transient petsc_options_iname = '-ksp_gmres_restart ' petsc_options_value = '300 ' line_search = none nl_rel_tol = 1e-8 nl_max_its = 6 l_tol = 1e-8 l_max_its = 300 num_steps = 1 # 200 end_time = 10 []

[Outputs] file_base = sub1 csv = true exodus = true []

[ICs] [./disp_y_ic] function = displ variable = disp_y type = FunctionIC [../] []