From: Kyunghoon Lee <aeronova.mailing@gm...>  20130125 04:11:06

Hi all, In my previous email regarding inhomogeneous Dirichlet boundary conditions, David suggested using heterogenously_constrain_element_matrix_and_vector in introduction_ex4, but I'm not sure of how to deal with inhomogeneous Dirichlet BCs in connection with reduced basis models. Suppose we have a simple steady state heat conduction model whose BCs are u = T on \Gamma and u = 0 on the rest surfaces. After variable change, we solve a(u',v) = f(v)  a(u0,v) where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) u0 = T on \Gamma and u0 = zero on the rest surfaces. I thought we build the LHS then call attach_F_assembly to attach it, but in that case, I'm not sure how heterogenously_constrain_element_matrix_and_vector can be used. Or should we attach a(u',v) and f(v) as usual then call heterogenously_constrain_element_matrix_and_vector to impose  a(u0,v) on the LHS? I'd appreciate if someone can briefly describe how the function work. Regards, K. Lee. 
From: David Knezevic <dknezevic@se...>  20130125 04:18:10

Hi K, heterogeneously_constrain_element_matrix_and_vector is not relevant to Reduced Basis stuff. For Reduced Basis formulations, you have to transform the problem using a lifting function so that it has zero Dirichlet BC's  this is essential since you want your Reduced Basis space to be a vector space, i.e. it must contain 0 (which would be not be the case with nonzero Dirichlet BCs). This lifting function approach is what you described in your email already, so that's fine. Once you've transformed your problem using a lifting function, then you just proceed as normal, e.g. as in reduced_basis_ex1. The only trick is you have to add your lifting function back on at the end to recover u from u'. David On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: > Hi all, > > In my previous email regarding inhomogeneous Dirichlet boundary conditions, > David suggested using heterogenously_constrain_element_matrix_and_vector in > introduction_ex4, but I'm not sure of how to deal with inhomogeneous > Dirichlet BCs in connection with reduced basis models. Suppose we have a > simple steady state heat conduction model whose BCs are u = T on \Gamma and > u = 0 on the rest surfaces. After variable change, we solve > > a(u',v) = f(v)  a(u0,v) > > where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) u0 = > T on \Gamma and u0 = zero on the rest surfaces. I thought we build the LHS > then call attach_F_assembly to attach it, but in that case, I'm not sure > how heterogenously_constrain_element_matrix_and_vector can be used. Or > should we attach a(u',v) and f(v) as usual then call > heterogenously_constrain_element_matrix_and_vector to impose  a(u0,v) on > the LHS? I'd appreciate if someone can briefly describe how the function > work. > > Regards, > K. Lee. >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Kyunghoon Lee <aeronova.mailing@gm...>  20130125 04:34:30

