Hello,
I would like to change the value of set Shear modulus to 1e6 using a parameter in function. so I can control the value of modulus and this parameter will be used and changed in each iteration of loop.
There are two ideas
1st)I want to change the value of modulus and the new value will be written back to prm file.And in next step the file will read as input to execute the next steps.
2nd)I would like to create a object prm and changed the value of modulus,but not written to back to prm file,use prm object in next steps;
in function:
prm.parse_input("parameters.prm");
prm.enter_subsection("Material properties");
prm.set("Shear modulus", x[0]);
prm.leave_subsection();
prm.print_parameters("parameters.prm",dealii::ParameterHandler::Text);
{
deallog.depth_console(0);
Parameters::AllParameters parameters("parameters.prm");
parameters.mu=x[0];
// x_density_percell=
parameters.mu;(I found there are errors in umpack)
if (parameters.automatic_differentiation_order == 0)
{
std::cout << "Assembly method: Residual and linearisation are computed manually." << std::endl;
// Allow multi-threading
// Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv,
// dealii::numbers::invalid_unsigned_int);
typedef double NumberType;
Solid<dim,NumberType> solid_3d(parameters);
solid_3d.run();
}
}
The information above is what I wrote,but the errors come out . I am not quite familiar with prm part,I am still learning dealii for more knowledge and skills.
May I know if anyone could provide any hint or suggestions?Which idea is better for implementation?
Thanks in advance!
Best regards
Lance
#>>>>>>>>>>>>>>>>>>>>>>
# Listing of Parameters
# ---------------------
subsection Assembly method
# The automatic differentiation order to be used in the assembly of the linear system.
# Order = 0: Both the residual and linearisation are computed manually.
# Order = 1: The residual is computed manually but the linearisation is performed using AD.
# Order = 2: Both the residual and linearisation are computed using AD.
set Automatic differentiation order = 0
end
subsection Finite element system
# Displacement system polynomial order
set Polynomial degree = 1
# Gauss quadrature order
set Quadrature order = 2
end
subsection Geometry
# Number of elements per long edge of the beam
set Elements per edge =20
# Global grid scaling factor
set Grid scale = 1e-3
end
subsection Linear solver
# Linear solver iterations (multiples of the system matrix size)
set Max iteration multiplier = 10
# Linear solver residual (scaled by residual norm)
set Residual = 1e-6
# Preconditioner type
set Preconditioner type = ssor
# Preconditioner relaxation value
set Preconditioner relaxation = 0.65
# Type of solver used to solve the linear system
set Solver type = Direct
end
subsection Material properties
# Poisson's ratio
set Poisson's ratio = 0.3
# Shear modulus
# set Shear modulus = 0.4225e6
set Shear modulus = 1e6
end
subsection Nonlinear solver
# Number of Newton-Raphson iterations allowed
set Max iterations Newton-Raphson = 10
# Displacement error tolerance
set Tolerance displacement = 1.0e-6
# Force residual tolerance
set Tolerance force = 1.0e-9
end
subsection Time
# End time
set End time = 1
# Time step size
set Time step size = 0.1
end