Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Ataollah Mesgarnejad <amesga1@ti...>  20110707 16:26:23

Dear all, I have a TransientLinearImplicitSystem with 3 variables (u,v,w). I want to initialize it using attach_init_function. How can distinguish between variables in my init function which I pass to attach_init_function(), so to set the initial condition for each variable? Best Ata 
From: Ataollah Mesgarnejad <amesga1@ti...>  20110707 16:26:23

Dear all, I have a TransientLinearImplicitSystem with 3 variables (u,v,w). I want to initialize it using attach_init_function. How can distinguish between variables in my init function which I pass to attach_init_function(), so to set the initial condition for each variable? Best Ata 
From: John Peterson <jwpeterson@gm...>  20110707 16:35:03

On Thu, Jul 7, 2011 at 10:26 AM, Ataollah Mesgarnejad <amesga1@...> wrote: > Dear all, > > I have a TransientLinearImplicitSystem with 3 variables (u,v,w). I want to initialize it using attach_init_function. How can distinguish between variables in my init function which I pass to attach_init_function(), so to set the initial condition for each variable? This is demonstrated in ex10. Two different functions are used in ex10: init_cd() and exact_value(). init_cd() is attached to the system, and simply calls system.project_solution(exact_value). The exact_value() function takes 4 arguments, the last two of which are not used in ex10, but which are the system name (in case you have multiple systems) and the variable name (in case there are multiple variables). So the generalization of the exact_value() function for your case should be something like: Number exact_value (const Point& p, const Parameters& parameters, const std::string& sys_name, const std::string& var_name) { if (var_name == "u") // Compute and return value for u else if (var_name =="v") // Compute and return value for v // etc. }  John 
From: Vasilis Vavourakis <vasvav@gm...>  20110707 21:25:01

how about the following code, would that do for you? // access one node of the mesh through this pointer Node* node; // set the solution vector (ie. displacement) to this node Real soln[3] ={ u, v, w }; // loop for all system variables : for (unsigned int ivar=0; ivar<node>n_vars(system.number()); ivar++) { // loop for all components (typically one) : for (unsigned int icomp=0; icomp<node>n_comp(system.number(), ivar); icomp++) { const unsigned int idof =node>dof_number(system.number(), ivar, 0); system.current_solution>set(idof, soln[ivar]); } } you can implement it in your "init_function" ...as in example 9 of libmesh. cheers, Vas 2011/7/7 Ataollah Mesgarnejad <amesga1@...> > Dear all, > > I have a TransientLinearImplicitSystem with 3 variables (u,v,w). I want to > initialize it using attach_init_function. How can distinguish between > variables in my init function which I pass to attach_init_function(), so to > set the initial condition for each variable? > > Best > Ata > > > > > >  > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunkd2dc2 > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
From: Derek Gaston <friedmud@gm...>  20110707 22:05:30

This method is highly discouraged! It will only work for Lagrange shape functions. You should really use the built in projection methods by attaching an init function (like John mentioned). Whenever possible you should endeavor to write shape function agnostic code... You never know when it might come in handy! (and libMesh makes it so dang easy). Derek Sent from my iPad On Jul 7, 2011, at 5:25 PM, Vasilis Vavourakis <vasvav@...> wrote: > how about the following code, would that do for you? > > // access one node of the mesh through this pointer > Node* node; > // set the solution vector (ie. displacement) to this node > Real soln[3] ={ u, v, w }; > // loop for all system variables : > for (unsigned int ivar=0; ivar<node>n_vars(system.number()); ivar++) { > // loop for all components (typically one) : > for (unsigned int icomp=0; icomp<node>n_comp(system.number(), ivar); > icomp++) { > const unsigned int idof =node>dof_number(system.number(), ivar, > 0); > > system.current_solution>set(idof, soln[ivar]); > } > } > > you can implement it in your "init_function" ...as in example 9 of libmesh. > > cheers, > Vas > > > > 2011/7/7 Ataollah Mesgarnejad <amesga1@...> > >> Dear all, >> >> I have a TransientLinearImplicitSystem with 3 variables (u,v,w). I want to >> initialize it using attach_init_function. How can distinguish between >> variables in my init function which I pass to attach_init_function(), so to >> set the initial condition for each variable? >> >> Best >> Ata >> >> >> >> >> >>  >> All of the data generated in your IT infrastructure is seriously valuable. >> Why? It contains a definitive record of application performance, security >> threats, fraudulent activity, and more. Splunk takes this data and makes >> sense of it. IT sense. And common sense. >> http://p.sf.net/sfu/splunkd2dc2 >> _______________________________________________ >> Libmeshusers mailing list >> Libmeshusers@... >> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >  > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunkd2dc2 > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Vasilis Vavourakis <vasvav@gm...>  20110708 07:14:54

2011/7/8 Derek Gaston <friedmud@...> > This method is highly discouraged! It will only work for Lagrange > shape functions. You should really use the built in projection > methods by attaching an init function (like John mentioned). > oh, didn't know that...in fact, yes, i use only Lagrange basis in my problems. so far, it wasnt in need to initialize with some value the solution vector of my system, but will defo have in mind this remark of yours (about using that builtin projection function)! thanks for the tips :) > > Whenever possible you should endeavor to write shape function agnostic > code... You never know when it might come in handy! (and libMesh > makes it so dang easy). > > Derek > > Sent from my iPad > > On Jul 7, 2011, at 5:25 PM, Vasilis Vavourakis <vasvav@...> wrote: > > > how about the following code, would that do for you? > > > > // access one node of the mesh through this pointer > > Node* node; > > // set the solution vector (ie. displacement) to this node > > Real soln[3] ={ u, v, w }; > > // loop for all system variables : > > for (unsigned int ivar=0; ivar<node>n_vars(system.number()); ivar++) { > > // loop for all components (typically one) : > > for (unsigned int icomp=0; icomp<node>n_comp(system.number(), ivar); > > icomp++) { > > const unsigned int idof =node>dof_number(system.number(), ivar, > > 0); > > > > system.current_solution>set(idof, soln[ivar]); > > } > > } > > > > you can implement it in your "init_function" ...as in example 9 of > libmesh. > > > > cheers, > > Vas > > > > > > > > 2011/7/7 Ataollah Mesgarnejad <amesga1@...> > > > >> Dear all, > >> > >> I have a TransientLinearImplicitSystem with 3 variables (u,v,w). I want > to > >> initialize it using attach_init_function. How can distinguish between > >> variables in my init function which I pass to attach_init_function(), so > to > >> set the initial condition for each variable? > >> > >> Best > >> Ata > >> > >> > >> > >> > >> > >> >  > >> All of the data generated in your IT infrastructure is seriously > valuable. > >> Why? It contains a definitive record of application performance, > security > >> threats, fraudulent activity, and more. Splunk takes this data and makes > >> sense of it. IT sense. And common sense. > >> http://p.sf.net/sfu/splunkd2dc2 > >> _______________________________________________ > >> Libmeshusers mailing list > >> Libmeshusers@... > >> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > > >  > > All of the data generated in your IT infrastructure is seriously > valuable. > > Why? It contains a definitive record of application performance, security > > threats, fraudulent activity, and more. Splunk takes this data and makes > > sense of it. IT sense. And common sense. > > http://p.sf.net/sfu/splunkd2dc2 > > _______________________________________________ > > Libmeshusers mailing list > > Libmeshusers@... > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
Sign up for the SourceForge newsletter:
No, thanks