Hi David, Developers and users,
I did something on the input code, but still can't assign the initial values
to the specific variable. My goal is setting two variables' initials. To
simplify the case now, I only set the 'n2' parameter and leave 'n1' be zero,
but it looks both 'n1' and 'n2' are assigned initial values. The bond font
represents the added. I am not good at c++, would you please tell me
anything wrong below? Thanks!
Liang
===========================================================
Real exact_solution (const Real x,
const Real y,
const Real t,
*const std::string n_i*);
Number exact_value (const Point& p,
const Parameters& parameters,
const std::string&,
const std::string& *n_i*)
{
return exact_solution(p(0), p(1), parameters.get<Real> ("time")
*,"n2"*);
}
..........
void init_lc (EquationSystems& es,
const std::string& system_name)
{
libmesh_assert (system_name == "hw82d");
TransientLinearImplicitSystem & system =
es.get_system<TransientLinearImplicitSystem>("hw82d");
es.parameters.set<Real> ("time") = 0;
system.project_solution(exact_value, NULL, es.parameters);
}
Real exact_solution (const Real x,
const Real y,
const Real t,
*const std::string n_i*)
{
if (n_i == "n1")
return 111.111;
else if (n_i == "n2")
return 222.222;
}
============ output ======================
Variables=x,y,z,n1,n2
Zone f=fepoint, n=441, e=400, et=quadrilateral, c=black
0.00000 0.00000 0.00000 222.222 222.222
0.100000 0.00000 0.00000 222.222 222.222
0.100000 0.100000 0.00000 222.222 222.222
0.00000 0.100000 0.00000 222.222 222.222
0.0500000 0.00000 0.00000 222.222 222.222
