ASPECT 3D Model Runtime Error: ExcInternalError - Dimension Check Failure

Hi.all
I am encountering a dimension mismatch error when running a specific 3D mantle convection model in ASPECT, The error occurs during parameter parsing with the condition prm.get_integer(“Dimension”) == dim failing.(ASPECT version: 3.0.0)
core error:Aborting!
Abort(1) on node 87 (rank 87 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 87
An error occurred in line <1463> of file </path/to/aspect/source/simulator/parameters.cc> in functionvoid aspect::Parameters::parse_parameters(dealii::ParameterHandler&, MPI_Comm) [with int dim = 2; MPI_Comm = int]The violated condition was:prm.get_integer(“Dimension”) == dimAdditional information:This exception – which is used in many places in the library –usually indicates that some condition which the author of the codethought must be satisfied at a certain point in an algorithm, is notfulfilled. An example would be that the first part of an algorithmsorts elements of an array in ascending order, and a second part ofthe algorithm later encounters an element that is not larger than theprevious one.
There is usually not very much you can do if you encounter such an
exception since it indicates an error in deal.II, not in your own
program. Try to come up with the smallest possible program that still
demonstrates the error and contact the deal.II mailing lists with it
to obtain help.
Stacktrace:
#0 /path/to/aspect/aspect-build/aspect: aspect::Parameters<2>::parse_parameters(dealii::ParameterHandler&, int)#1 /path/to/aspect/aspect-build/aspect: aspect::Parameters<2>::Parameters(dealii::ParameterHandler&, int)#2 /path/to/aspect/aspect-build/aspect: aspect::Simulator<2>::Simulator(int, dealii::ParameterHandler&)#3 /path/to/aspect/aspect-build/aspect: void run_simulator<2>(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool, bool, bool, bool)#4 /path/to/aspect/aspect-build/aspect: main
set Dimension = 3
set Use years in output instead of seconds = true
set End time = 10e6
set Output directory = Result

set Nonlinear solver scheme = single Advection, iterated Stokes
set Nonlinear solver tolerance = 1e-3
set Max nonlinear iterations = 55
set CFL number = 1
set Resume computation = auto
set Pressure normalization= no
set Surface pressure=0

subsection Solver parameters
subsection Advection solver parameters
set GMRES solver restart length = 200
end
subsection Stokes solver parameters
set Linear solver tolerance = 1e-5
set Linear solver A block tolerance = 1.0e-2
set Use full A block as preconditioner = false

set Stokes solver type = block AMG

set Number of cheap Stokes solver steps= 5000

end
set Temperature solver tolerance = 1e-11
set Composition solver tolerance = 1e-11
end
subsection Discretization
set Temperature polynomial degree = 2
set Composition polynomial degree = 2
set Stokes velocity polynomial degree = 2
set Use discontinuous composition discretization = true
end
subsection Gravity model
set Model name = vertical
subsection Vertical
set Magnitude = 9.81
end
end
subsection Formulation
set Formulation = Boussinesq approximation
end

subsection Heating model
set List of model names = compositional heating
subsection Compositional heating
set Use compositional field for heat production averaging = 0,0,1,0,0,1,0,0,0,0,1,0,0
set Compositional heating values = 0, 0 ,1.0e-6 ,0, 0,1.0e-6, 0 ,0, 0,0, 1.0e-6, 0, 0
end
end
#------ domain and meshing -----------
subsection Geometry model
set Model name = box
subsection Box
set X extent = 4000e3
set Y extent = 2000e3
set Z extent = 1500e3
end
end

subsection Mesh refinement
set Initial global refinement = 5
set Initial adaptive refinement = 3
set Time steps between mesh refinement = 5
set Refinement fraction = 0.35
set Coarsening fraction = 0.15
set Strategy = composition threshold, strain rate
subsection Composition threshold
set Compositional field thresholds = 0.25,0.25,0.25,0.25,0.25,0.25,0.05,0.25,0.25,0.25,0.25,0
end
end
#---- initial temp and comp fields —
subsection Initial temperature model
set Model name = ascii data
subsection Ascii data model
set Data directory = ./data/
set Data file name = temperature_3D.txt
end
end
subsection Compositional fields
set Number of fields =12
set Names of fields = ct_up,ct_low,ct_mantle,con_up,con_low,con_mantle,wk,sed,oc_up,oc_low,oc_mantle,plastic_strain
end
subsection Initial composition model
set Model name = ascii data
subsection Ascii data model
set Data directory = ./data/
set Data file name = composition_3D.txt
end
end
#------- boundary conditions -------------
subsection Boundary temperature model
set Fixed temperature boundary indicators = top, bottom
set List of model names = box
subsection Box
set Bottom temperature = 1623
set Top temperature = 273
end
end
subsection Boundary composition model
set Fixed composition boundary indicators =right
set List of model names =initial composition
end
subsection Boundary velocity model
set Tangential velocity boundary indicators =top,bottom,left,front,back
set Prescribed velocity boundary indicators = right:function
subsection Function
set Function constants = cm=100.0, transition_upper_z=1300e3, transition_lower_z=200e3,
right_speed=5.0, left_speed=-5.0, x_divider=1500e3
set Variable names = x,y,z
set Function expression = (x > x_divider) ? ((z >= transition_upper_z) ? left_speed/cm : \
(z <= transition_lower_z) ? right_speed/cm :\
left_speed/cm + (right_speed/cm - left_speed/cm) *(z - transition_upper_z) / (transition_lower_z - transition_upper_z)) :0;0
end
end
subsection Material model
set Model name = visco plastic
set Material averaging = harmonic average
#project to Q1 only viscosity
subsection Visco Plastic
set Reference temperature = 1623
set Minimum strain rate = 1.e-20
set Minimum viscosity = 0.5e20
set Maximum viscosity = 1e24
set Adiabat temperature gradient for viscosity = 9.24e-09 # 0.3 K/km
set Minimum strain rate=1e-20
set Thermal diffusivities = 1.e-6
set Heat capacities = 1250.
set Thermal expansivities = 3.0e-5
set Densities = background:3300,ct_up:2800,ct_low:2900,ct_mantle:3300,con_up:2800,con_low:2900,con_mantle:3300,wk:3200,sed:2600,oc_up:3000,oc_low:3000,oc_mantle:3300,plastic_strain:3300
set Activation energies for Peierls creep=320e3
set Activation energies for diffusion creep =background:375e3,ct_up:154e3,ct_low:300e3,ct_mantle:375e3,con_up:154e3,con_low:300e3,con_mantle:375e3,wk:100e3,sed:100e3,oc_up:154e3,oc_low:300e3,oc_mantle:375e3,plastic_strain:0
set Activation volumes for diffusion creep =background:15e-6,ct_up:2e-6,ct_low:8e-6,ct_mantle:15e-6,con_up:2e-6,con_low:8e-6,con_mantle:15e-6,wk:1.5e-6,sed:1.5e-6,oc_up:2e-6,oc_low:8e-6,oc_mantle:15e-6,plastic_strain:0
set Viscous flow law = composite
set Prefactors for dislocation creep =background:1e-15,ct_up:5e-18,ct_low:3e-17,ct_mantle:1e-14,con_up:5e-18,con_low:3e-17,con_mantle:1e-14,wk:1e-20,sed:1e-20,oc_up:5e-18,oc_low:3e-17,oc_mantle:1e-15,plastic_strain:0
set Stress exponents for dislocation creep =background:3.5,ct_up:2.3,ct_low:3.2,ct_mantle:3.5,con_up:2.3,con_low:3.2,con_mantle:3.2,wk:3,sed:2.3,oc_up:2.3,oc_low:3.2,oc_mantle:3.5,plastic_strain:0
set Prefactors for diffusion creep =background:1e-20,ct_up:5e-22,ct_low:1e-21,ct_mantle:1e-20,con_up:5e-22,con_low:1e-21,con_mantle:1e-20,wk:1e-22,sed:1e-22,oc_up:5e-22,oc_low:1e-21,oc_mantle:1e-20,plastic_strain:0
set Yield mechanism = drucker
set Angles of internal friction = background:30,ct_up:25,ct_low:35,ct_mantle:10,con_up:25,con_low:35,con_mantle:10,wk:1,sed:10,oc_up:25,oc_low:35,oc_mantle:10,plastic_strain:0
set Cohesions = background:20e6,ct_up:10e6,ct_low:50e6,ct_mantle:0.1e6,con_up:10e6,con_low:50e6,con_mantle:0.1e6,wk:0.1e6,sed:0.1e6,oc_up:10e6,oc_low:2e6,oc_mantle:20e6,plastic_strain:0
set Maximum yield stress = 1.0e9
set Strain weakening mechanism = plastic weakening with plastic strain only
set Start plasticity strain weakening intervals = 0.1
set End plasticity strain weakening intervals = 0.5
set Cohesion strain weakening factors = 0.1
set Friction strain weakening factors = 0.1
end
end

subsection Postprocess
set List of postprocessors = basic statistics, composition statistics, heat flux statistics,
mass flux statistics, pressure statistics, temperature statistics,
topography, velocity statistics, visualization,material statistics
subsection Visualization
set List of output variables =material properties,strain rate
set Time between graphical output = 10e3
set Output format = vtu
subsection Material properties
set List of material properties=density,thermal expansivity,specific heat,viscosity
end
end
end
subsection Checkpointing
set Steps between checkpoint = 10
end

@3Faker3 For some reason, ASPECT is trying to read the input file as if it described a 2d situation, even though you clearly say set Dimension = 3 at the top. I can’t say why that is – do you have any other statements of the form set Dimension = … in the input file? Can you attach the input file as an attachment (rather than copy-pasting it)?

Best

W.

Okay, thank you for your reply. This is my input PRM file. There are no other statements of the form set Dimension=.... I have tried changing parameters such as switching the visco-plastic model to simple, modifying the boundary velocity conditions, and so on, but this issue still persists.

3dmodel.prm (7.7 KB)

The data file(composition file,temperature file) is too large to upload on the forum, so I have sent it to you via email instead.

@3Faker3 I can reproduce this. I believe the issue is that you are using a file with DOS line endings on a Linux system. I haven’t quite figured out why we do not generate an error that explains the issue – we have the code for that, but for some reason it doesn’t trigger.

I’ll work on that over the next few days. In the meantime, if you save your input file with Unix line endings (for example, use the dos2unix script on it), it should work.

Best

W.

@3Faker3 There is now a patch here: https://github.com/geodynamics/aspect/pull/6712. With this patch, you would get the following error message with your input file:


 --------------------------------------------------------
An error occurred in line <145> of file </tempest/a/accounts/bangerth/p/deal.II/1/projects/aspect/source/main.cc> in function
    unsigned int {anonymous}::get_dimension(const std::string&)
The violated condition was: 
    dimension.find('\r') == std::string::npos
Additional information: 
    It appears that your input file uses Windows-style line endings
    ('\r\n') but you are running on a system where the C++ run time
    environment expects input files to have Unix-style line endings
    ('\n'). You need to convert your input file to use the correct line
    endings before running ASPECT with it.

Stacktrace:
-----------
#0  ./aspect: 
#1  ./aspect: main
--------------------------------------------------------

The resolution is the same: You need to save your input file with Unix line endings if you run on Linux.

Best

W.

Thank you for your previous help. After applying the change to Unix file format, the code executes. However, I am now encountering an issue where the composition fails to load, and I am currently debugging this problem.

@3Faker3 Yes, that would be a different issue. If that turns out to be a separate bug, please open a new issue about that!

Best
WB