From: Liang <goeasyon@gm...>  20100313 22:36:38

Hi Developers and Users, I am using 'exact_solution' function to set the initial condition for variables u and v respectively in my 2D model, but the system.project_solution function always assign the same value to both variables, how can I set the various initial conditions for 2 variables? ex8/9/10 contains only one variable u, I really have no idea on this thing, is it helpful I dig into the source code system_projection.C ? thanks! Liang 
From: liang cheng <goeasyon@gm...>  20100312 02:23:39

Hi developers and users, I completed an input script, which is a 1storder time dependent PDE including 2 equations and 2 variables. Then I generated this error when link the program. I have checked my codes with ex9 & ex11 a couple of times, but still can't get the code work. The problem may lie in the 'exact_solution' function, I have define it before main code as "Real exact_solution (const Real x,const Real y,const Real t);" did I miss some head files? Thanks! Liang ======================================================== liang@...:~/Desktop/libmesh/examples/lc2d_v1$ make Compiling C++ (in debug mode) lc2d_v1.C... Linking lc2d_v1dbg... lc2d_v1.x86_64unknownlinuxgnu.dbg.o: In function `exact_value(Point const&, Parameters const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/liang/Desktop/libmesh/examples/lc2d_v1/lc2d_v1.C:58: undefined reference to `exact_solution(double, double, double)' lc2d_v1.x86_64unknownlinuxgnu.dbg.o: In function `assemble_lc(EquationSystems&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/liang/Desktop/libmesh/examples/lc2d_v1/lc2d_v1.C:355: undefined reference to `exact_solution(double, double, double)' collect2: ld returned 1 exit status make: *** [lc2d_v1dbg] Error 1 
From: Liang <goeasyon@gm...>  20100312 04:53:20

liang cheng wrote: > Hi developers and users, > > I completed an input script, which is a 1storder time dependent PDE > including 2 equations and 2 variables. Then I generated this error > when link the program. I have checked my codes with ex9 & ex11 a > couple of times, but still can't get the code work. > > The problem may lie in the 'exact_solution' function, I have define it > before main code as "Real exact_solution (const Real x,const Real > y,const Real t);" did I miss some head files? > > Thanks! > > Liang > > ======================================================== > > liang@...:~/Desktop/libmesh/examples/lc2d_v1$ make > Compiling C++ (in debug mode) lc2d_v1.C... > Linking lc2d_v1dbg... > lc2d_v1.x86_64unknownlinuxgnu.dbg.o: In function `exact_value(Point > const&, Parameters const&, std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&)': > /home/liang/Desktop/libmesh/examples/lc2d_v1/lc2d_v1.C:58: undefined > reference to `exact_solution(double, double, double)' > lc2d_v1.x86_64unknownlinuxgnu.dbg.o: In function > `assemble_lc(EquationSystems&, std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&)': > /home/liang/Desktop/libmesh/examples/lc2d_v1/lc2d_v1.C:355: undefined > reference to `exact_solution(double, double, double)' > collect2: ld returned 1 exit status > make: *** [lc2d_v1dbg] Error 1 > I added the exact_solution.h head file and changed the combination of "exact_solution" and "exact_value" to the "exact_2D_solution" scheme. The problem still exists. Is this caused by the 4 [Ke]s and 2 [Fe]s in my equation system. I set the Kuu, Kuv, Kvu, Kuu, Fu, Fv just like the ex11 did. Any tips will be appreciated. Liang 
From: John Peterson <peterson@cf...>  20100312 14:48:30

On Thu, Mar 11, 2010 at 10:53 PM, Liang <goeasyon@...> wrote: > liang cheng wrote: >> Hi developers and users, >> >> I completed an input script, which is a 1storder time dependent PDE >> including 2 equations and 2 variables. Then I generated this error >> when link the program. I have checked my codes with ex9 & ex11 a >> couple of times, but still can't get the code work. >> >> The problem may lie in the 'exact_solution' function, I have define it >> before main code as "Real exact_solution (const Real x,const Real >> y,const Real t);" did I miss some head files? The problem is an undefined reference at link time, did you define your exact_solution function in a separate file, similar to what we did in ex3? If so, you probably aren't linking against the object file for your exact solution. Check out the Makefile for ex4, for example. It uses the exact solution of ex3, and creates a dependency by adding the ex3 exact solution to the list of srcfile. srcfiles := $(wildcard *.C) ../ex3/exact_solution.C  John 
From: Liang <goeasyon@gm...>  20100313 22:36:38

Hi Developers and Users, I am using 'exact_solution' function to set the initial condition for variables u and v respectively in my 2D model, but the system.project_solution function always assign the same value to both variables, how can I set the various initial conditions for 2 variables? ex8/9/10 contains only one variable u, I really have no idea on this thing, is it helpful I dig into the source code system_projection.C ? thanks! Liang 
From: David Knezevic <dknez@MIT.EDU>  20100313 23:01:11

Liang wrote: > Hi Developers and Users, > > I am using 'exact_solution' function to set the initial condition for > variables u and v respectively in my 2D model, but the > system.project_solution function always assign the same value to both > variables, how can I set the various initial conditions for 2 variables? > ex8/9/10 contains only one variable u, I really have no idea on > this thing, is it helpful I dig into the source code > system_projection.C ? thanks! If you have a look in the function project_solution in $LIBMESH_DIR/include/systems/system.h you'll see that the function pointers that project_solution accepts take a string argument "unknown_name." This is the name of the variable that is being assigned by project_solution, so, looking at ex9, you would modify "exact_solution" so it accepts an extra string argument and pass "unknown_name" to "exact_solution" in "exact_value." Then you just need to check the value of unknown_name in your exact_solution function and return the appropriate value.  Dave 
From: Liang <goeasyon@gm...>  20100313 23:13:49

> > If you have a look in the function project_solution in > $LIBMESH_DIR/include/systems/system.h you'll see that the function > pointers that project_solution accepts take a string argument > "unknown_name." This is the name of the variable that is being > assigned by project_solution, so, looking at ex9, you would modify > "exact_solution" so it accepts an extra string argument and pass > "unknown_name" to "exact_solution" in "exact_value." Then you just > need to check the value of unknown_name in your exact_solution > function and return the appropriate value. > >  Dave > Make sense! I appreciate your clues. let me work on this now. Have a good weekend! Liang 
From: liang cheng <goeasyon@gm...>  20100314 02:39:01

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 