Thanks for clearing it up. Then I guess we just solve for u' a(u',v) + a(u0,v) = f(v) and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then restore u by u = u' + u0. K. Lee. On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic <dknezevic@... > wrote: > Hi K, > > heterogeneously_constrain_element_matrix_and_vector is not relevant to > Reduced Basis stuff. For Reduced Basis formulations, you have to > transform the problem using a lifting function so that it has zero > Dirichlet BC's  this is essential since you want your Reduced Basis > space to be a vector space, i.e. it must contain 0 (which would be not > be the case with nonzero Dirichlet BCs). This lifting function approach > is what you described in your email already, so that's fine. > > Once you've transformed your problem using a lifting function, then you > just proceed as normal, e.g. as in reduced_basis_ex1. The only trick is > you have to add your lifting function back on at the end to recover u > from u'. > > David > > > > On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: > > Hi all, > > > > In my previous email regarding inhomogeneous Dirichlet boundary > conditions, > > David suggested using heterogenously_constrain_element_matrix_and_vector > in > > introduction_ex4, but I'm not sure of how to deal with inhomogeneous > > Dirichlet BCs in connection with reduced basis models. Suppose we have a > > simple steady state heat conduction model whose BCs are u = T on \Gamma > and > > u = 0 on the rest surfaces. After variable change, we solve > > > > a(u',v) = f(v)  a(u0,v) > > > > where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) u0 > = > > T on \Gamma and u0 = zero on the rest surfaces. I thought we build the > LHS > > then call attach_F_assembly to attach it, but in that case, I'm not sure > > how heterogenously_constrain_element_matrix_and_vector can be used. Or > > should we attach a(u',v) and f(v) as usual then call > > heterogenously_constrain_element_matrix_and_vector to impose  a(u0,v) on > > the LHS? I'd appreciate if someone can briefly describe how the function > > work. > > > > Regards, > > K. Lee. > > >  > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > > MVPs and experts. ON SALE this month only  learn more at: > > http://p.sf.net/sfu/learnnowd2d > > _______________________________________________ > > Libmeshusers mailing list > > Libmeshusers@... > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
From: David Knezevic <dknezevic@se...>  20130125 04:38:13

Yep, that's right, use the RB method to solve for u'. Note that you put a(u0,v) on the righthand side, since u0 is known (it's the "lifting function"). David On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: > Thanks for clearing it up. Then I guess we just solve for u' > > a(u',v) + a(u0,v) = f(v) > > and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then restore u > by u = u' + u0. > > K. Lee. > > On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic <dknezevic@... >> wrote: >> Hi K, >> >> heterogeneously_constrain_element_matrix_and_vector is not relevant to >> Reduced Basis stuff. For Reduced Basis formulations, you have to >> transform the problem using a lifting function so that it has zero >> Dirichlet BC's  this is essential since you want your Reduced Basis >> space to be a vector space, i.e. it must contain 0 (which would be not >> be the case with nonzero Dirichlet BCs). This lifting function approach >> is what you described in your email already, so that's fine. >> >> Once you've transformed your problem using a lifting function, then you >> just proceed as normal, e.g. as in reduced_basis_ex1. The only trick is >> you have to add your lifting function back on at the end to recover u >> from u'. >> >> David >> >> >> >> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: >>> Hi all, >>> >>> In my previous email regarding inhomogeneous Dirichlet boundary >> conditions, >>> David suggested using heterogenously_constrain_element_matrix_and_vector >> in >>> introduction_ex4, but I'm not sure of how to deal with inhomogeneous >>> Dirichlet BCs in connection with reduced basis models. Suppose we have a >>> simple steady state heat conduction model whose BCs are u = T on \Gamma >> and >>> u = 0 on the rest surfaces. After variable change, we solve >>> >>> a(u',v) = f(v)  a(u0,v) >>> >>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) u0 >> = >>> T on \Gamma and u0 = zero on the rest surfaces. I thought we build the >> LHS >>> then call attach_F_assembly to attach it, but in that case, I'm not sure >>> how heterogenously_constrain_element_matrix_and_vector can be used. Or >>> should we attach a(u',v) and f(v) as usual then call >>> heterogenously_constrain_element_matrix_and_vector to impose  a(u0,v) on >>> the LHS? I'd appreciate if someone can briefly describe how the function >>> work. >>> >>> Regards, >>> K. Lee. >>> >>  >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>> MVPs and experts. ON SALE this month only  learn more at: >>> http://p.sf.net/sfu/learnnowd2d >>> _______________________________________________ >>> Libmeshusers mailing list >>> Libmeshusers@... >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >> >>  >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> MVPs and experts. ON SALE this month only  learn more at: >> http://p.sf.net/sfu/learnnowd2d >> _______________________________________________ >> Libmeshusers mailing list >> Libmeshusers@... >> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Kyunghoon Lee <aeronova.mailing@gm...>  20130126 11:14:22

Thanks for the reply. Now I'd appreciate if you'd help me with the implementation of a(u0,v). I was thinking of computing Ke*u0 where Ke is the stiffness matrix and u0 is the lift function as below: //inhomogeneous Dirichlet BC struct IDBCAssembly : ElemAssembly { short unsigned int sbd_id; IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) {} virtual void interior_assembly(FEMContext &c) { const unsigned int u_var = 0; const std::vector<Real> &JxW = c.element_fe_var[u_var]>get_JxW(); const std::vector<std::vector<RealGradient> >& dphi = c.element_fe_var[u_var]>get_dphi(); const unsigned int n_u_dofs = c.dof_indices_var[u_var].size(); unsigned int n_qpoints = c.element_qrule>n_points(); // stiffness matrix Ke std::vector<std::vector<Number> > Ke(n_u_dofs, std::vector<Number>(n_u_dofs)); for (unsigned int qp=0; qp != n_qpoints; qp++) for (unsigned int i=0; i != n_u_dofs; i++) for (unsigned int j=0; j != n_u_dofs; j++) Ke[i][j] += JxW[qp] * dphi[j][qp] * dphi[i][qp]; // lift function u0 std::vector<Number> u0(n_u_dofs, 0.0); // multiply stiffness matrix by lift function for (unsigned int qp=0; qp != n_qpoints; qp++) for (unsigned int i=0; i != n_u_dofs; i++) for (unsigned int j=0; j != n_u_dofs; j++) c.elem_residual(i) += Ke[i][j] * u0[j]; } // end of interior_assembly }; However, I'm not sure of how to create the lift function u0 such that it has values for given boundary ID and zeros for elsewhere. I think I need to the following: iterate nodes if node belongs to the given boundary ID, set u0(i) = u0_given; otherwise u(i) = 0.0 but I'm not sure of how to check whether a node is associated with boundary ID. Can you help me with this problem, plz? (or are there examples related to this issue?) Best, K. Lee. On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic <dknezevic@... > wrote: > Yep, that's right, use the RB method to solve for u'. > > Note that you put a(u0,v) on the righthand side, since u0 is known > (it's the "lifting function"). > > David > > > > On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: > > Thanks for clearing it up. Then I guess we just solve for u' > > > > a(u',v) + a(u0,v) = f(v) > > > > and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then restore u > > by u = u' + u0. > > > > K. Lee. > > > > On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < > dknezevic@... > >> wrote: > >> Hi K, > >> > >> heterogeneously_constrain_element_matrix_and_vector is not relevant to > >> Reduced Basis stuff. For Reduced Basis formulations, you have to > >> transform the problem using a lifting function so that it has zero > >> Dirichlet BC's  this is essential since you want your Reduced Basis > >> space to be a vector space, i.e. it must contain 0 (which would be not > >> be the case with nonzero Dirichlet BCs). This lifting function approach > >> is what you described in your email already, so that's fine. > >> > >> Once you've transformed your problem using a lifting function, then you > >> just proceed as normal, e.g. as in reduced_basis_ex1. The only trick is > >> you have to add your lifting function back on at the end to recover u > >> from u'. > >> > >> David > >> > >> > >> > >> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: > >>> Hi all, > >>> > >>> In my previous email regarding inhomogeneous Dirichlet boundary > >> conditions, > >>> David suggested using > heterogenously_constrain_element_matrix_and_vector > >> in > >>> introduction_ex4, but I'm not sure of how to deal with inhomogeneous > >>> Dirichlet BCs in connection with reduced basis models. Suppose we > have a > >>> simple steady state heat conduction model whose BCs are u = T on \Gamma > >> and > >>> u = 0 on the rest surfaces. After variable change, we solve > >>> > >>> a(u',v) = f(v)  a(u0,v) > >>> > >>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) > u0 > >> = > >>> T on \Gamma and u0 = zero on the rest surfaces. I thought we build the > >> LHS > >>> then call attach_F_assembly to attach it, but in that case, I'm not > sure > >>> how heterogenously_constrain_element_matrix_and_vector can be used. Or > >>> should we attach a(u',v) and f(v) as usual then call > >>> heterogenously_constrain_element_matrix_and_vector to impose  a(u0,v) > on > >>> the LHS? I'd appreciate if someone can briefly describe how the > function > >>> work. > >>> > >>> Regards, > >>> K. Lee. > >>> > >> >  > >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>> MVPs and experts. ON SALE this month only  learn more at: > >>> http://p.sf.net/sfu/learnnowd2d > >>> _______________________________________________ > >>> Libmeshusers mailing list > >>> Libmeshusers@... > >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > >> > >> >  > >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >> MVPs and experts. ON SALE this month only  learn more at: > >> http://p.sf.net/sfu/learnnowd2d > >> _______________________________________________ > >> Libmeshusers mailing list > >> Libmeshusers@... > >> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > > >  > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > > MVPs and experts. ON SALE this month only  learn more at: > > http://p.sf.net/sfu/learnnowd2d > > _______________________________________________ > > Libmeshusers mailing list > > Libmeshusers@... > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
From: David Knezevic <dknezevic@se...>  20130126 17:43:12

To create the lift function, probably the simplest thing to do is solve a Laplace equation (\Laplacian u = 0) with the Dirichlet boundary conditions that you want, and then use the solution as your u0. This process is called "elliptic lifting" since the Laplace equation is an elliptic PDE. Then to assemble a(u0,v), you need to do something like what you wrote. But the code can be simplified a bit; you don't need to compute Ke and then multiply. You can just get the gradient of u0 directly (by multiplying the coefficients of u0 with c.interior_gradient) and then integrate. David On 01/26/2013 06:14 AM, Kyunghoon Lee wrote: > Thanks for the reply. Now I'd appreciate if you'd help me with the > implementation of a(u0,v). I was thinking of computing Ke*u0 where Ke is > the stiffness matrix and u0 is the lift function as below: > > //inhomogeneous Dirichlet BC > struct IDBCAssembly : ElemAssembly { > > short unsigned int sbd_id; > IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) {} > > virtual void interior_assembly(FEMContext &c) { > > const unsigned int u_var = 0; > const std::vector<Real> &JxW = > c.element_fe_var[u_var]>get_JxW(); > const std::vector<std::vector<RealGradient> >& dphi = > c.element_fe_var[u_var]>get_dphi(); > > const unsigned int n_u_dofs = c.dof_indices_var[u_var].size(); > unsigned int n_qpoints = c.element_qrule>n_points(); > > // stiffness matrix Ke > std::vector<std::vector<Number> > Ke(n_u_dofs, > std::vector<Number>(n_u_dofs)); > for (unsigned int qp=0; qp != n_qpoints; qp++) > for (unsigned int i=0; i != n_u_dofs; i++) > for (unsigned int j=0; j != n_u_dofs; j++) > Ke[i][j] += JxW[qp] * dphi[j][qp] * dphi[i][qp]; > > // lift function u0 > std::vector<Number> u0(n_u_dofs, 0.0); > > // multiply stiffness matrix by lift function > for (unsigned int qp=0; qp != n_qpoints; qp++) > for (unsigned int i=0; i != n_u_dofs; i++) > for (unsigned int j=0; j != n_u_dofs; j++) > c.elem_residual(i) += Ke[i][j] * u0[j]; > } // end of interior_assembly > }; > > However, I'm not sure of how to create the lift function u0 such that it > has values for given boundary ID and zeros for elsewhere. I think I need > to the following: > > iterate nodes > if node belongs to the given boundary ID, set u0(i) = u0_given; otherwise > u(i) = 0.0 > > but I'm not sure of how to check whether a node is associated with boundary > ID. Can you help me with this problem, plz? (or are there examples related > to this issue?) > > Best, > K. Lee. > > > On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic <dknezevic@... >> wrote: >> Yep, that's right, use the RB method to solve for u'. >> >> Note that you put a(u0,v) on the righthand side, since u0 is known >> (it's the "lifting function"). >> >> David >> >> >> >> On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: >>> Thanks for clearing it up. Then I guess we just solve for u' >>> >>> a(u',v) + a(u0,v) = f(v) >>> >>> and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then restore u >>> by u = u' + u0. >>> >>> K. Lee. >>> >>> On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < >> dknezevic@... >>>> wrote: >>>> Hi K, >>>> >>>> heterogeneously_constrain_element_matrix_and_vector is not relevant to >>>> Reduced Basis stuff. For Reduced Basis formulations, you have to >>>> transform the problem using a lifting function so that it has zero >>>> Dirichlet BC's  this is essential since you want your Reduced Basis >>>> space to be a vector space, i.e. it must contain 0 (which would be not >>>> be the case with nonzero Dirichlet BCs). This lifting function approach >>>> is what you described in your email already, so that's fine. >>>> >>>> Once you've transformed your problem using a lifting function, then you >>>> just proceed as normal, e.g. as in reduced_basis_ex1. The only trick is >>>> you have to add your lifting function back on at the end to recover u >>>> from u'. >>>> >>>> David >>>> >>>> >>>> >>>> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: >>>>> Hi all, >>>>> >>>>> In my previous email regarding inhomogeneous Dirichlet boundary >>>> conditions, >>>>> David suggested using >> heterogenously_constrain_element_matrix_and_vector >>>> in >>>>> introduction_ex4, but I'm not sure of how to deal with inhomogeneous >>>>> Dirichlet BCs in connection with reduced basis models. Suppose we >> have a >>>>> simple steady state heat conduction model whose BCs are u = T on \Gamma >>>> and >>>>> u = 0 on the rest surfaces. After variable change, we solve >>>>> >>>>> a(u',v) = f(v)  a(u0,v) >>>>> >>>>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) >> u0 >>>> = >>>>> T on \Gamma and u0 = zero on the rest surfaces. I thought we build the >>>> LHS >>>>> then call attach_F_assembly to attach it, but in that case, I'm not >> sure >>>>> how heterogenously_constrain_element_matrix_and_vector can be used. Or >>>>> should we attach a(u',v) and f(v) as usual then call >>>>> heterogenously_constrain_element_matrix_and_vector to impose  a(u0,v) >> on >>>>> the LHS? I'd appreciate if someone can briefly describe how the >> function >>>>> work. >>>>> >>>>> Regards, >>>>> K. Lee. >>>>> >>  >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>> http://p.sf.net/sfu/learnnowd2d >>>>> _______________________________________________ >>>>> Libmeshusers mailing list >>>>> Libmeshusers@... >>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>> >>>> >>  >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>> MVPs and experts. ON SALE this month only  learn more at: >>>> http://p.sf.net/sfu/learnnowd2d >>>> _______________________________________________ >>>> Libmeshusers mailing list >>>> Libmeshusers@... >>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>> >>  >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>> MVPs and experts. ON SALE this month only  learn more at: >>> http://p.sf.net/sfu/learnnowd2d >>> _______________________________________________ >>> Libmeshusers mailing list >>> Libmeshusers@... >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >> >>  >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> MVPs and experts. ON SALE this month only  learn more at: >> http://p.sf.net/sfu/learnnowd2d >> _______________________________________________ >> Libmeshusers mailing list >> Libmeshusers@... >> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Kyunghoon Lee <aeronova.mailing@gm...>  20130127 00:23:18

Hi David, I'm afraid creating a lift function is much more complicated than I thought. I'm not sure why we need to solve a Laplace equation since we already know what the lift function looks like  some values on the nodes of the inhomogeneous Dirichlet BC and zeros elsewhere. I guess it would be much easier to directly set up a lift function by checking whether a node belongs to the inhomogeneous Dirichlet BC. Is this because we cannot create a lift function in that way? Anyway, If I follow what you suggest, I guess I need to do the following steps. 1. obtain u0 by solving a Laplace equation with inhomogeneous Dirichlet BC  maybe I can refer to introduction_ex3 for solving a Laplace equation, but somehow I need to deal with inhomogeneous Dirichlet BC by using heterogeneously_constrain_element_matrix_and_vector ? 2. assemble a(u0,v) by integrating the gradient of u0 Overall it looks like a nested problem  solving a Laplace equation inside of a reduced basis model construction. I wonder if you'd suggest some relevant examples/codes regarding the lift function creation. Best, K. Lee. On Sun, Jan 27, 2013 at 1:43 AM, David Knezevic <dknezevic@...>wrote: > To create the lift function, probably the simplest thing to do is solve > a Laplace equation (\Laplacian u = 0) with the Dirichlet boundary > conditions that you want, and then use the solution as your u0. This > process is called "elliptic lifting" since the Laplace equation is an > elliptic PDE. > > Then to assemble a(u0,v), you need to do something like what you wrote. > But the code can be simplified a bit; you don't need to compute Ke and > then multiply. You can just get the gradient of u0 directly (by > multiplying the coefficients of u0 with c.interior_gradient) and then > integrate. > > David > > > > On 01/26/2013 06:14 AM, Kyunghoon Lee wrote: > > Thanks for the reply. Now I'd appreciate if you'd help me with the > > implementation of a(u0,v). I was thinking of computing Ke*u0 where Ke is > > the stiffness matrix and u0 is the lift function as below: > > > > //inhomogeneous Dirichlet BC > > struct IDBCAssembly : ElemAssembly { > > > > short unsigned int sbd_id; > > IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) {} > > > > virtual void interior_assembly(FEMContext &c) { > > > > const unsigned int u_var = 0; > > const std::vector<Real> &JxW = > > c.element_fe_var[u_var]>get_JxW(); > > const std::vector<std::vector<RealGradient> >& dphi = > > c.element_fe_var[u_var]>get_dphi(); > > > > const unsigned int n_u_dofs = > c.dof_indices_var[u_var].size(); > > unsigned int n_qpoints = c.element_qrule>n_points(); > > > > // stiffness matrix Ke > > std::vector<std::vector<Number> > Ke(n_u_dofs, > > std::vector<Number>(n_u_dofs)); > > for (unsigned int qp=0; qp != n_qpoints; qp++) > > for (unsigned int i=0; i != n_u_dofs; i++) > > for (unsigned int j=0; j != n_u_dofs; j++) > > Ke[i][j] += JxW[qp] * dphi[j][qp] * dphi[i][qp]; > > > > // lift function u0 > > std::vector<Number> u0(n_u_dofs, 0.0); > > > > // multiply stiffness matrix by lift function > > for (unsigned int qp=0; qp != n_qpoints; qp++) > > for (unsigned int i=0; i != n_u_dofs; i++) > > for (unsigned int j=0; j != n_u_dofs; j++) > > c.elem_residual(i) += Ke[i][j] * u0[j]; > > } // end of interior_assembly > > }; > > > > However, I'm not sure of how to create the lift function u0 such that it > > has values for given boundary ID and zeros for elsewhere. I think I need > > to the following: > > > > iterate nodes > > if node belongs to the given boundary ID, set u0(i) = u0_given; otherwise > > u(i) = 0.0 > > > > but I'm not sure of how to check whether a node is associated with > boundary > > ID. Can you help me with this problem, plz? (or are there examples > related > > to this issue?) > > > > Best, > > K. Lee. > > > > > > On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic < > dknezevic@... > >> wrote: > >> Yep, that's right, use the RB method to solve for u'. > >> > >> Note that you put a(u0,v) on the righthand side, since u0 is known > >> (it's the "lifting function"). > >> > >> David > >> > >> > >> > >> On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: > >>> Thanks for clearing it up. Then I guess we just solve for u' > >>> > >>> a(u',v) + a(u0,v) = f(v) > >>> > >>> and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then > restore u > >>> by u = u' + u0. > >>> > >>> K. Lee. > >>> > >>> On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < > >> dknezevic@... > >>>> wrote: > >>>> Hi K, > >>>> > >>>> heterogeneously_constrain_element_matrix_and_vector is not relevant to > >>>> Reduced Basis stuff. For Reduced Basis formulations, you have to > >>>> transform the problem using a lifting function so that it has zero > >>>> Dirichlet BC's  this is essential since you want your Reduced Basis > >>>> space to be a vector space, i.e. it must contain 0 (which would be not > >>>> be the case with nonzero Dirichlet BCs). This lifting function > approach > >>>> is what you described in your email already, so that's fine. > >>>> > >>>> Once you've transformed your problem using a lifting function, then > you > >>>> just proceed as normal, e.g. as in reduced_basis_ex1. The only trick > is > >>>> you have to add your lifting function back on at the end to recover u > >>>> from u'. > >>>> > >>>> David > >>>> > >>>> > >>>> > >>>> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: > >>>>> Hi all, > >>>>> > >>>>> In my previous email regarding inhomogeneous Dirichlet boundary > >>>> conditions, > >>>>> David suggested using > >> heterogenously_constrain_element_matrix_and_vector > >>>> in > >>>>> introduction_ex4, but I'm not sure of how to deal with inhomogeneous > >>>>> Dirichlet BCs in connection with reduced basis models. Suppose we > >> have a > >>>>> simple steady state heat conduction model whose BCs are u = T on > \Gamma > >>>> and > >>>>> u = 0 on the rest surfaces. After variable change, we solve > >>>>> > >>>>> a(u',v) = f(v)  a(u0,v) > >>>>> > >>>>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) > >> u0 > >>>> = > >>>>> T on \Gamma and u0 = zero on the rest surfaces. I thought we build > the > >>>> LHS > >>>>> then call attach_F_assembly to attach it, but in that case, I'm not > >> sure > >>>>> how heterogenously_constrain_element_matrix_and_vector can be used. > Or > >>>>> should we attach a(u',v) and f(v) as usual then call > >>>>> heterogenously_constrain_element_matrix_and_vector to impose  > a(u0,v) > >> on > >>>>> the LHS? I'd appreciate if someone can briefly describe how the > >> function > >>>>> work. > >>>>> > >>>>> Regards, > >>>>> K. Lee. > >>>>> > >> >  > >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills > current > >>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>>>> MVPs and experts. ON SALE this month only  learn more at: > >>>>> http://p.sf.net/sfu/learnnowd2d > >>>>> _______________________________________________ > >>>>> Libmeshusers mailing list > >>>>> Libmeshusers@... > >>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >>>> > >>>> > >> >  > >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills > current > >>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>>> MVPs and experts. ON SALE this month only  learn more at: > >>>> http://p.sf.net/sfu/learnnowd2d > >>>> _______________________________________________ > >>>> Libmeshusers mailing list > >>>> Libmeshusers@... > >>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >>>> > >> >  > >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>> MVPs and experts. ON SALE this month only  learn more at: > >>> http://p.sf.net/sfu/learnnowd2d > >>> _______________________________________________ > >>> Libmeshusers mailing list > >>> Libmeshusers@... > >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > >> > >> >  > >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >> MVPs and experts. ON SALE this month only  learn more at: > >> http://p.sf.net/sfu/learnnowd2d > >> _______________________________________________ > >> Libmeshusers mailing list > >> Libmeshusers@... > >> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > > >  > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > > MVPs and experts. ON SALE this month only  learn more at: > > http://p.sf.net/sfu/learnnowd2d > > _______________________________________________ > > Libmeshusers mailing list > > Libmeshusers@... > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
From: David Knezevic <dknezevic@se...>  20130127 21:25:51

Hi K, It doesn't matter how you get the lift function. If you can construct u0 "by hand" then that's fine, but it may not always be so easy, e.g. if the domain is nontrivial. Solving a laplace problem will work in general. To do this just follow introduction_ex4 (which already has nonhomogeneous Dirichlet BCs). Re this: On 01/26/2013 07:23 PM, Kyunghoon Lee wrote: > Overall it looks like a nested problem  solving a Laplace equation > inside of a reduced basis model construction. I wonder if you'd suggest > some relevant examples/codes regarding the lift function creation. Well, you solve the Laplace problem (as in introduction_ex4), store the result, then do the RB stuff. David > > Best, > K. Lee. > > On Sun, Jan 27, 2013 at 1:43 AM, David Knezevic > <dknezevic@...>wrote: > >> To create the lift function, probably the simplest thing to do is solve >> a Laplace equation (\Laplacian u = 0) with the Dirichlet boundary >> conditions that you want, and then use the solution as your u0. This >> process is called "elliptic lifting" since the Laplace equation is an >> elliptic PDE. >> >> Then to assemble a(u0,v), you need to do something like what you wrote. >> But the code can be simplified a bit; you don't need to compute Ke and >> then multiply. You can just get the gradient of u0 directly (by >> multiplying the coefficients of u0 with c.interior_gradient) and then >> integrate. >> >> David >> >> >> >> On 01/26/2013 06:14 AM, Kyunghoon Lee wrote: >>> Thanks for the reply. Now I'd appreciate if you'd help me with the >>> implementation of a(u0,v). I was thinking of computing Ke*u0 where Ke is >>> the stiffness matrix and u0 is the lift function as below: >>> >>> //inhomogeneous Dirichlet BC >>> struct IDBCAssembly : ElemAssembly { >>> >>> short unsigned int sbd_id; >>> IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) {} >>> >>> virtual void interior_assembly(FEMContext &c) { >>> >>> const unsigned int u_var = 0; >>> const std::vector<Real> &JxW = >>> c.element_fe_var[u_var]>get_JxW(); >>> const std::vector<std::vector<RealGradient> >& dphi = >>> c.element_fe_var[u_var]>get_dphi(); >>> >>> const unsigned int n_u_dofs = >> c.dof_indices_var[u_var].size(); >>> unsigned int n_qpoints = c.element_qrule>n_points(); >>> >>> // stiffness matrix Ke >>> std::vector<std::vector<Number> > Ke(n_u_dofs, >>> std::vector<Number>(n_u_dofs)); >>> for (unsigned int qp=0; qp != n_qpoints; qp++) >>> for (unsigned int i=0; i != n_u_dofs; i++) >>> for (unsigned int j=0; j != n_u_dofs; j++) >>> Ke[i][j] += JxW[qp] * dphi[j][qp] * dphi[i][qp]; >>> >>> // lift function u0 >>> std::vector<Number> u0(n_u_dofs, 0.0); >>> >>> // multiply stiffness matrix by lift function >>> for (unsigned int qp=0; qp != n_qpoints; qp++) >>> for (unsigned int i=0; i != n_u_dofs; i++) >>> for (unsigned int j=0; j != n_u_dofs; j++) >>> c.elem_residual(i) += Ke[i][j] * u0[j]; >>> } // end of interior_assembly >>> }; >>> >>> However, I'm not sure of how to create the lift function u0 such that it >>> has values for given boundary ID and zeros for elsewhere. I think I need >>> to the following: >>> >>> iterate nodes >>> if node belongs to the given boundary ID, set u0(i) = u0_given; otherwise >>> u(i) = 0.0 >>> >>> but I'm not sure of how to check whether a node is associated with >> boundary >>> ID. Can you help me with this problem, plz? (or are there examples >> related >>> to this issue?) >>> >>> Best, >>> K. Lee. >>> >>> >>> On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic < >> dknezevic@... >>>> wrote: >>>> Yep, that's right, use the RB method to solve for u'. >>>> >>>> Note that you put a(u0,v) on the righthand side, since u0 is known >>>> (it's the "lifting function"). >>>> >>>> David >>>> >>>> >>>> >>>> On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: >>>>> Thanks for clearing it up. Then I guess we just solve for u' >>>>> >>>>> a(u',v) + a(u0,v) = f(v) >>>>> >>>>> and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then >> restore u >>>>> by u = u' + u0. >>>>> >>>>> K. Lee. >>>>> >>>>> On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < >>>> dknezevic@... >>>>>> wrote: >>>>>> Hi K, >>>>>> >>>>>> heterogeneously_constrain_element_matrix_and_vector is not relevant to >>>>>> Reduced Basis stuff. For Reduced Basis formulations, you have to >>>>>> transform the problem using a lifting function so that it has zero >>>>>> Dirichlet BC's  this is essential since you want your Reduced Basis >>>>>> space to be a vector space, i.e. it must contain 0 (which would be not >>>>>> be the case with nonzero Dirichlet BCs). This lifting function >> approach >>>>>> is what you described in your email already, so that's fine. >>>>>> >>>>>> Once you've transformed your problem using a lifting function, then >> you >>>>>> just proceed as normal, e.g. as in reduced_basis_ex1. The only trick >> is >>>>>> you have to add your lifting function back on at the end to recover u >>>>>> from u'. >>>>>> >>>>>> David >>>>>> >>>>>> >>>>>> >>>>>> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: >>>>>>> Hi all, >>>>>>> >>>>>>> In my previous email regarding inhomogeneous Dirichlet boundary >>>>>> conditions, >>>>>>> David suggested using >>>> heterogenously_constrain_element_matrix_and_vector >>>>>> in >>>>>>> introduction_ex4, but I'm not sure of how to deal with inhomogeneous >>>>>>> Dirichlet BCs in connection with reduced basis models. Suppose we >>>> have a >>>>>>> simple steady state heat conduction model whose BCs are u = T on >> \Gamma >>>>>> and >>>>>>> u = 0 on the rest surfaces. After variable change, we solve >>>>>>> >>>>>>> a(u',v) = f(v)  a(u0,v) >>>>>>> >>>>>>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and 2) >>>> u0 >>>>>> = >>>>>>> T on \Gamma and u0 = zero on the rest surfaces. I thought we build >> the >>>>>> LHS >>>>>>> then call attach_F_assembly to attach it, but in that case, I'm not >>>> sure >>>>>>> how heterogenously_constrain_element_matrix_and_vector can be used. >> Or >>>>>>> should we attach a(u',v) and f(v) as usual then call >>>>>>> heterogenously_constrain_element_matrix_and_vector to impose  >> a(u0,v) >>>> on >>>>>>> the LHS? I'd appreciate if someone can briefly describe how the >>>> function >>>>>>> work. >>>>>>> >>>>>>> Regards, >>>>>>> K. Lee. >>>>>>> >>  >>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> current >>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>>> _______________________________________________ >>>>>>> Libmeshusers mailing list >>>>>>> Libmeshusers@... >>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>>> >>  >>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> current >>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>> _______________________________________________ >>>>>> Libmeshusers mailing list >>>>>> Libmeshusers@... >>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>>> >>  >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>> http://p.sf.net/sfu/learnnowd2d >>>>> _______________________________________________ >>>>> Libmeshusers mailing list >>>>> Libmeshusers@... >>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>> >>>> >>  >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>> MVPs and experts. ON SALE this month only  learn more at: >>>> http://p.sf.net/sfu/learnnowd2d >>>> _______________________________________________ >>>> Libmeshusers mailing list >>>> Libmeshusers@... >>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>> >>  >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>> MVPs and experts. ON SALE this month only  learn more at: >>> http://p.sf.net/sfu/learnnowd2d >>> _______________________________________________ >>> Libmeshusers mailing list >>> Libmeshusers@... >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >> >>  >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> MVPs and experts. ON SALE this month only  learn more at: >> http://p.sf.net/sfu/learnnowd2d >> _______________________________________________ >> Libmeshusers mailing list >> Libmeshusers@... >> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 
From: Kyunghoon Lee <aeronova.mailing@gm...>  20130128 04:42:22

Thanks for the comments. I'm not sure whether I can pull it off, but I'll try. K. Lee. On Mon, Jan 28, 2013 at 5:25 AM, David Knezevic <dknezevic@...>wrote: > Hi K, > > It doesn't matter how you get the lift function. If you can construct u0 > "by hand" then that's fine, but it may not always be so easy, e.g. if > the domain is nontrivial. Solving a laplace problem will work in > general. To do this just follow introduction_ex4 (which already has > nonhomogeneous Dirichlet BCs). > > Re this: > > On 01/26/2013 07:23 PM, Kyunghoon Lee wrote: > > Overall it looks like a nested problem  solving a Laplace equation > > inside of a reduced basis model construction. I wonder if you'd suggest > > some relevant examples/codes regarding the lift function creation. > > Well, you solve the Laplace problem (as in introduction_ex4), store the > result, then do the RB stuff. > > David > > > > > > > > > Best, > > K. Lee. > > > > On Sun, Jan 27, 2013 at 1:43 AM, David Knezevic > > <dknezevic@...>wrote: > > > >> To create the lift function, probably the simplest thing to do is solve > >> a Laplace equation (\Laplacian u = 0) with the Dirichlet boundary > >> conditions that you want, and then use the solution as your u0. This > >> process is called "elliptic lifting" since the Laplace equation is an > >> elliptic PDE. > >> > >> Then to assemble a(u0,v), you need to do something like what you wrote. > >> But the code can be simplified a bit; you don't need to compute Ke and > >> then multiply. You can just get the gradient of u0 directly (by > >> multiplying the coefficients of u0 with c.interior_gradient) and then > >> integrate. > >> > >> David > >> > >> > >> > >> On 01/26/2013 06:14 AM, Kyunghoon Lee wrote: > >>> Thanks for the reply. Now I'd appreciate if you'd help me with the > >>> implementation of a(u0,v). I was thinking of computing Ke*u0 where Ke > is > >>> the stiffness matrix and u0 is the lift function as below: > >>> > >>> //inhomogeneous Dirichlet BC > >>> struct IDBCAssembly : ElemAssembly { > >>> > >>> short unsigned int sbd_id; > >>> IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) {} > >>> > >>> virtual void interior_assembly(FEMContext &c) { > >>> > >>> const unsigned int u_var = 0; > >>> const std::vector<Real> &JxW = > >>> c.element_fe_var[u_var]>get_JxW(); > >>> const std::vector<std::vector<RealGradient> >& dphi = > >>> c.element_fe_var[u_var]>get_dphi(); > >>> > >>> const unsigned int n_u_dofs = > >> c.dof_indices_var[u_var].size(); > >>> unsigned int n_qpoints = c.element_qrule>n_points(); > >>> > >>> // stiffness matrix Ke > >>> std::vector<std::vector<Number> > Ke(n_u_dofs, > >>> std::vector<Number>(n_u_dofs)); > >>> for (unsigned int qp=0; qp != n_qpoints; qp++) > >>> for (unsigned int i=0; i != n_u_dofs; i++) > >>> for (unsigned int j=0; j != n_u_dofs; j++) > >>> Ke[i][j] += JxW[qp] * dphi[j][qp] * > dphi[i][qp]; > >>> > >>> // lift function u0 > >>> std::vector<Number> u0(n_u_dofs, 0.0); > >>> > >>> // multiply stiffness matrix by lift function > >>> for (unsigned int qp=0; qp != n_qpoints; qp++) > >>> for (unsigned int i=0; i != n_u_dofs; i++) > >>> for (unsigned int j=0; j != n_u_dofs; j++) > >>> c.elem_residual(i) += Ke[i][j] * u0[j]; > >>> } // end of interior_assembly > >>> }; > >>> > >>> However, I'm not sure of how to create the lift function u0 such that > it > >>> has values for given boundary ID and zeros for elsewhere. I think I > need > >>> to the following: > >>> > >>> iterate nodes > >>> if node belongs to the given boundary ID, set u0(i) = u0_given; > otherwise > >>> u(i) = 0.0 > >>> > >>> but I'm not sure of how to check whether a node is associated with > >> boundary > >>> ID. Can you help me with this problem, plz? (or are there examples > >> related > >>> to this issue?) > >>> > >>> Best, > >>> K. Lee. > >>> > >>> > >>> On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic < > >> dknezevic@... > >>>> wrote: > >>>> Yep, that's right, use the RB method to solve for u'. > >>>> > >>>> Note that you put a(u0,v) on the righthand side, since u0 is known > >>>> (it's the "lifting function"). > >>>> > >>>> David > >>>> > >>>> > >>>> > >>>> On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: > >>>>> Thanks for clearing it up. Then I guess we just solve for u' > >>>>> > >>>>> a(u',v) + a(u0,v) = f(v) > >>>>> > >>>>> and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then > >> restore u > >>>>> by u = u' + u0. > >>>>> > >>>>> K. Lee. > >>>>> > >>>>> On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < > >>>> dknezevic@... > >>>>>> wrote: > >>>>>> Hi K, > >>>>>> > >>>>>> heterogeneously_constrain_element_matrix_and_vector is not relevant > to > >>>>>> Reduced Basis stuff. For Reduced Basis formulations, you have to > >>>>>> transform the problem using a lifting function so that it has zero > >>>>>> Dirichlet BC's  this is essential since you want your Reduced > Basis > >>>>>> space to be a vector space, i.e. it must contain 0 (which would be > not > >>>>>> be the case with nonzero Dirichlet BCs). This lifting function > >> approach > >>>>>> is what you described in your email already, so that's fine. > >>>>>> > >>>>>> Once you've transformed your problem using a lifting function, then > >> you > >>>>>> just proceed as normal, e.g. as in reduced_basis_ex1. The only trick > >> is > >>>>>> you have to add your lifting function back on at the end to recover > u > >>>>>> from u'. > >>>>>> > >>>>>> David > >>>>>> > >>>>>> > >>>>>> > >>>>>> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: > >>>>>>> Hi all, > >>>>>>> > >>>>>>> In my previous email regarding inhomogeneous Dirichlet boundary > >>>>>> conditions, > >>>>>>> David suggested using > >>>> heterogenously_constrain_element_matrix_and_vector > >>>>>> in > >>>>>>> introduction_ex4, but I'm not sure of how to deal with > inhomogeneous > >>>>>>> Dirichlet BCs in connection with reduced basis models. Suppose we > >>>> have a > >>>>>>> simple steady state heat conduction model whose BCs are u = T on > >> \Gamma > >>>>>> and > >>>>>>> u = 0 on the rest surfaces. After variable change, we solve > >>>>>>> > >>>>>>> a(u',v) = f(v)  a(u0,v) > >>>>>>> > >>>>>>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; and > 2) > >>>> u0 > >>>>>> = > >>>>>>> T on \Gamma and u0 = zero on the rest surfaces. I thought we build > >> the > >>>>>> LHS > >>>>>>> then call attach_F_assembly to attach it, but in that case, I'm not > >>>> sure > >>>>>>> how heterogenously_constrain_element_matrix_and_vector can be used. > >> Or > >>>>>>> should we attach a(u',v) and f(v) as usual then call > >>>>>>> heterogenously_constrain_element_matrix_and_vector to impose  > >> a(u0,v) > >>>> on > >>>>>>> the LHS? I'd appreciate if someone can briefly describe how the > >>>> function > >>>>>>> work. > >>>>>>> > >>>>>>> Regards, > >>>>>>> K. Lee. > >>>>>>> > >> >  > >>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, > CSS, > >>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills > >> current > >>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>>>>>> MVPs and experts. ON SALE this month only  learn more at: > >>>>>>> http://p.sf.net/sfu/learnnowd2d > >>>>>>> _______________________________________________ > >>>>>>> Libmeshusers mailing list > >>>>>>> Libmeshusers@... > >>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >>>>>> > >> >  > >>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, > CSS, > >>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills > >> current > >>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>>>>> MVPs and experts. ON SALE this month only  learn more at: > >>>>>> http://p.sf.net/sfu/learnnowd2d > >>>>>> _______________________________________________ > >>>>>> Libmeshusers mailing list > >>>>>> Libmeshusers@... > >>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >>>>>> > >> >  > >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills > current > >>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>>>> MVPs and experts. ON SALE this month only  learn more at: > >>>>> http://p.sf.net/sfu/learnnowd2d > >>>>> _______________________________________________ > >>>>> Libmeshusers mailing list > >>>>> Libmeshusers@... > >>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >>>> > >>>> > >> >  > >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills > current > >>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>>> MVPs and experts. ON SALE this month only  learn more at: > >>>> http://p.sf.net/sfu/learnnowd2d > >>>> _______________________________________________ > >>>> Libmeshusers mailing list > >>>> Libmeshusers@... > >>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >>>> > >> >  > >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >>> MVPs and experts. ON SALE this month only  learn more at: > >>> http://p.sf.net/sfu/learnnowd2d > >>> _______________________________________________ > >>> Libmeshusers mailing list > >>> Libmeshusers@... > >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > >> > >> >  > >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > >> MVPs and experts. ON SALE this month only  learn more at: > >> http://p.sf.net/sfu/learnnowd2d > >> _______________________________________________ > >> Libmeshusers mailing list > >> Libmeshusers@... > >> https://lists.sourceforge.net/lists/listinfo/libmeshusers > >> > > >  > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > > MVPs and experts. ON SALE this month only  learn more at: > > http://p.sf.net/sfu/learnnowd2d > > _______________________________________________ > > Libmeshusers mailing list > > Libmeshusers@... > > https://lists.sourceforge.net/lists/listinfo/libmeshusers > > > >  > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft > MVPs and experts. ON SALE this month only  learn more at: > http://p.sf.net/sfu/learnnowd2d > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers > 
From: Kyunghoon Lee <aeronova.mailing@gm...>  20130130 09:17:43

Hi David, Based on your comments, I solved \Laplacian u = 0 to with an inhomogeneous Dirichlet BC (e.g. u = 10 at the left end) and found the solution u is 10 all over the domain (because of diffusion). I expected to get u such that u = 10 at the left end and u = 0 elsewhere so that I can use it as a lift function. I wonder what you intended is to use u, which is 10 for the whole domain, by checking whether it belongs to the inhomogeneous Dirichlet BC or not. K. Lee. On Mon, Jan 28, 2013 at 12:42 PM, Kyunghoon Lee <aeronova.mailing@...>wrote: > Thanks for the comments. I'm not sure whether I can pull it off, but I'll > try. > > K. Lee. > > > On Mon, Jan 28, 2013 at 5:25 AM, David Knezevic < > dknezevic@...> wrote: > >> Hi K, >> >> It doesn't matter how you get the lift function. If you can construct u0 >> "by hand" then that's fine, but it may not always be so easy, e.g. if >> the domain is nontrivial. Solving a laplace problem will work in >> general. To do this just follow introduction_ex4 (which already has >> nonhomogeneous Dirichlet BCs). >> >> Re this: >> >> On 01/26/2013 07:23 PM, Kyunghoon Lee wrote: >> > Overall it looks like a nested problem  solving a Laplace equation >> > inside of a reduced basis model construction. I wonder if you'd suggest >> > some relevant examples/codes regarding the lift function creation. >> >> Well, you solve the Laplace problem (as in introduction_ex4), store the >> result, then do the RB stuff. >> >> David >> >> >> >> >> >> > >> > Best, >> > K. Lee. >> > >> > On Sun, Jan 27, 2013 at 1:43 AM, David Knezevic >> > <dknezevic@...>wrote: >> > >> >> To create the lift function, probably the simplest thing to do is solve >> >> a Laplace equation (\Laplacian u = 0) with the Dirichlet boundary >> >> conditions that you want, and then use the solution as your u0. This >> >> process is called "elliptic lifting" since the Laplace equation is an >> >> elliptic PDE. >> >> >> >> Then to assemble a(u0,v), you need to do something like what you wrote. >> >> But the code can be simplified a bit; you don't need to compute Ke and >> >> then multiply. You can just get the gradient of u0 directly (by >> >> multiplying the coefficients of u0 with c.interior_gradient) and then >> >> integrate. >> >> >> >> David >> >> >> >> >> >> >> >> On 01/26/2013 06:14 AM, Kyunghoon Lee wrote: >> >>> Thanks for the reply. Now I'd appreciate if you'd help me with the >> >>> implementation of a(u0,v). I was thinking of computing Ke*u0 where >> Ke is >> >>> the stiffness matrix and u0 is the lift function as below: >> >>> >> >>> //inhomogeneous Dirichlet BC >> >>> struct IDBCAssembly : ElemAssembly { >> >>> >> >>> short unsigned int sbd_id; >> >>> IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) >> {} >> >>> >> >>> virtual void interior_assembly(FEMContext &c) { >> >>> >> >>> const unsigned int u_var = 0; >> >>> const std::vector<Real> &JxW = >> >>> c.element_fe_var[u_var]>get_JxW(); >> >>> const std::vector<std::vector<RealGradient> >& dphi = >> >>> c.element_fe_var[u_var]>get_dphi(); >> >>> >> >>> const unsigned int n_u_dofs = >> >> c.dof_indices_var[u_var].size(); >> >>> unsigned int n_qpoints = c.element_qrule>n_points(); >> >>> >> >>> // stiffness matrix Ke >> >>> std::vector<std::vector<Number> > Ke(n_u_dofs, >> >>> std::vector<Number>(n_u_dofs)); >> >>> for (unsigned int qp=0; qp != n_qpoints; qp++) >> >>> for (unsigned int i=0; i != n_u_dofs; i++) >> >>> for (unsigned int j=0; j != n_u_dofs; j++) >> >>> Ke[i][j] += JxW[qp] * dphi[j][qp] * >> dphi[i][qp]; >> >>> >> >>> // lift function u0 >> >>> std::vector<Number> u0(n_u_dofs, 0.0); >> >>> >> >>> // multiply stiffness matrix by lift function >> >>> for (unsigned int qp=0; qp != n_qpoints; qp++) >> >>> for (unsigned int i=0; i != n_u_dofs; i++) >> >>> for (unsigned int j=0; j != n_u_dofs; j++) >> >>> c.elem_residual(i) += Ke[i][j] * u0[j]; >> >>> } // end of interior_assembly >> >>> }; >> >>> >> >>> However, I'm not sure of how to create the lift function u0 such that >> it >> >>> has values for given boundary ID and zeros for elsewhere. I think I >> need >> >>> to the following: >> >>> >> >>> iterate nodes >> >>> if node belongs to the given boundary ID, set u0(i) = u0_given; >> otherwise >> >>> u(i) = 0.0 >> >>> >> >>> but I'm not sure of how to check whether a node is associated with >> >> boundary >> >>> ID. Can you help me with this problem, plz? (or are there examples >> >> related >> >>> to this issue?) >> >>> >> >>> Best, >> >>> K. Lee. >> >>> >> >>> >> >>> On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic < >> >> dknezevic@... >> >>>> wrote: >> >>>> Yep, that's right, use the RB method to solve for u'. >> >>>> >> >>>> Note that you put a(u0,v) on the righthand side, since u0 is known >> >>>> (it's the "lifting function"). >> >>>> >> >>>> David >> >>>> >> >>>> >> >>>> >> >>>> On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: >> >>>>> Thanks for clearing it up. Then I guess we just solve for u' >> >>>>> >> >>>>> a(u',v) + a(u0,v) = f(v) >> >>>>> >> >>>>> and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then >> >> restore u >> >>>>> by u = u' + u0. >> >>>>> >> >>>>> K. Lee. >> >>>>> >> >>>>> On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < >> >>>> dknezevic@... >> >>>>>> wrote: >> >>>>>> Hi K, >> >>>>>> >> >>>>>> heterogeneously_constrain_element_matrix_and_vector is not >> relevant to >> >>>>>> Reduced Basis stuff. For Reduced Basis formulations, you have to >> >>>>>> transform the problem using a lifting function so that it has zero >> >>>>>> Dirichlet BC's  this is essential since you want your Reduced >> Basis >> >>>>>> space to be a vector space, i.e. it must contain 0 (which would be >> not >> >>>>>> be the case with nonzero Dirichlet BCs). This lifting function >> >> approach >> >>>>>> is what you described in your email already, so that's fine. >> >>>>>> >> >>>>>> Once you've transformed your problem using a lifting function, then >> >> you >> >>>>>> just proceed as normal, e.g. as in reduced_basis_ex1. The only >> trick >> >> is >> >>>>>> you have to add your lifting function back on at the end to >> recover u >> >>>>>> from u'. >> >>>>>> >> >>>>>> David >> >>>>>> >> >>>>>> >> >>>>>> >> >>>>>> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: >> >>>>>>> Hi all, >> >>>>>>> >> >>>>>>> In my previous email regarding inhomogeneous Dirichlet boundary >> >>>>>> conditions, >> >>>>>>> David suggested using >> >>>> heterogenously_constrain_element_matrix_and_vector >> >>>>>> in >> >>>>>>> introduction_ex4, but I'm not sure of how to deal with >> inhomogeneous >> >>>>>>> Dirichlet BCs in connection with reduced basis models. Suppose we >> >>>> have a >> >>>>>>> simple steady state heat conduction model whose BCs are u = T on >> >> \Gamma >> >>>>>> and >> >>>>>>> u = 0 on the rest surfaces. After variable change, we solve >> >>>>>>> >> >>>>>>> a(u',v) = f(v)  a(u0,v) >> >>>>>>> >> >>>>>>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; >> and 2) >> >>>> u0 >> >>>>>> = >> >>>>>>> T on \Gamma and u0 = zero on the rest surfaces. I thought we >> build >> >> the >> >>>>>> LHS >> >>>>>>> then call attach_F_assembly to attach it, but in that case, I'm >> not >> >>>> sure >> >>>>>>> how heterogenously_constrain_element_matrix_and_vector can be >> used. >> >> Or >> >>>>>>> should we attach a(u',v) and f(v) as usual then call >> >>>>>>> heterogenously_constrain_element_matrix_and_vector to impose  >> >> a(u0,v) >> >>>> on >> >>>>>>> the LHS? I'd appreciate if someone can briefly describe how the >> >>>> function >> >>>>>>> work. >> >>>>>>> >> >>>>>>> Regards, >> >>>>>>> K. Lee. >> >>>>>>> >> >> >>  >> >>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, >> CSS, >> >>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> >> current >> >>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> >>>>>>> MVPs and experts. ON SALE this month only  learn more at: >> >>>>>>> http://p.sf.net/sfu/learnnowd2d >> >>>>>>> _______________________________________________ >> >>>>>>> Libmeshusers mailing list >> >>>>>>> Libmeshusers@... >> >>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >>>>>> >> >> >>  >> >>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, >> CSS, >> >>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> >> current >> >>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> >>>>>> MVPs and experts. ON SALE this month only  learn more at: >> >>>>>> http://p.sf.net/sfu/learnnowd2d >> >>>>>> _______________________________________________ >> >>>>>> Libmeshusers mailing list >> >>>>>> Libmeshusers@... >> >>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >>>>>> >> >> >>  >> >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, >> CSS, >> >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> current >> >>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> >>>>> MVPs and experts. ON SALE this month only  learn more at: >> >>>>> http://p.sf.net/sfu/learnnowd2d >> >>>>> _______________________________________________ >> >>>>> Libmeshusers mailing list >> >>>>> Libmeshusers@... >> >>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >>>> >> >>>> >> >> >>  >> >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> current >> >>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> >>>> MVPs and experts. ON SALE this month only  learn more at: >> >>>> http://p.sf.net/sfu/learnnowd2d >> >>>> _______________________________________________ >> >>>> Libmeshusers mailing list >> >>>> Libmeshusers@... >> >>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >>>> >> >> >>  >> >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >> current >> >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> >>> MVPs and experts. ON SALE this month only  learn more at: >> >>> http://p.sf.net/sfu/learnnowd2d >> >>> _______________________________________________ >> >>> Libmeshusers mailing list >> >>> Libmeshusers@... >> >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >> >> >> >> >> >>  >> >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> >> MVPs and experts. ON SALE this month only  learn more at: >> >> http://p.sf.net/sfu/learnnowd2d >> >> _______________________________________________ >> >> Libmeshusers mailing list >> >> Libmeshusers@... >> >> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >> >> > >>  >> > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> > with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> > MVPs and experts. ON SALE this month only  learn more at: >> > http://p.sf.net/sfu/learnnowd2d >> > _______________________________________________ >> > Libmeshusers mailing list >> > Libmeshusers@... >> > https://lists.sourceforge.net/lists/listinfo/libmeshusers >> >> >> >>  >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >> MVPs and experts. ON SALE this month only  learn more at: >> http://p.sf.net/sfu/learnnowd2d >> _______________________________________________ >> Libmeshusers mailing list >> Libmeshusers@... >> https://lists.sourceforge.net/lists/listinfo/libmeshusers >> > > 
From: David Knezevic <dknezevic@se...>  20130130 13:41:14

If you want u=0 somewhere you have to impose that as a BC... what BCs did you impose? But actually, sounds like u0=10 might be the right lifting function in your case, in which case the Laplace problem is unnecessary. (No need to email the list about this now I think; let's take this discussion offlist) David On 01/30/2013 04:17 AM, Kyunghoon Lee wrote: > Hi David, > > Based on your comments, I solved \Laplacian u = 0 to with an inhomogeneous > Dirichlet BC (e.g. u = 10 at the left end) and found the solution u is 10 > all over the domain (because of diffusion). I expected to get u such that > u = 10 at the left end and u = 0 elsewhere so that I can use it as a lift > function. I wonder what you intended is to use u, which is 10 for the > whole domain, by checking whether it belongs to the inhomogeneous Dirichlet > BC or not. > > K. Lee. > > On Mon, Jan 28, 2013 at 12:42 PM, Kyunghoon Lee > <aeronova.mailing@...>wrote: > >> Thanks for the comments. I'm not sure whether I can pull it off, but I'll >> try. >> >> K. Lee. >> >> >> On Mon, Jan 28, 2013 at 5:25 AM, David Knezevic < >> dknezevic@...> wrote: >> >>> Hi K, >>> >>> It doesn't matter how you get the lift function. If you can construct u0 >>> "by hand" then that's fine, but it may not always be so easy, e.g. if >>> the domain is nontrivial. Solving a laplace problem will work in >>> general. To do this just follow introduction_ex4 (which already has >>> nonhomogeneous Dirichlet BCs). >>> >>> Re this: >>> >>> On 01/26/2013 07:23 PM, Kyunghoon Lee wrote: >>>> Overall it looks like a nested problem  solving a Laplace equation >>>> inside of a reduced basis model construction. I wonder if you'd suggest >>>> some relevant examples/codes regarding the lift function creation. >>> Well, you solve the Laplace problem (as in introduction_ex4), store the >>> result, then do the RB stuff. >>> >>> David >>> >>> >>> >>> >>> >>>> Best, >>>> K. Lee. >>>> >>>> On Sun, Jan 27, 2013 at 1:43 AM, David Knezevic >>>> <dknezevic@...>wrote: >>>> >>>>> To create the lift function, probably the simplest thing to do is solve >>>>> a Laplace equation (\Laplacian u = 0) with the Dirichlet boundary >>>>> conditions that you want, and then use the solution as your u0. This >>>>> process is called "elliptic lifting" since the Laplace equation is an >>>>> elliptic PDE. >>>>> >>>>> Then to assemble a(u0,v), you need to do something like what you wrote. >>>>> But the code can be simplified a bit; you don't need to compute Ke and >>>>> then multiply. You can just get the gradient of u0 directly (by >>>>> multiplying the coefficients of u0 with c.interior_gradient) and then >>>>> integrate. >>>>> >>>>> David >>>>> >>>>> >>>>> >>>>> On 01/26/2013 06:14 AM, Kyunghoon Lee wrote: >>>>>> Thanks for the reply. Now I'd appreciate if you'd help me with the >>>>>> implementation of a(u0,v). I was thinking of computing Ke*u0 where >>> Ke is >>>>>> the stiffness matrix and u0 is the lift function as below: >>>>>> >>>>>> //inhomogeneous Dirichlet BC >>>>>> struct IDBCAssembly : ElemAssembly { >>>>>> >>>>>> short unsigned int sbd_id; >>>>>> IDBCAssembly(short unsigned int sbd_id_in) : sbd_id(sbd_id_in) >>> {} >>>>>> virtual void interior_assembly(FEMContext &c) { >>>>>> >>>>>> const unsigned int u_var = 0; >>>>>> const std::vector<Real> &JxW = >>>>>> c.element_fe_var[u_var]>get_JxW(); >>>>>> const std::vector<std::vector<RealGradient> >& dphi = >>>>>> c.element_fe_var[u_var]>get_dphi(); >>>>>> >>>>>> const unsigned int n_u_dofs = >>>>> c.dof_indices_var[u_var].size(); >>>>>> unsigned int n_qpoints = c.element_qrule>n_points(); >>>>>> >>>>>> // stiffness matrix Ke >>>>>> std::vector<std::vector<Number> > Ke(n_u_dofs, >>>>>> std::vector<Number>(n_u_dofs)); >>>>>> for (unsigned int qp=0; qp != n_qpoints; qp++) >>>>>> for (unsigned int i=0; i != n_u_dofs; i++) >>>>>> for (unsigned int j=0; j != n_u_dofs; j++) >>>>>> Ke[i][j] += JxW[qp] * dphi[j][qp] * >>> dphi[i][qp]; >>>>>> // lift function u0 >>>>>> std::vector<Number> u0(n_u_dofs, 0.0); >>>>>> >>>>>> // multiply stiffness matrix by lift function >>>>>> for (unsigned int qp=0; qp != n_qpoints; qp++) >>>>>> for (unsigned int i=0; i != n_u_dofs; i++) >>>>>> for (unsigned int j=0; j != n_u_dofs; j++) >>>>>> c.elem_residual(i) += Ke[i][j] * u0[j]; >>>>>> } // end of interior_assembly >>>>>> }; >>>>>> >>>>>> However, I'm not sure of how to create the lift function u0 such that >>> it >>>>>> has values for given boundary ID and zeros for elsewhere. I think I >>> need >>>>>> to the following: >>>>>> >>>>>> iterate nodes >>>>>> if node belongs to the given boundary ID, set u0(i) = u0_given; >>> otherwise >>>>>> u(i) = 0.0 >>>>>> >>>>>> but I'm not sure of how to check whether a node is associated with >>>>> boundary >>>>>> ID. Can you help me with this problem, plz? (or are there examples >>>>> related >>>>>> to this issue?) >>>>>> >>>>>> Best, >>>>>> K. Lee. >>>>>> >>>>>> >>>>>> On Fri, Jan 25, 2013 at 12:38 PM, David Knezevic < >>>>> dknezevic@... >>>>>>> wrote: >>>>>>> Yep, that's right, use the RB method to solve for u'. >>>>>>> >>>>>>> Note that you put a(u0,v) on the righthand side, since u0 is known >>>>>>> (it's the "lifting function"). >>>>>>> >>>>>>> David >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 01/24/2013 11:34 PM, Kyunghoon Lee wrote: >>>>>>>> Thanks for clearing it up. Then I guess we just solve for u' >>>>>>>> >>>>>>>> a(u',v) + a(u0,v) = f(v) >>>>>>>> >>>>>>>> and attach assemblies a(u',v), a(u0,v), and f(v) as usual, then >>>>> restore u >>>>>>>> by u = u' + u0. >>>>>>>> >>>>>>>> K. Lee. >>>>>>>> >>>>>>>> On Fri, Jan 25, 2013 at 12:17 PM, David Knezevic < >>>>>>> dknezevic@... >>>>>>>>> wrote: >>>>>>>>> Hi K, >>>>>>>>> >>>>>>>>> heterogeneously_constrain_element_matrix_and_vector is not >>> relevant to >>>>>>>>> Reduced Basis stuff. For Reduced Basis formulations, you have to >>>>>>>>> transform the problem using a lifting function so that it has zero >>>>>>>>> Dirichlet BC's  this is essential since you want your Reduced >>> Basis >>>>>>>>> space to be a vector space, i.e. it must contain 0 (which would be >>> not >>>>>>>>> be the case with nonzero Dirichlet BCs). This lifting function >>>>> approach >>>>>>>>> is what you described in your email already, so that's fine. >>>>>>>>> >>>>>>>>> Once you've transformed your problem using a lifting function, then >>>>> you >>>>>>>>> just proceed as normal, e.g. as in reduced_basis_ex1. The only >>> trick >>>>> is >>>>>>>>> you have to add your lifting function back on at the end to >>> recover u >>>>>>>>> from u'. >>>>>>>>> >>>>>>>>> David >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On 01/24/2013 11:10 PM, Kyunghoon Lee wrote: >>>>>>>>>> Hi all, >>>>>>>>>> >>>>>>>>>> In my previous email regarding inhomogeneous Dirichlet boundary >>>>>>>>> conditions, >>>>>>>>>> David suggested using >>>>>>> heterogenously_constrain_element_matrix_and_vector >>>>>>>>> in >>>>>>>>>> introduction_ex4, but I'm not sure of how to deal with >>> inhomogeneous >>>>>>>>>> Dirichlet BCs in connection with reduced basis models. Suppose we >>>>>>> have a >>>>>>>>>> simple steady state heat conduction model whose BCs are u = T on >>>>> \Gamma >>>>>>>>> and >>>>>>>>>> u = 0 on the rest surfaces. After variable change, we solve >>>>>>>>>> >>>>>>>>>> a(u',v) = f(v)  a(u0,v) >>>>>>>>>> >>>>>>>>>> where 1) u' = u  T on \Gamma and u' = u on the rest surfaces; >>> and 2) >>>>>>> u0 >>>>>>>>> = >>>>>>>>>> T on \Gamma and u0 = zero on the rest surfaces. I thought we >>> build >>>>> the >>>>>>>>> LHS >>>>>>>>>> then call attach_F_assembly to attach it, but in that case, I'm >>> not >>>>>>> sure >>>>>>>>>> how heterogenously_constrain_element_matrix_and_vector can be >>> used. >>>>> Or >>>>>>>>>> should we attach a(u',v) and f(v) as usual then call >>>>>>>>>> heterogenously_constrain_element_matrix_and_vector to impose  >>>>> a(u0,v) >>>>>>> on >>>>>>>>>> the LHS? I'd appreciate if someone can briefly describe how the >>>>>>> function >>>>>>>>>> work. >>>>>>>>>> >>>>>>>>>> Regards, >>>>>>>>>> K. Lee. >>>>>>>>>> >>>  >>>>>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, >>> CSS, >>>>>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >>>>> current >>>>>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>>>>>> _______________________________________________ >>>>>>>>>> Libmeshusers mailing list >>>>>>>>>> Libmeshusers@... >>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>  >>>>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, >>> CSS, >>>>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >>>>> current >>>>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>>>>> _______________________________________________ >>>>>>>>> Libmeshusers mailing list >>>>>>>>> Libmeshusers@... >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>>>>>> >>>  >>>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, >>> CSS, >>>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >>> current >>>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>>>> _______________________________________________ >>>>>>>> Libmeshusers mailing list >>>>>>>> Libmeshusers@... >>>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>>>> >>>  >>>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >>> current >>>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>>> _______________________________________________ >>>>>>> Libmeshusers mailing list >>>>>>> Libmeshusers@... >>>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>>>> >>>  >>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills >>> current >>>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>>> http://p.sf.net/sfu/learnnowd2d >>>>>> _______________________________________________ >>>>>> Libmeshusers mailing list >>>>>> Libmeshusers@... >>>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>> >>>>> >>>  >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>>> MVPs and experts. ON SALE this month only  learn more at: >>>>> http://p.sf.net/sfu/learnnowd2d >>>>> _______________________________________________ >>>>> Libmeshusers mailing list >>>>> Libmeshusers@... >>>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>>>> >>>  >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>>> MVPs and experts. ON SALE this month only  learn more at: >>>> http://p.sf.net/sfu/learnnowd2d >>>> _______________________________________________ >>>> Libmeshusers mailing list >>>> Libmeshusers@... >>>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>> >>> >>>  >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>> with LearnDevNow  3,200 stepbystep video tutorials by Microsoft >>> MVPs and experts. ON SALE this month only  learn more at: >>> http://p.sf.net/sfu/learnnowd2d >>> _______________________________________________ >>> Libmeshusers mailing list >>> Libmeshusers@... >>> https://lists.sourceforge.net/lists/listinfo/libmeshusers >>> >> >  > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > _______________________________________________ > Libmeshusers mailing list > Libmeshusers@... > https://lists.sourceforge.net/lists/listinfo/libmeshusers 