Commit c8f510a4 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#873 Test/Parameter time dependency: improve the output and remove unused parameters.

parent 003bfe20
......@@ -21,7 +21,7 @@ transient = {
-- Maximum time, if set to zero run a static case.
-- Expected format: VALUE
-- Constraint: v >= 0.
timeMax = 0.5
timeMax = 5.
}
-- NumberingSubset1
......@@ -218,151 +218,7 @@ Result = {
Solid = {
VolumicMass = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function', 'at_quadrature_point', 'piecewise_constant_by_domain'})
nature = 'constant',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
scalar_value = 1.2,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {}
}, -- VolumicMass
HyperelasticBulk = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function', 'at_quadrature_point', 'piecewise_constant_by_domain'})
nature = 'constant',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
scalar_value = 3.e6,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {}
}, -- HyperelasticBulk
Kappa1 = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function', 'at_quadrature_point', 'piecewise_constant_by_domain'})
nature = 'constant',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
scalar_value = 0.5e6,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {}
}, -- Kappa1
Kappa2 = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function', 'at_quadrature_point', 'piecewise_constant_by_domain'})
nature = 'constant',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
scalar_value = 1.5e6,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {}
}, -- Kappa2
PoissonRatio = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
......@@ -373,7 +229,7 @@ Solid = {
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
scalar_value = 0.03846150295857715,
scalar_value = 10.,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
......@@ -409,7 +265,7 @@ Solid = {
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
scalar_value = 8307692.023668617,
scalar_value = 20.,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
......@@ -435,119 +291,7 @@ Solid = {
}, -- YoungModulus
LameLambda = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function', 'at_quadrature_point', 'piecewise_constant_by_domain'})
nature = 'constant',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
-- Constraint: v > 0.
scalar_value = 333333.,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {},
}, -- LameLambda
LameMu = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {'ignore', 'constant', 'lua_function', 'at_quadrature_point', 'piecewise_constant_by_domain'})
nature = 'constant',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
-- Constraint: v > 0.
scalar_value = 4000000.,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {},
}, -- LameMu
Viscosity = {
-- How is given the parameter (as a constant, as a Lua function, per quadrature point, etc...)
-- Expected format: "VALUE"
-- Constraint: ops_in(v, {"constant", "lua_function", "at_quadrature_point", "piecewise_constant_by_domain"})
nature = 'ignore',
-- Value of the volumic mass in the case nature is 'constant'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: VALUE
-- Constraint: v > 0.
scalar_value = 6.8e-1,
-- Value of the volumic mass in the case nature is 'lua_function'(and also initial value if nature is
-- 'at_quadrature_point'; irrelevant otherwise).
-- Expected format: Function in Lua language, for instance:
-- -- function(arg1, arg2, arg3)
-- return arg1 + arg2 -
-- arg3
-- end
-- sin, cos and tan require a 'math.'
-- preffix.
-- If you do not wish to provide one, put anything you want (e.g. 'none'): the
-- content is not interpreted by Ops until an actual use of the underlying function.
lua_function = none,
-- Domain indices of the parameter in the case nature is 'piecewise_constant_by_domain'. The various
-- domains given here must not intersect.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_id = {},
-- Value of the parameter in the case nature is 'piecewise_constant_by_domain'.
-- Expected format: {VALUE1, VALUE2, ...}
piecewise_constant_domain_value = {},
}, -- Viscosity
} -- Solid
......
......@@ -305,7 +305,7 @@ namespace HappyHeart
if (mpi.IsRootProcessor())
{
std::fstream inout;
std::ofstream inout;
FilesystemNS::File::Append(inout, GetGodOfDof().GetTimeIterationFile(), __FILE__, __LINE__);
oconv.str("");
......
......@@ -1004,7 +1004,7 @@ namespace HappyHeart
if (MpiHappyHeart().IsRootProcessor())
{
std::fstream inout;
std::ofstream inout;
FilesystemNS::File::Append(inout, GetEnergyFile(), __FILE__, __LINE__);
inout << std::scientific << std::setprecision(12) << GetTimeManager().GetTime() << ' ' << std::log(energy) << std::endl;
......
......@@ -91,7 +91,8 @@ namespace HappyHeart
InputParameter::Petsc<EnumUnderlyingType(SolverIndex::solver)>,
InputParameter::Solid,
InputParameter::Solid::YoungModulus,
InputParameter::Solid::PoissonRatio,
InputParameter::Result,
......
......@@ -6,6 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#include "Utilities/Filesystem/File.hpp"
#include "Core/InputParameter/Result.hpp"
#include "Core/InputParameter/Parameter/Solid/Solid.hpp"
#include "Core/ParameterType.hpp"
......@@ -30,8 +32,7 @@ namespace HappyHeart
Model::Model(const Wrappers::Mpi& mpi_ptr,
const InputParameterList& input_parameter_data)
: parent(mpi_ptr, input_parameter_data),
output_directory_(Utilities::InputParameterListNS::Extract<InputParameter::Result::OutputDirectory>::Path(input_parameter_data))
: parent(mpi_ptr, input_parameter_data)
{ }
......@@ -41,6 +42,15 @@ namespace HappyHeart
decltype(auto) mesh = god_of_dof.GetGeometricMeshRegion();
output_file_ = parent::GetOutputDirectory() + "/test_values_"
+ std::to_string(parent::MpiHappyHeart().GetRank<int>()) + ".hhdata";
if (FilesystemNS::File::DoExist(output_file_))
FilesystemNS::File::Remove(output_file_, __FILE__, __LINE__);
std::ofstream out;
FilesystemNS::File::Create(out, output_file_, __FILE__, __LINE__);
using Solid = InputParameter::Solid;
young_modulus_ =
InitScalarParameter
......@@ -105,7 +115,6 @@ namespace HappyHeart
decltype(auto) felt_space = god_of_dof.GetFEltSpace(EnumUnderlyingType(FEltSpaceIndex::index));
decltype(auto) unknown = UnknownManager::GetInstance().GetUnknown(EnumUnderlyingType(UnknownIndex::scalar));
source_operator_ =
std::make_unique<operator_type>(felt_space,
unknown,
......@@ -113,14 +122,23 @@ namespace HappyHeart
DetermineDefaultQuadratureRule(5),
DoComputeProcessorWiseLocal2Global::no,
GetNonCstSourceParameter());
}
void Model::Forward()
{
std::cout << "Young modulus = " << GetYoungModulus().GetConstantValue() << std::endl;
std::cout << "Poisson ratio = " << GetPoissonRatio().GetConstantValue() << std::endl;
std::cout << "Transient source = " << GetSourceParameter().GetConstantValue() << std::endl;
std::ofstream out;
FilesystemNS::File::Append(out, output_file_, __FILE__, __LINE__);
decltype(auto) time_manager = GetTimeManager();
out << "Time iteration = " << time_manager.NtimeModified() << "\t(" << time_manager.GetTime() << ')' << std::endl;
out << "\tTime varying scalar= " << GetYoungModulus().GetConstantValue() << std::endl;
out << "\tTime constant scalar = " << GetPoissonRatio().GetConstantValue() << std::endl;
out << "\tTime varying transient source = " << GetSourceParameter().GetConstantValue() << std::endl;
}
......@@ -137,7 +155,9 @@ namespace HappyHeart
void Model::SupplFinalize()
{ }
{
std::cout << output_file_ << " has been written." << std::endl;
}
} // namespace TestParameterTimeDependencyNS
......
......@@ -118,10 +118,7 @@ namespace HappyHeart
*/
void SupplFinalize();
//! Output directory.
const std::string& GetOutputDirectory() const noexcept;
private:
......@@ -175,10 +172,8 @@ namespace HappyHeart
private:
//! Output directory.
const std::string output_directory_;
//! Output file for current rank.
std::string output_file_;
//! Young modulus (i.e. scalar parameter) that in the test may vary with time.
typename scalar_varying_type::unique_ptr young_modulus_ = nullptr;
......
......@@ -30,12 +30,6 @@ namespace HappyHeart
return false; // ie no additional condition
}
inline const std::string& Model::GetOutputDirectory() const noexcept
{
return output_directory_;
}
inline const Model::scalar_immutable_type& Model::GetPoissonRatio() const noexcept
{
......
......@@ -72,7 +72,7 @@ namespace HappyHeart
}
void Append(std::fstream& inout, const std::string& filename, const char* invoking_file, int invoking_line)
void Append(std::ofstream& inout, const std::string& filename, const char* invoking_file, int invoking_line)
{
CheckFilenameNotEmpty(filename, invoking_file, invoking_line);
......
......@@ -63,7 +63,7 @@ namespace HappyHeart
* \param[out] stream Stream associated to the file.
*
*/
void Append(std::fstream& stream, const std::string& filename, const char* invoking_file, int invoking_line);
void Append(std::ofstream& stream, const std::string& filename, const char* invoking_file, int invoking_line);
//! Check whether \a filename exists or not.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment