Dear Roy,

I think I partly found the key to the assertation failure problem. 

As I can undertand now, the usage of ParsedFunction is conditional, depending 
on if the boundary condition will be applied on a single variable or a variable 
group. This means if two variables u & v are set in one VG, then they have to 
be given the bc values by one ParsedFunction.

However, a variable group is defined just according to the FEType and subdomain 
restriction. If several variables of same FETypes  are added to one system, 
they will be put into a single VG, just like my case, where
all velocity components are of same orders and Family. In comparison, with LBB 
condition, P have one order lower than velocity. then p is added as a separate 
variable. 

Then I have to use a single ParsedFunction to set the vector values of boundary 
velocities or scalar for pinning the pressure.

Please let me know if this is correct. Cheers,


Zhenyu



On Mon, 30 Mar 2015, Roy Stogner wrote:

>
> On Sun, 29 Mar 2015, grandrabbit wrote:
>
>>    boundary_id_type id;
>>    std::vector<unsigned int> var_only(1,0);
>>    FunctionBase<Number> *f=nullptr;
>>   ...
>>    id=1; //inlet
>>    bid.clear();
>>    bid.insert(id);
>>    var_only[0]=0;//u
>>    bcfunctype=string("expr");
>>    bcfuncstring=string("y*(1-y)");
>>    f=new_function_base(bcfunctype,bcfuncstring);
>>    dofmap.add_dirichlet_boundary(DirichletBoundary(bid, var_only, f));
>>
>> The problem is, after I make it and run the executable, there 's always one 
>> assertation failure from parsed_function.h when equation_systems.init () is 
>> called:
>>
>> Assertion `i < parsers.size()' failed.
>> i = 1
>> parsers.size() = 1
>
> This assertion failure seems to imply that you've attached a function
> which only evaluates component 0, and are trying to use it to set the
> component *1* in a multiphysics problem... but the code above clearly
> doesn't have that problem; var_only is {0}.
>
> Could you boil the problem down to an example small enough to send us
> so I can try to replicate it?

Well, that wasn't a *small* example, and I wasn't able to replicate it
with the version of cmake on my system, but I think it was simple
enough to see the problem anyway:

     var_only[0]=1;//v
     bcfunctype=string("const");
     bcfuncstring=string("0.0");
     f=new_function_base(bcfunctype,bcfuncstring);
     cout<<"---- f(pt): "<<(*f)(pt)<<endl;
     dofmap.add_dirichlet_boundary(DirichletBoundary(bid, var_only, f));

Here f is a function with only one component, but you're asking it to
be used to define the DirichletBoundary for the second component of
your system.

What we've been doing in our own multiphysics software is to use
CompositeFunction to map between a particular physics variable order
and the global variable order:

https://github.com/grinsfem/grins/blob/2e6260258bc6609de0b25fef4c2e446bb91b2918/src/bc_handling/src/bc_handling_base.C#L147

But for less general operation it would be a sufficient workaround to
just manually create a multi-component ParsedFunction with the
function you want assigned to the correct component, e.g.
"{0}{0}{sin(x)}" if you want to set your third variable component
value to sin(x) on some boundary.
---
Roy
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to